From 6452e4bc6b8f22ff0fab9bacc4d9d56b56595496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=98=B8?= Date: Tue, 16 Apr 2024 09:35:42 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20Swagger=20=ED=95=84=EC=88=98=EC=9D=B8?= =?UTF-8?q?=EC=9E=90=20=EB=AA=85=EC=8B=9C=20(#425)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * dosc: swagger 3.1 로 설정 * dosc: Activity 필수 여부 추가 * dosc: bus 응답 추가 * dosc: article 응답 추가 * docs: Dept, Dining Dto 설명 추가 * docs: land * docs: land dto 보완 * docs: Member Dto 구체화 * docs: Owner DTO 구체화 * docs: OwnerShop DTO 구체화 * chore: record 명 변경 * chore: shop record 수정 * chore: timetable record 수정 * chore: user dto 개선 * chore: version dto 개선 * chore: bus dto 개선 * test: 테스트 설정파일 위치 변경 --- .../domain/activity/dto/ActivityResponse.java | 18 ++-- .../domain/bus/dto/BusCourseResponse.java | 5 + .../domain/bus/dto/BusRemainTimeResponse.java | 6 ++ .../domain/bus/dto/ExpressBusRemainTime.java | 4 + .../domain/community/dto/ArticleResponse.java | 101 ++++++++++-------- .../community/dto/ArticlesResponse.java | 98 +++++++++-------- .../community/dto/HotArticleItemResponse.java | 16 +-- .../koin/domain/community/model/Article.java | 2 +- .../koin/domain/community/model/Comment.java | 4 +- .../koin/domain/coop/controller/CoopApi.java | 3 +- .../coop/controller/CoopController.java | 2 +- .../domain/coop/dto/DiningImageRequest.java | 9 +- .../koin/domain/coop/dto/SoldOutRequest.java | 9 +- .../koin/domain/dept/dto/DeptResponse.java | 10 +- .../koin/domain/dept/dto/DeptsResponse.java | 15 ++- .../koin/domain/dept/service/DeptService.java | 1 - .../domain/dining/dto/DiningResponse.java | 28 ++--- .../koin/domain/land/dto/LandResponse.java | 76 ++++++------- .../koin/domain/land/dto/LandsResponse.java | 18 ++-- .../domain/member/dto/MemberResponse.java | 23 ++-- .../koin/domain/member/dto/TrackResponse.java | 20 ++-- .../member/dto/TrackSingleResponse.java | 43 +++++--- .../dto/OwnerPasswordResetVerifyRequest.java | 9 +- .../owner/dto/OwnerPasswordUpdateRequest.java | 4 +- .../owner/dto/OwnerRegisterRequest.java | 6 +- .../koin/domain/owner/dto/OwnerResponse.java | 23 ++-- .../owner/dto/OwnerSendEmailRequest.java | 4 + .../owner/dto/OwnerVerificationRequest.java | 19 ---- .../domain/owner/dto/OwnerVerifyRequest.java | 11 +- .../domain/owner/dto/OwnerVerifyResponse.java | 8 +- .../domain/owner/dto/VerifyEmailRequest.java | 8 +- ...vent.java => EventArticleCreateEvent.java} | 2 +- .../ownershop/dto/CreateEventRequest.java | 32 +++--- .../ownershop/dto/ModifyEventRequest.java | 26 +++-- .../dto/OwnerShopEventsResponse.java | 19 ++-- .../ownershop/dto/OwnerShopsRequest.java | 38 ++++--- .../ownershop/dto/OwnerShopsResponse.java | 11 ++ .../ownershop/service/OwnerShopService.java | 4 +- .../shop/dto/CreateCategoryRequest.java | 9 +- .../domain/shop/dto/CreateMenuRequest.java | 36 ++++--- .../shop/dto/MenuCategoriesResponse.java | 11 +- .../domain/shop/dto/MenuDetailResponse.java | 28 ++--- .../shop/dto/ModifyCategoryRequest.java | 11 +- .../domain/shop/dto/ModifyMenuRequest.java | 57 ++++++---- .../domain/shop/dto/ModifyShopRequest.java | 47 +++++--- .../shop/dto/ShopCategoriesResponse.java | 12 ++- .../domain/shop/dto/ShopEventsResponse.java | 21 ++-- .../domain/shop/dto/ShopMenuResponse.java | 33 +++--- .../koin/domain/shop/dto/ShopResponse.java | 32 +++--- .../koin/domain/shop/dto/ShopsResponse.java | 20 ++-- .../koin/domain/shop/model/EventArticle.java | 4 + .../domain/shop/model/ShopEventListener.java | 4 +- .../timetable/controller/TimetableApi.java | 4 +- .../controller/TimetableController.java | 4 +- .../domain/timetable/dto/LectureResponse.java | 28 ++--- .../timetable/dto/SemesterResponse.java | 6 +- ...quest.java => TimeTableCreateRequest.java} | 42 +++++--- .../timetable/dto/TimeTableResponse.java | 27 ++--- .../timetable/dto/TimeTableUpdateRequest.java | 41 ++++--- .../domain/timetable/model/TimeTable.java | 9 +- .../timetable/service/TimetableService.java | 6 +- .../koin/domain/user/dto/AuthResponse.java | 4 +- .../domain/user/dto/AuthTokenRequest.java | 3 +- .../koin/domain/user/dto/CoopResponse.java | 13 ++- .../user/dto/EmailCheckExistsRequest.java | 6 +- .../domain/user/dto/FindPasswordRequest.java | 8 +- .../user/dto/NicknameCheckExistsRequest.java | 6 +- .../user/dto/StudentRegisterRequest.java | 43 +++++--- .../koin/domain/user/dto/StudentResponse.java | 31 ++++-- .../domain/user/dto/StudentUpdateRequest.java | 32 ++++-- .../user/dto/StudentUpdateResponse.java | 32 ++++-- .../domain/user/dto/UserLoginRequest.java | 20 ++-- .../domain/user/dto/UserLoginResponse.java | 23 ++-- .../user/dto/UserPasswordChangeRequest.java | 7 ++ .../user/dto/UserTokenRefreshRequest.java | 7 +- .../user/dto/UserTokenRefreshResponse.java | 16 ++- .../domain/version/dto/VersionResponse.java | 18 +++- .../koin/global/config/SwaggerConfig.java | 1 + .../koin/acceptance/CommunityApiTest.java | 8 +- .../koin/acceptance/OwnerShopApiTest.java | 3 - .../koin/acceptance/ShopApiTest.java | 3 - .../resources/application.yml} | 0 .../resources/koin-firebase-adminsdk.json | 13 +++ 83 files changed, 950 insertions(+), 574 deletions(-) delete mode 100644 src/main/java/in/koreatech/koin/domain/owner/dto/OwnerVerificationRequest.java rename src/main/java/in/koreatech/koin/domain/ownershop/{ShopEventCreateEvent.java => EventArticleCreateEvent.java} (73%) rename src/main/java/in/koreatech/koin/domain/timetable/dto/{TimeTableRequest.java => TimeTableCreateRequest.java} (59%) rename src/{main/resources/application-test.yml => test/resources/application.yml} (100%) create mode 100644 src/test/resources/koin-firebase-adminsdk.json diff --git a/src/main/java/in/koreatech/koin/domain/activity/dto/ActivityResponse.java b/src/main/java/in/koreatech/koin/domain/activity/dto/ActivityResponse.java index 2727f010a6..40c0be1b1c 100644 --- a/src/main/java/in/koreatech/koin/domain/activity/dto/ActivityResponse.java +++ b/src/main/java/in/koreatech/koin/domain/activity/dto/ActivityResponse.java @@ -1,6 +1,8 @@ package in.koreatech.koin.domain.activity.dto; import static com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import java.time.LocalDate; import java.time.LocalDateTime; @@ -14,33 +16,33 @@ @JsonNaming(value = SnakeCaseStrategy.class) public record ActivityResponse( - @Schema(description = "활동 날짜", example = "2019-07-29") + @Schema(description = "활동 날짜", example = "2019-07-29", requiredMode = REQUIRED) @JsonFormat(pattern = "yyyy-MM-dd") LocalDate date, - @Schema(description = "삭제 여부", example = "false") + @Schema(description = "삭제 여부", example = "false", requiredMode = REQUIRED) Boolean isDeleted, - @Schema(description = "최근 업데이트 일시", example = "2019-08-16 23:01:52") + @Schema(description = "최근 업데이트 일시", example = "2019-08-16 23:01:52", requiredMode = REQUIRED) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime updatedAt, - @Schema(description = "초기 생성 일시", example = "2019-08-16 23:01:52") + @Schema(description = "초기 생성 일시", example = "2019-08-16 23:01:52", requiredMode = REQUIRED) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime createdAt, - @Schema(description = "활동 설명", example = "더 편리한 서비스 제공을 위해 시간표 기능을 추가했습니다.") + @Schema(description = "활동 설명", example = "더 편리한 서비스 제공을 위해 시간표 기능을 추가했습니다.", requiredMode = REQUIRED) String description, @Schema(description = "이미지 URL 목록", example = """ ["https://test2.com.png", "https://test3.com.png"] - """) + """, requiredMode = NOT_REQUIRED) List imageUrls, - @Schema(description = "고유 식별자", example = "1") + @Schema(description = "고유 식별자", example = "1", requiredMode = REQUIRED) Integer id, - @Schema(description = "제목", example = "코인 시간표 기능 추가") + @Schema(description = "제목", example = "코인 시간표 기능 추가", requiredMode = REQUIRED) String title ) { diff --git a/src/main/java/in/koreatech/koin/domain/bus/dto/BusCourseResponse.java b/src/main/java/in/koreatech/koin/domain/bus/dto/BusCourseResponse.java index 229eb193e1..e2a153d43f 100644 --- a/src/main/java/in/koreatech/koin/domain/bus/dto/BusCourseResponse.java +++ b/src/main/java/in/koreatech/koin/domain/bus/dto/BusCourseResponse.java @@ -1,15 +1,20 @@ package in.koreatech.koin.domain.bus.dto; import static com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; import com.fasterxml.jackson.databind.annotation.JsonNaming; import in.koreatech.koin.domain.bus.model.mongo.BusCourse; +import io.swagger.v3.oas.annotations.media.Schema; @JsonNaming(value = SnakeCaseStrategy.class) public record BusCourseResponse( + @Schema(description = "버스 타입", example = "shuttle", requiredMode = NOT_REQUIRED) String busType, + @Schema(description = "방향", example = "to", requiredMode = NOT_REQUIRED) String direction, + @Schema(description = "기준", example = "청주", requiredMode = NOT_REQUIRED) String region ) { diff --git a/src/main/java/in/koreatech/koin/domain/bus/dto/BusRemainTimeResponse.java b/src/main/java/in/koreatech/koin/domain/bus/dto/BusRemainTimeResponse.java index 568d0c7b91..677369184f 100644 --- a/src/main/java/in/koreatech/koin/domain/bus/dto/BusRemainTimeResponse.java +++ b/src/main/java/in/koreatech/koin/domain/bus/dto/BusRemainTimeResponse.java @@ -1,6 +1,7 @@ package in.koreatech.koin.domain.bus.dto; import static com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; import java.time.Clock; import java.util.List; @@ -10,9 +11,11 @@ import in.koreatech.koin.domain.bus.model.BusRemainTime; import in.koreatech.koin.domain.bus.model.city.CityBusRemainTime; import in.koreatech.koin.domain.bus.model.enums.BusType; +import io.swagger.v3.oas.annotations.media.Schema; @JsonNaming(SnakeCaseStrategy.class) public record BusRemainTimeResponse( + @Schema(description = "버스 타입", example = "shuttle", requiredMode = NOT_REQUIRED) String busType, InnerBusResponse nowBus, InnerBusResponse nextBus @@ -28,7 +31,10 @@ public static BusRemainTimeResponse of(BusType busType, List comments, @Schema(description = "생성 일자", example = "2023-01-04 12:00:01") @@ -79,41 +82,43 @@ public static ArticleResponse of(Article article) { @JsonNaming(value = SnakeCaseStrategy.class) private record InnerBoardResponse( - @Schema(description = "게시판 고유 ID", example = "1") + @Schema(description = "게시판 고유 ID", example = "1", requiredMode = REQUIRED) Integer id, - @Schema(description = "게시판 태그", example = "tag") + @Schema(description = "게시판 태그", example = "tag", requiredMode = REQUIRED) String tag, - @Schema(description = "게시판 이름", example = "게시판 이름") + @Schema(description = "게시판 이름", example = "게시판 이름", requiredMode = REQUIRED) String name, - @Schema(description = "익명 여부", example = "false") + @Schema(description = "익명 여부", example = "false", requiredMode = REQUIRED) boolean isAnonymous, - @Schema(description = "게시글 수", example = "1") - Integer articleCount, + @Schema(description = "게시글 수", example = "1", requiredMode = REQUIRED) + int articleCount, - @Schema(description = "삭제 여부", example = "false") + @Schema(description = "삭제 여부", example = "false", requiredMode = REQUIRED) boolean isDeleted, - @Schema(description = "공지 여부", example = "false") + @Schema(description = "공지 여부", example = "false", requiredMode = REQUIRED) boolean isNotice, - @Schema(description = "부모 게시판 고유 ID", example = "1") + @Schema(description = "부모 게시판 고유 ID", example = "1", requiredMode = NOT_REQUIRED) Integer parentId, - @Schema(description = "순서", example = "1") - Integer seq, + @Schema(description = "순서", example = "1", requiredMode = REQUIRED) + int seq, - @Schema(description = "하위 게시판 목록") + @Schema(description = "하위 게시판 목록", requiredMode = NOT_REQUIRED) List children, - @Schema(description = "생성 일자", example = "2023-01-04 12:00:01") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime createdAt, + @Schema(description = "생성 일자", example = "2023-01-04 12:00:01", requiredMode = REQUIRED) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + LocalDateTime createdAt, - @Schema(description = "수정 일자", example = "2023-01-04 12:00:01") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime updatedAt + @Schema(description = "수정 일자", example = "2023-01-04 12:00:01", requiredMode = REQUIRED) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + LocalDateTime updatedAt ) { public static InnerBoardResponse from(Board board) { @@ -137,34 +142,36 @@ public static InnerBoardResponse from(Board board) { @JsonNaming(value = SnakeCaseStrategy.class) private record InnerCommentResponse( - @Schema(description = "댓글 고유 ID", example = "1") + @Schema(description = "댓글 고유 ID", example = "1", requiredMode = NOT_REQUIRED) Integer id, - @Schema(description = "게시글 고유 ID", example = "1") + @Schema(description = "게시글 고유 ID", example = "1", requiredMode = REQUIRED) Integer articleId, - @Schema(description = "내용", example = "내용") + @Schema(description = "내용", example = "내용", requiredMode = REQUIRED) String content, - @Schema(description = "작성자 고유 ID", example = "1") + @Schema(description = "작성자 고유 ID", example = "1", requiredMode = REQUIRED) Integer userId, - @Schema(description = "작성자 닉네임", example = "닉네임") + @Schema(description = "작성자 닉네임", example = "닉네임", requiredMode = REQUIRED) String nickname, - @Schema(description = "삭제 여부", example = "false") - Boolean isDeleted, + @Schema(description = "삭제 여부", example = "false", requiredMode = REQUIRED) + boolean isDeleted, - @Schema(description = "수정 권한", example = "false") - @JsonProperty("grantEdit") Boolean grantEdit, + @Schema(description = "수정 권한", example = "false", requiredMode = REQUIRED) + @JsonProperty("grantEdit") + boolean grantEdit, - @Schema(description = "삭제 권한", example = "false") - @JsonProperty("grantDelete") Boolean grantDelete, + @Schema(description = "삭제 권한", example = "false", requiredMode = REQUIRED) + @JsonProperty("grantDelete") + boolean grantDelete, - @Schema(description = "생성 일자", example = "2023-01-04 12:00:01") + @Schema(description = "생성 일자", example = "2023-01-04 12:00:01", requiredMode = REQUIRED) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime createdAt, - @Schema(description = "수정 일자", example = "2023-01-04 12:00:01") + @Schema(description = "수정 일자", example = "2023-01-04 12:00:01", requiredMode = REQUIRED) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime updatedAt ) { @@ -176,8 +183,8 @@ public static InnerCommentResponse from(Comment comment) { comment.getUserId(), comment.getNickname(), comment.getIsDeleted(), - comment.getGrantEdit(), - comment.getGrantDelete(), + comment.isGrantEdit(), + comment.isGrantDelete(), comment.getCreatedAt(), comment.getUpdatedAt() ); diff --git a/src/main/java/in/koreatech/koin/domain/community/dto/ArticlesResponse.java b/src/main/java/in/koreatech/koin/domain/community/dto/ArticlesResponse.java index d2e601093b..2c981edd44 100644 --- a/src/main/java/in/koreatech/koin/domain/community/dto/ArticlesResponse.java +++ b/src/main/java/in/koreatech/koin/domain/community/dto/ArticlesResponse.java @@ -1,5 +1,8 @@ package in.koreatech.koin.domain.community.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import java.time.LocalDateTime; import java.util.List; @@ -13,14 +16,14 @@ import io.swagger.v3.oas.annotations.media.Schema; public record ArticlesResponse( - @Schema(description = "게시글 목록") + @Schema(description = "게시글 목록", requiredMode = NOT_REQUIRED) List articles, - @Schema(description = "게시판 정보") + @Schema(description = "게시판 정보", requiredMode = REQUIRED) InnerBoardResponse board, - @Schema(description = "총 페이지 수", example = "1") - Long totalPage + @Schema(description = "총 페이지 수", example = "1", requiredMode = REQUIRED) + long totalPage ) { public static ArticlesResponse of(List
articles, Board board, Long totalPage) { @@ -36,59 +39,62 @@ public static ArticlesResponse of(List
articles, Board board, Long tota @JsonNaming(value = SnakeCaseStrategy.class) private record InnerArticleResponse( - @Schema(description = "게시글 고유 ID", example = "1") + @Schema(description = "게시글 고유 ID", example = "1", requiredMode = REQUIRED) Integer id, - @Schema(description = "게시판 고유 ID", example = "1") + @Schema(description = "게시판 고유 ID", example = "1", requiredMode = REQUIRED) Integer boardId, - @Schema(description = "제목", example = "제목") + @Schema(description = "제목", example = "제목", requiredMode = REQUIRED) String title, - @Schema(description = "내용", example = "내용") + @Schema(description = "내용", example = "내용", requiredMode = REQUIRED) String content, - @Schema(description = "작성자 고유 ID", example = "1") - Integer userId, + @Schema(description = "작성자 고유 ID", example = "1", requiredMode = REQUIRED) + int userId, - @Schema(description = "작성자 닉네임", example = "닉네임") + @Schema(description = "작성자 닉네임", example = "닉네임", requiredMode = REQUIRED) String nickname, - @Schema(description = "조회수", example = "1") - Integer hit, + @Schema(description = "조회수", example = "1", requiredMode = REQUIRED) + int hit, @Schema(description = "IP 주소", example = "123.12.1.3") String ip, @Schema(description = "해결 여부", example = "false") - Boolean isSolved, + boolean isSolved, @Schema(description = "삭제 여부", example = "false") - Boolean isDeleted, + boolean isDeleted, @Schema(description = "댓글 수", example = "1") - Byte commentCount, + int commentCount, - @Schema(description = "메타 정보", example = "메타 정보") + @Schema(description = "메타 정보", example = "메타 정보", requiredMode = NOT_REQUIRED) String meta, - @Schema(description = "공지 여부", example = "false") - Boolean isNotice, + @Schema(description = "공지 여부", example = "false", requiredMode = REQUIRED) + boolean isNotice, - @Schema(description = "공지 게시글 고유 ID", example = "1") + @Schema(description = "공지 게시글 고유 ID", example = "1", requiredMode = NOT_REQUIRED) Integer noticeArticleId, - @Schema(description = "요약", example = "요약") + @Schema(description = "요약", example = "요약", requiredMode = NOT_REQUIRED) String summary, - @Schema(description = "생성 일자", example = "2023-01-04 12:00:01") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime createdAt, + @Schema(description = "생성 일자", example = "2023-01-04 12:00:01", requiredMode = REQUIRED) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + LocalDateTime createdAt, - @Schema(description = "수정 일자", example = "2023-01-04 12:00:01") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime updatedAt, + @Schema(description = "수정 일자", example = "2023-01-04 12:00:01", requiredMode = REQUIRED) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + LocalDateTime updatedAt, - @Schema(description = "내용 요약", example = "내용 요약") - @JsonProperty("contentSummary") String contentSummary + @Schema(description = "내용 요약", example = "내용 요약", requiredMode = NOT_REQUIRED) + @JsonProperty("contentSummary") + String contentSummary ) { public static InnerArticleResponse from(Article article) { @@ -117,41 +123,43 @@ public static InnerArticleResponse from(Article article) { @JsonNaming(value = SnakeCaseStrategy.class) public record InnerBoardResponse( - @Schema(description = "게시판 고유 ID", example = "1") + @Schema(description = "게시판 고유 ID", example = "1", requiredMode = REQUIRED) Integer id, - @Schema(description = "게시판 태그", example = "notice") + @Schema(description = "게시판 태그", example = "notice", requiredMode = NOT_REQUIRED) String tag, - @Schema(description = "게시판 명", example = "공지사항") + @Schema(description = "게시판 명", example = "공지사항", requiredMode = REQUIRED) String name, - @Schema(description = "익명 여부", example = "false") + @Schema(description = "익명 여부", example = "false", requiredMode = REQUIRED) boolean isAnonymous, - @Schema(description = "게시글 수", example = "1") - Integer articleCount, + @Schema(description = "게시글 수", example = "1", requiredMode = REQUIRED) + int articleCount, - @Schema(description = "삭제 여부", example = "false") + @Schema(description = "삭제 여부", example = "false", requiredMode = REQUIRED) boolean isDeleted, - @Schema(description = "공지 여부", example = "false") + @Schema(description = "공지 여부", example = "false", requiredMode = REQUIRED) boolean isNotice, - @Schema(description = "부모 게시판 고유 ID", example = "1") + @Schema(description = "부모 게시판 고유 ID", example = "1", requiredMode = NOT_REQUIRED) Integer parentId, - @Schema(description = "순서", example = "1") - Integer seq, + @Schema(description = "순서", example = "1", requiredMode = REQUIRED) + int seq, - @Schema(description = "하위 게시판 목록") + @Schema(description = "하위 게시판 목록", requiredMode = NOT_REQUIRED) List children, - @Schema(description = "생성 일자", example = "2023-01-04 12:00:01") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime createdAt, + @Schema(description = "생성 일자", example = "2023-01-04 12:00:01", requiredMode = REQUIRED) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + LocalDateTime createdAt, - @Schema(description = "수정 일자", example = "2023-01-04 12:00:01") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime updatedAt + @Schema(description = "수정 일자", example = "2023-01-04 12:00:01", requiredMode = REQUIRED) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + LocalDateTime updatedAt ) { public static InnerBoardResponse from(Board board) { @@ -166,7 +174,9 @@ public static InnerBoardResponse from(Board board) { board.getParentId(), board.getSeq(), board.getChildren().isEmpty() - ? null : board.getChildren().stream().map(InnerBoardResponse::from).toList(), + ? null : board.getChildren().stream() + .map(InnerBoardResponse::from) + .toList(), board.getCreatedAt(), board.getUpdatedAt() ); diff --git a/src/main/java/in/koreatech/koin/domain/community/dto/HotArticleItemResponse.java b/src/main/java/in/koreatech/koin/domain/community/dto/HotArticleItemResponse.java index ec9ac9d025..2e370685ad 100644 --- a/src/main/java/in/koreatech/koin/domain/community/dto/HotArticleItemResponse.java +++ b/src/main/java/in/koreatech/koin/domain/community/dto/HotArticleItemResponse.java @@ -1,6 +1,8 @@ package in.koreatech.koin.domain.community.dto; import static com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import java.time.LocalDateTime; @@ -13,26 +15,26 @@ @JsonNaming(SnakeCaseStrategy.class) public record HotArticleItemResponse( - @Schema(description = "게시글 고유 ID", example = "1") + @Schema(description = "게시글 고유 ID", example = "1", requiredMode = REQUIRED) Integer id, - @Schema(description = "게시판 고유 ID", example = "1") + @Schema(description = "게시판 고유 ID", example = "1", requiredMode = REQUIRED) Integer boardId, - @Schema(description = "제목", example = "제목") + @Schema(description = "제목", example = "제목", requiredMode = REQUIRED) String title, - @Schema(description = "내용 요약", example = "내용 요약") + @Schema(description = "내용 요약", example = "내용 요약", requiredMode = NOT_REQUIRED) @JsonProperty("contentSummary") String contentSummary, - @Schema(description = "댓글 수", example = "1") + @Schema(description = "댓글 수", example = "1", requiredMode = REQUIRED) Byte commentCount, - @Schema(description = "조회수", example = "1") + @Schema(description = "조회수", example = "1", requiredMode = REQUIRED) Integer hit, - @Schema(description = "생성 일자", example = "2023-01-04 12:00:01") + @Schema(description = "생성 일자", example = "2023-01-04 12:00:01", requiredMode = REQUIRED) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime createdAt ) { diff --git a/src/main/java/in/koreatech/koin/domain/community/model/Article.java b/src/main/java/in/koreatech/koin/domain/community/model/Article.java index a285825f0a..75a5015bd3 100644 --- a/src/main/java/in/koreatech/koin/domain/community/model/Article.java +++ b/src/main/java/in/koreatech/koin/domain/community/model/Article.java @@ -67,7 +67,7 @@ public class Article extends BaseEntity { @NotNull @Column(name = "hit", nullable = false) - private Integer hit; + private int hit; @Size(max = 45) @NotNull diff --git a/src/main/java/in/koreatech/koin/domain/community/model/Comment.java b/src/main/java/in/koreatech/koin/domain/community/model/Comment.java index 77baca008d..1d6838ea02 100644 --- a/src/main/java/in/koreatech/koin/domain/community/model/Comment.java +++ b/src/main/java/in/koreatech/koin/domain/community/model/Comment.java @@ -54,10 +54,10 @@ public class Comment extends BaseEntity { private Boolean isDeleted = false; @Transient - private Boolean grantEdit = false; + private boolean grantEdit = false; @Transient - private Boolean grantDelete = false; + private boolean grantDelete = false; public void updateAuthority(Integer userId) { if (this.userId.equals(userId)) { diff --git a/src/main/java/in/koreatech/koin/domain/coop/controller/CoopApi.java b/src/main/java/in/koreatech/koin/domain/coop/controller/CoopApi.java index e9078b3ea6..d00eadf640 100644 --- a/src/main/java/in/koreatech/koin/domain/coop/controller/CoopApi.java +++ b/src/main/java/in/koreatech/koin/domain/coop/controller/CoopApi.java @@ -16,6 +16,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; @RequestMapping("/coop") @Tag(name = "(OWNER) Coop Dining : 영양사 식단", description = "영양사 식단 페이지") @@ -50,6 +51,6 @@ ResponseEntity changeSoldOut( @PatchMapping("/dining/image") ResponseEntity saveDiningImage( @Auth(permit = {COOP}) Integer userId, - @RequestBody DiningImageRequest imageRequest + @RequestBody @Valid DiningImageRequest imageRequest ); } diff --git a/src/main/java/in/koreatech/koin/domain/coop/controller/CoopController.java b/src/main/java/in/koreatech/koin/domain/coop/controller/CoopController.java index d47a06ca74..b673e06c00 100644 --- a/src/main/java/in/koreatech/koin/domain/coop/controller/CoopController.java +++ b/src/main/java/in/koreatech/koin/domain/coop/controller/CoopController.java @@ -34,7 +34,7 @@ public ResponseEntity changeSoldOut( @PatchMapping("/dining/image") public ResponseEntity saveDiningImage( @Auth(permit = {COOP}) Integer userId, - @RequestBody DiningImageRequest imageRequest + @RequestBody @Valid DiningImageRequest imageRequest ) { coopService.saveDiningImage(imageRequest); return ResponseEntity.ok().build(); diff --git a/src/main/java/in/koreatech/koin/domain/coop/dto/DiningImageRequest.java b/src/main/java/in/koreatech/koin/domain/coop/dto/DiningImageRequest.java index 5c3da20a80..14f80dc6a2 100644 --- a/src/main/java/in/koreatech/koin/domain/coop/dto/DiningImageRequest.java +++ b/src/main/java/in/koreatech/koin/domain/coop/dto/DiningImageRequest.java @@ -1,17 +1,22 @@ package in.koreatech.koin.domain.coop.dto; import static com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import com.fasterxml.jackson.databind.annotation.JsonNaming; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; @JsonNaming(SnakeCaseStrategy.class) public record DiningImageRequest( - @Schema(description = "메뉴 고유 ID", example = "1") + @Schema(description = "메뉴 고유 ID", example = "1", requiredMode = REQUIRED) + @NotNull(message = "메뉴 ID는 필수입니다.") Integer menuId, - @Schema(description = "이미지 url", example = "https://api.koreatech.in/image.jpg") + @Schema(description = "이미지 url", example = "https://api.koreatech.in/image.jpg", requiredMode = REQUIRED) + @NotEmpty(message = "메뉴 이미지는 필수입니다.") String imageUrl ) { diff --git a/src/main/java/in/koreatech/koin/domain/coop/dto/SoldOutRequest.java b/src/main/java/in/koreatech/koin/domain/coop/dto/SoldOutRequest.java index b2266d482f..f4b645b82c 100644 --- a/src/main/java/in/koreatech/koin/domain/coop/dto/SoldOutRequest.java +++ b/src/main/java/in/koreatech/koin/domain/coop/dto/SoldOutRequest.java @@ -1,5 +1,7 @@ package in.koreatech.koin.domain.coop.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import com.fasterxml.jackson.databind.PropertyNamingStrategies; import com.fasterxml.jackson.databind.annotation.JsonNaming; @@ -8,11 +10,12 @@ @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) public record SoldOutRequest( - @Schema(description = "메뉴 고유 ID", example = "1") + @Schema(description = "메뉴 고유 ID", example = "1", requiredMode = REQUIRED) + @NotNull(message = "메뉴 ID는 필수입니다.") Integer menuId, - @NotNull - @Schema(description = "품절 여부", example = "true") + @Schema(description = "품절 여부", example = "true", requiredMode = REQUIRED) + @NotNull(message = "품절 여부는 필수입니다.") Boolean soldOut ) { diff --git a/src/main/java/in/koreatech/koin/domain/dept/dto/DeptResponse.java b/src/main/java/in/koreatech/koin/domain/dept/dto/DeptResponse.java index c400889651..aad97502dc 100644 --- a/src/main/java/in/koreatech/koin/domain/dept/dto/DeptResponse.java +++ b/src/main/java/in/koreatech/koin/domain/dept/dto/DeptResponse.java @@ -1,13 +1,21 @@ package in.koreatech.koin.domain.dept.dto; import static com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import com.fasterxml.jackson.databind.annotation.JsonNaming; import in.koreatech.koin.domain.dept.model.Dept; +import io.swagger.v3.oas.annotations.media.Schema; @JsonNaming(value = SnakeCaseStrategy.class) -public record DeptResponse(String deptNum, String name) { +public record DeptResponse( + @Schema(description = "학과 번호", example = "36", requiredMode = REQUIRED) + String deptNum, + + @Schema(description = "이름", example = "컴퓨터공학부", requiredMode = REQUIRED) + String name +) { public static DeptResponse from(String findNumber, Dept dept) { return new DeptResponse(findNumber, dept.getName()); diff --git a/src/main/java/in/koreatech/koin/domain/dept/dto/DeptsResponse.java b/src/main/java/in/koreatech/koin/domain/dept/dto/DeptsResponse.java index bf00ae6886..ba5172106c 100644 --- a/src/main/java/in/koreatech/koin/domain/dept/dto/DeptsResponse.java +++ b/src/main/java/in/koreatech/koin/domain/dept/dto/DeptsResponse.java @@ -1,14 +1,27 @@ package in.koreatech.koin.domain.dept.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import java.util.List; import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; import in.koreatech.koin.domain.dept.model.Dept; +import io.swagger.v3.oas.annotations.media.Schema; @JsonNaming(value = SnakeCaseStrategy.class) -public record DeptsResponse(String name, String curriculumLink, List deptNums) { +public record DeptsResponse( + @Schema(description = "학과 명", example = "컴퓨터공학부", requiredMode = REQUIRED) + String name, + @Schema(description = "커리큘럼 바로가기 링크", example = "https://www.koreatech.ac.kr/menu.es?mid=b10402000000", requiredMode = REQUIRED) + String curriculumLink, + + @Schema(description = "학과 번호들", example = """ + [ "35", "36" ] + """, requiredMode = REQUIRED) + List deptNums +) { public static DeptsResponse from(Dept dept) { return new DeptsResponse( diff --git a/src/main/java/in/koreatech/koin/domain/dept/service/DeptService.java b/src/main/java/in/koreatech/koin/domain/dept/service/DeptService.java index 7261df3b0d..e8572b35b3 100644 --- a/src/main/java/in/koreatech/koin/domain/dept/service/DeptService.java +++ b/src/main/java/in/koreatech/koin/domain/dept/service/DeptService.java @@ -16,7 +16,6 @@ public class DeptService { public DeptResponse getById(String id) { Optional dept = Dept.findByNumber(id); - return dept.map(value -> DeptResponse.from(id, value)).orElse(null); } diff --git a/src/main/java/in/koreatech/koin/domain/dining/dto/DiningResponse.java b/src/main/java/in/koreatech/koin/domain/dining/dto/DiningResponse.java index 41a1df125a..a50c98c2ca 100644 --- a/src/main/java/in/koreatech/koin/domain/dining/dto/DiningResponse.java +++ b/src/main/java/in/koreatech/koin/domain/dining/dto/DiningResponse.java @@ -1,6 +1,8 @@ package in.koreatech.koin.domain.dining.dto; import static com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import java.time.LocalDate; import java.time.LocalDateTime; @@ -16,50 +18,50 @@ @JsonNaming(SnakeCaseStrategy.class) public record DiningResponse( - @Schema(description = "메뉴 고유 ID", example = "1") + @Schema(description = "메뉴 고유 ID", example = "1", requiredMode = REQUIRED) Integer id, - @Schema(description = "식단 제공 날짜", example = "2024-03-11") + @Schema(description = "식단 제공 날짜", example = "2024-03-11", requiredMode = REQUIRED) @JsonFormat(pattern = "yyyy-MM-dd") LocalDate date, - @Schema(description = "식사 시간", example = "LUNCH") + @Schema(description = "식사 시간", example = "LUNCH", requiredMode = REQUIRED) String type, - @Schema(description = "식단 제공 장소", example = "A코스") + @Schema(description = "식단 제공 장소", example = "A코스", requiredMode = REQUIRED) String place, - @Schema(description = "카드 가격", example = "5000") + @Schema(description = "카드 가격", example = "5000", requiredMode = NOT_REQUIRED) Integer priceCard, - @Schema(description = "현금 가격", example = "5000") + @Schema(description = "현금 가격", example = "5000", requiredMode = NOT_REQUIRED) Integer priceCash, - @Schema(description = "칼로리", example = "790") + @Schema(description = "칼로리", example = "790", requiredMode = REQUIRED) Integer kcal, @Schema(description = "식단", example = """ ["병아리콩밥", "(탕)소고기육개장", "땡초부추전", "고구마순들깨볶음", "총각김치", "생야채샐러드&D", "누룽지탕"] - """) + """, requiredMode = NOT_REQUIRED) List menu, - @Schema(description = "이미지 URL", example = "https://stage.koreatech.in/image.jpg") + @Schema(description = "이미지 URL", example = "https://stage.koreatech.in/image.jpg", requiredMode = NOT_REQUIRED) String imageUrl, + @Schema(description = "생성 일자", example = "2024-03-15 14:02:48", requiredMode = REQUIRED) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @Schema(description = "생성 일자", example = "2024-03-15 14:02:48") LocalDateTime createdAt, + @Schema(description = "최신화 일자", example = "2024-03-15 14:02:48", requiredMode = REQUIRED) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @Schema(description = "최신화 일자", example = "2024-03-15 14:02:48") LocalDateTime updatedAt, @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @Schema(description = "품절 시각", example = "2024-04-04 23:01:52") + @Schema(description = "품절 시각", example = "2024-04-04 23:01:52", requiredMode = NOT_REQUIRED) LocalDateTime soldoutAt, @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @Schema(description = "메뉴 변경 시각", example = "2024-04-04 23:01:52") + @Schema(description = "메뉴 변경 시각", example = "2024-04-04 23:01:52", requiredMode = NOT_REQUIRED) LocalDateTime changedAt ) { diff --git a/src/main/java/in/koreatech/koin/domain/land/dto/LandResponse.java b/src/main/java/in/koreatech/koin/domain/land/dto/LandResponse.java index ed6347fac5..06483c81bb 100644 --- a/src/main/java/in/koreatech/koin/domain/land/dto/LandResponse.java +++ b/src/main/java/in/koreatech/koin/domain/land/dto/LandResponse.java @@ -1,6 +1,8 @@ package in.koreatech.koin.domain.land.dto; import static com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import java.time.LocalDateTime; import java.util.List; @@ -13,114 +15,116 @@ @JsonNaming(value = SnakeCaseStrategy.class) public record LandResponse( - @Schema(description = "전자 도어 락 옵션", example = "true") + @Schema(description = "전자 도어 락 옵션", example = "true", requiredMode = REQUIRED) boolean optElectronicDoorLocks, - @Schema(description = "TV 옵션", example = "true") + @Schema(description = "TV 옵션", example = "true", requiredMode = REQUIRED) boolean optTv, - @Schema(description = "월세 범위", example = "220~250만원(6개월)") + @Schema(description = "월세 범위", example = "220~250만원(6개월)", requiredMode = NOT_REQUIRED) String monthlyFee, - @Schema(description = "엘리베이터 옵션", example = "true") + @Schema(description = "엘리베이터 옵션", example = "true", requiredMode = REQUIRED) boolean optElevator, - @Schema(description = "정수기 옵션", example = "true") + @Schema(description = "정수기 옵션", example = "true", requiredMode = REQUIRED) boolean optWaterPurifier, - @Schema(description = "세탁기 옵션", example = "true") + @Schema(description = "세탁기 옵션", example = "true", requiredMode = REQUIRED) boolean optWasher, - @Schema(description = "위도 좌표", example = "36.769062") + @Schema(description = "위도 좌표", example = "36.769062", requiredMode = NOT_REQUIRED) String latitude, - @Schema(description = "전세 가격", example = "4500") + @Schema(description = "전세 가격", example = "4500", requiredMode = NOT_REQUIRED) String charterFee, - @Schema(description = "베란다 옵션", example = "true") + @Schema(description = "베란다 옵션", example = "true", requiredMode = REQUIRED) boolean optVeranda, - @Schema(description = "생성 일시", example = "2020-08-19 13:44:11") + @Schema(description = "생성 일시", example = "2020-08-19 13:44:11", requiredMode = REQUIRED) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime createdAt, - @Schema(description = "설명", example = "null") + @Schema(description = "설명", example = "한기대 정문 근처 원룸", requiredMode = NOT_REQUIRED) String description, - @Schema(description = "이미지 URL 목록", example = "null") + @Schema(description = "이미지 URL 목록", example = """ + ["https://image.com", "https://image2.com"] + """, requiredMode = REQUIRED) List imageUrls, - @Schema(description = "가스 레인지 옵션", example = "false") + @Schema(description = "가스 레인지 옵션", example = "false", requiredMode = REQUIRED) boolean optGasRange, - @Schema(description = "인덕션 옵션", example = "true") + @Schema(description = "인덕션 옵션", example = "true", requiredMode = REQUIRED) boolean optInduction, - @Schema(description = "내부 이름", example = "행운빌(투베이)") + @Schema(description = "내부 이름", example = "행운빌(투베이)", requiredMode = NOT_REQUIRED) String internalName, - @Schema(description = "삭제 여부", example = "false") + @Schema(description = "삭제 여부", example = "false", requiredMode = REQUIRED) boolean isDeleted, - @Schema(description = "최근 업데이트 일시", example = "2021-05-19 23:07:13") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Schema(description = "최근 업데이트 일시", example = "2021-05-19 23:07:13", requiredMode = REQUIRED) LocalDateTime updatedAt, - @Schema(description = "비데 옵션", example = "false") + @Schema(description = "비데 옵션", example = "false", requiredMode = REQUIRED) boolean optBidet, - @Schema(description = "신발장 옵션", example = "true") + @Schema(description = "신발장 옵션", example = "true", requiredMode = REQUIRED) boolean optShoeCloset, - @Schema(description = "냉장고 옵션", example = "true") + @Schema(description = "냉장고 옵션", example = "true", requiredMode = REQUIRED) boolean optRefrigerator, - @Schema(description = "고유 식별자", example = "68") + @Schema(description = "고유 식별자", example = "68", requiredMode = REQUIRED) Integer id, - @Schema(description = "층 수", example = "null") + @Schema(description = "층 수", example = "null", requiredMode = NOT_REQUIRED) Integer floor, - @Schema(description = "인당 관리비", example = "21(1인 기준)") + @Schema(description = "인당 관리비", example = "21(1인 기준)", requiredMode = NOT_REQUIRED) String managementFee, - @Schema(description = "책상 옵션", example = "true") + @Schema(description = "책상 옵션", example = "true", requiredMode = REQUIRED) boolean optDesk, - @Schema(description = "옷장 옵션", example = "true") + @Schema(description = "옷장 옵션", example = "true", requiredMode = REQUIRED) boolean optCloset, - @Schema(description = "경도 좌표", example = "127.28265") + @Schema(description = "경도 좌표", example = "127.28265", requiredMode = NOT_REQUIRED) String longitude, - @Schema(description = "주소", example = "충남 천안시 동남구 병천면 가전6길 17-1") + @Schema(description = "주소", example = "충남 천안시 동남구 병천면 가전6길 17-1", requiredMode = NOT_REQUIRED) String address, - @Schema(description = "침대 옵션", example = "true") + @Schema(description = "침대 옵션", example = "true", requiredMode = REQUIRED) boolean optBed, - @Schema(description = "크기(제곱 미터)", example = "9") + @Schema(description = "크기(제곱 미터)", example = "9", requiredMode = NOT_REQUIRED) String size, - @Schema(description = "전화번호", example = "010-3257-5598") + @Schema(description = "전화번호", example = "010-3257-5598", requiredMode = NOT_REQUIRED) String phone, - @Schema(description = "에어컨 옵션", example = "true") + @Schema(description = "에어컨 옵션", example = "true", requiredMode = REQUIRED) boolean optAirConditioner, - @Schema(description = "부동산 이름", example = "행운빌 (투베이)") + @Schema(description = "부동산 이름", example = "행운빌 (투베이)", requiredMode = NOT_REQUIRED) String name, - @Schema(description = "보증금 금액", example = "50") + @Schema(description = "보증금 금액", example = "50", requiredMode = NOT_REQUIRED) String deposit, - @Schema(description = "전자레인지 옵션", example = "true") + @Schema(description = "전자레인지 옵션", example = "true", requiredMode = REQUIRED) boolean optMicrowave, - @Schema(description = "부동산 링크", example = "%ED%96%89%EC%9A%B4%EB%B9%8C%28%ED%88%AC%EB%B2%A0%EC%9D%B4%29") + @Schema(description = "부동산 링크", example = "%ED%96%89%EC%9A%B4%EB%B9%8C%28%ED%88%AC%EB%B2%A0%EC%9D%B4%29", requiredMode = NOT_REQUIRED) String permalink, - @Schema(description = "방 유형", example = "투베이") + @Schema(description = "방 유형", example = "투베이", requiredMode = NOT_REQUIRED) String roomType ) { diff --git a/src/main/java/in/koreatech/koin/domain/land/dto/LandsResponse.java b/src/main/java/in/koreatech/koin/domain/land/dto/LandsResponse.java index 08d6239441..31055de5a9 100644 --- a/src/main/java/in/koreatech/koin/domain/land/dto/LandsResponse.java +++ b/src/main/java/in/koreatech/koin/domain/land/dto/LandsResponse.java @@ -1,6 +1,8 @@ package in.koreatech.koin.domain.land.dto; import static com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import com.fasterxml.jackson.databind.annotation.JsonNaming; @@ -9,28 +11,28 @@ @JsonNaming(value = SnakeCaseStrategy.class) public record LandsResponse( - @Schema(description = "상세 이름", example = "럭키빌(투베이)") + @Schema(description = "상세 이름", example = "럭키빌(투베이)", requiredMode = NOT_REQUIRED) String internalName, - @Schema(description = "월세", example = "220~250만원(6개월)") + @Schema(description = "월세", example = "220~250만원(6개월)", requiredMode = NOT_REQUIRED) String monthlyFee, - @Schema(description = "위도", example = "36.769204") + @Schema(description = "위도", example = "36.769204", requiredMode = NOT_REQUIRED) String latitude, - @Schema(description = "보증금", example = "4500") + @Schema(description = "보증금", example = "4500", requiredMode = NOT_REQUIRED) String charterFee, - @Schema(description = "이름", example = "럭키빌(투베이)") + @Schema(description = "이름", example = "럭키빌(투베이)", requiredMode = NOT_REQUIRED) String name, - @Schema(description = "복덕방 고유 ID", example = "1") + @Schema(description = "복덕방 고유 ID", example = "1", requiredMode = REQUIRED) Integer id, - @Schema(description = "경도", example = "127.282554") + @Schema(description = "경도", example = "127.282554", requiredMode = NOT_REQUIRED) String longitude, - @Schema(description = "방 종류", example = "투베이") + @Schema(description = "방 종류", example = "투베이", requiredMode = NOT_REQUIRED) String roomType ) { diff --git a/src/main/java/in/koreatech/koin/domain/member/dto/MemberResponse.java b/src/main/java/in/koreatech/koin/domain/member/dto/MemberResponse.java index 6bf1364e77..d1082ce869 100644 --- a/src/main/java/in/koreatech/koin/domain/member/dto/MemberResponse.java +++ b/src/main/java/in/koreatech/koin/domain/member/dto/MemberResponse.java @@ -1,5 +1,8 @@ package in.koreatech.koin.domain.member.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import java.time.LocalDateTime; import com.fasterxml.jackson.annotation.JsonFormat; @@ -11,36 +14,36 @@ @JsonNaming(SnakeCaseStrategy.class) public record MemberResponse( - @Schema(example = "1") + @Schema(example = "1", requiredMode = REQUIRED) Integer id, - @Schema(example = "최준호") + @Schema(example = "최준호", requiredMode = REQUIRED) String name, - @Schema(example = "2019136135") + @Schema(example = "2019136135", requiredMode = NOT_REQUIRED) String studentNumber, - @Schema(example = "Backend") + @Schema(example = "Backend", requiredMode = NOT_REQUIRED) String track, - @Schema(example = "Regular") + @Schema(example = "Regular", requiredMode = REQUIRED) String position, - @Schema(example = "juno@gmail.com") + @Schema(example = "juno@gmail.com", requiredMode = NOT_REQUIRED) String email, - @Schema(example = "https://static.koreatech.in/bcsdlab_page_assets/img/people/juno.jpg") + @Schema(example = "https://static.koreatech.in/bcsdlab_page_assets/img/people/juno.jpg", requiredMode = NOT_REQUIRED) String imageUrl, - @Schema(example = "false") + @Schema(example = "false", requiredMode = REQUIRED) boolean isDeleted, - @Schema(example = "2020-08-14 16:26:35") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Schema(description = "생성 일자", example = "2020-08-14 16:26:35", requiredMode = REQUIRED) LocalDateTime createdAt, - @Schema(example = "2021-08-16 06:42:44") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Schema(description = "수정 일자", example = "2021-08-16 06:42:44", requiredMode = REQUIRED) LocalDateTime updatedAt ) { diff --git a/src/main/java/in/koreatech/koin/domain/member/dto/TrackResponse.java b/src/main/java/in/koreatech/koin/domain/member/dto/TrackResponse.java index c2cca7165f..7cf6265203 100644 --- a/src/main/java/in/koreatech/koin/domain/member/dto/TrackResponse.java +++ b/src/main/java/in/koreatech/koin/domain/member/dto/TrackResponse.java @@ -1,5 +1,7 @@ package in.koreatech.koin.domain.member.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import java.time.LocalDateTime; import com.fasterxml.jackson.annotation.JsonFormat; @@ -11,23 +13,25 @@ @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) public record TrackResponse( - @Schema(description = "트랙 고유 ID", example = "1") + @Schema(description = "트랙 고유 ID", example = "1", requiredMode = REQUIRED) Integer id, - @Schema(description = "트랙 명", example = "Backend") + @Schema(description = "트랙 명", example = "Backend", requiredMode = REQUIRED) String name, - @Schema(description = "인원 수", example = "15") + @Schema(description = "인원 수", example = "15", requiredMode = REQUIRED) Integer headcount, - @Schema(description = "삭제 여부", example = "false") + @Schema(description = "삭제 여부", example = "false", requiredMode = REQUIRED) Boolean isDeleted, - @Schema(description = "생성 일자", example = "2023-01-04 12:00:01") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime createdAt, + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Schema(description = "생성 일자", example = "2023-01-04 12:00:01", requiredMode = REQUIRED) + LocalDateTime createdAt, - @Schema(description = "수정 일자", example = "2023-01-04 12:00:01") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime updatedAt + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Schema(description = "수정 일자", example = "2023-01-04 12:00:01", requiredMode = REQUIRED) + LocalDateTime updatedAt ) { public static TrackResponse from(Track track) { diff --git a/src/main/java/in/koreatech/koin/domain/member/dto/TrackSingleResponse.java b/src/main/java/in/koreatech/koin/domain/member/dto/TrackSingleResponse.java index 5764f24c6f..31286f1f76 100644 --- a/src/main/java/in/koreatech/koin/domain/member/dto/TrackSingleResponse.java +++ b/src/main/java/in/koreatech/koin/domain/member/dto/TrackSingleResponse.java @@ -1,5 +1,8 @@ package in.koreatech.koin.domain.member.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import java.time.LocalDateTime; import java.util.List; @@ -14,9 +17,15 @@ import io.swagger.v3.oas.annotations.media.Schema; public record TrackSingleResponse( - @Schema(description = "트랙 명", example = "Backend") @JsonProperty("TrackName") String trackName, - @JsonProperty("TechStacks") List innerTechStackResponses, - @JsonProperty("Members") List innerMemberResponses + @JsonProperty("TrackName") + @Schema(description = "트랙 명", example = "Backend", requiredMode = REQUIRED) + String trackName, + + @JsonProperty("TechStacks") + List innerTechStackResponses, + + @JsonProperty("Members") + List innerMemberResponses ) { public static TrackSingleResponse of(Track track, List members, List techStacks) { @@ -33,7 +42,7 @@ public static TrackSingleResponse of(Track track, List members, List attachments, - @Schema(description = "가게 목록") + @Schema(description = "가게 목록", requiredMode = NOT_REQUIRED) List shops ) { @@ -43,13 +46,13 @@ public static OwnerResponse of(Owner owner, List attachments, L @JsonNaming(SnakeCaseStrategy.class) private record InnerAttachmentResponse( - @Schema(description = "첨부 파일 ID", example = "1") + @Schema(description = "첨부 파일 ID", example = "1", requiredMode = REQUIRED) Integer id, - @Schema(description = "첨부 파일 URL", example = "https://static.koreatech.in/1.png") + @Schema(description = "첨부 파일 URL", example = "https://static.koreatech.in/1.png", requiredMode = REQUIRED) String fileUrl, - @Schema(description = "첨부 파일 이름", example = "1.jpg") + @Schema(description = "첨부 파일 이름", example = "1.jpg", requiredMode = REQUIRED) String fileName ) { @@ -64,10 +67,10 @@ public static InnerAttachmentResponse from(OwnerAttachment ownerAttachment) { @JsonNaming(SnakeCaseStrategy.class) private record InnerShopResponse( - @Schema(description = "가게 ID", example = "1") + @Schema(description = "가게 ID", example = "1", requiredMode = REQUIRED) Integer id, - @Schema(description = "가게 이름", example = "가게1") + @Schema(description = "가게 이름", example = "가게1", requiredMode = REQUIRED) String name ) { diff --git a/src/main/java/in/koreatech/koin/domain/owner/dto/OwnerSendEmailRequest.java b/src/main/java/in/koreatech/koin/domain/owner/dto/OwnerSendEmailRequest.java index 8eabe5db5b..241f09eb2e 100644 --- a/src/main/java/in/koreatech/koin/domain/owner/dto/OwnerSendEmailRequest.java +++ b/src/main/java/in/koreatech/koin/domain/owner/dto/OwnerSendEmailRequest.java @@ -1,7 +1,10 @@ package in.koreatech.koin.domain.owner.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Email; import jakarta.validation.constraints.NotBlank; @@ -9,6 +12,7 @@ public record OwnerSendEmailRequest( @Email(message = "이메일 형식이 올바르지 않습니다. ${validatedValue}") @NotBlank(message = "이메일은 필수입니다.") @JsonProperty(value = "address") + @Schema(description = "이메일", example = "temp@gmail.com", requiredMode = REQUIRED) String email ) { diff --git a/src/main/java/in/koreatech/koin/domain/owner/dto/OwnerVerificationRequest.java b/src/main/java/in/koreatech/koin/domain/owner/dto/OwnerVerificationRequest.java deleted file mode 100644 index 58c90c7d12..0000000000 --- a/src/main/java/in/koreatech/koin/domain/owner/dto/OwnerVerificationRequest.java +++ /dev/null @@ -1,19 +0,0 @@ -package in.koreatech.koin.domain.owner.dto; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; -import com.fasterxml.jackson.databind.annotation.JsonNaming; - -import io.swagger.v3.oas.annotations.media.Schema; - -@JsonNaming(SnakeCaseStrategy.class) -public record OwnerVerificationRequest( - @JsonProperty(value = "address") - @Schema(description = "사장님 이메일", example = "junho5336@gmail.com") - String email, - - @Schema(description = "인증 코드", example = "123456") - String certificationCode -) { - -} diff --git a/src/main/java/in/koreatech/koin/domain/owner/dto/OwnerVerifyRequest.java b/src/main/java/in/koreatech/koin/domain/owner/dto/OwnerVerifyRequest.java index ab22595cd5..37bfb938c5 100644 --- a/src/main/java/in/koreatech/koin/domain/owner/dto/OwnerVerifyRequest.java +++ b/src/main/java/in/koreatech/koin/domain/owner/dto/OwnerVerifyRequest.java @@ -1,22 +1,27 @@ package in.koreatech.koin.domain.owner.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Digits; +import jakarta.validation.constraints.Email; import jakarta.validation.constraints.NotBlank; @JsonNaming(SnakeCaseStrategy.class) public record OwnerVerifyRequest( @JsonProperty(value = "address") - @Schema(description = "사장님 이메일", example = "junho5336@gmail.com") + @Email(message = "이메일 형식이 올바르지 않습니다. ${validatedValue}") + @NotBlank(message = "이메일은 필수입니다.") + @Schema(description = "사장님 이메일", example = "junho5336@gmail.com", requiredMode = REQUIRED) String email, @NotBlank(message = "인증 코드는 필수입니다.") - @Digits(integer = 6, fraction = 0, message = "인증 코드는 6자리 정수여야 합니다.") - @Schema(description = "인증 코드", example = "123456") + @Digits(integer = 6, fraction = 0, message = "인증 코드는 6자리 정수여야 합니다. ${validatedValue}") + @Schema(description = "인증 코드", example = "123456", requiredMode = REQUIRED) String certificationCode ) { diff --git a/src/main/java/in/koreatech/koin/domain/owner/dto/OwnerVerifyResponse.java b/src/main/java/in/koreatech/koin/domain/owner/dto/OwnerVerifyResponse.java index 6400e52b2e..ccf028c8c5 100644 --- a/src/main/java/in/koreatech/koin/domain/owner/dto/OwnerVerifyResponse.java +++ b/src/main/java/in/koreatech/koin/domain/owner/dto/OwnerVerifyResponse.java @@ -1,9 +1,15 @@ package in.koreatech.koin.domain.owner.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import io.swagger.v3.oas.annotations.media.Schema; public record OwnerVerifyResponse( - @Schema(description = "임시 액세스 토큰", example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c") + @Schema( + description = "임시 액세스 토큰", + example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", + requiredMode = REQUIRED + ) String token ) { diff --git a/src/main/java/in/koreatech/koin/domain/owner/dto/VerifyEmailRequest.java b/src/main/java/in/koreatech/koin/domain/owner/dto/VerifyEmailRequest.java index 313e6648e5..c4f71c7daa 100644 --- a/src/main/java/in/koreatech/koin/domain/owner/dto/VerifyEmailRequest.java +++ b/src/main/java/in/koreatech/koin/domain/owner/dto/VerifyEmailRequest.java @@ -1,14 +1,18 @@ package in.koreatech.koin.domain.owner.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Email; import jakarta.validation.constraints.NotBlank; public record VerifyEmailRequest( - @Email(message = "이메일 형식을 지켜주세요.") - @NotBlank(message = "이메일을 입력해주세요.") @JsonProperty("address") + @Email(message = "이메일 형식이 올바르지 않습니다. ${validatedValue}") + @NotBlank(message = "이메일은 필수입니다.") + @Schema(description = "이메일", example = "temp@gmail.com", requiredMode = REQUIRED) String email ) { diff --git a/src/main/java/in/koreatech/koin/domain/ownershop/ShopEventCreateEvent.java b/src/main/java/in/koreatech/koin/domain/ownershop/EventArticleCreateEvent.java similarity index 73% rename from src/main/java/in/koreatech/koin/domain/ownershop/ShopEventCreateEvent.java rename to src/main/java/in/koreatech/koin/domain/ownershop/EventArticleCreateEvent.java index a52d85d118..fe95122359 100644 --- a/src/main/java/in/koreatech/koin/domain/ownershop/ShopEventCreateEvent.java +++ b/src/main/java/in/koreatech/koin/domain/ownershop/EventArticleCreateEvent.java @@ -1,6 +1,6 @@ package in.koreatech.koin.domain.ownershop; -public record ShopEventCreateEvent( +public record EventArticleCreateEvent( Integer shopId, String shopName, String title diff --git a/src/main/java/in/koreatech/koin/domain/ownershop/dto/CreateEventRequest.java b/src/main/java/in/koreatech/koin/domain/ownershop/dto/CreateEventRequest.java index 535bafef7b..be5fb62ee0 100644 --- a/src/main/java/in/koreatech/koin/domain/ownershop/dto/CreateEventRequest.java +++ b/src/main/java/in/koreatech/koin/domain/ownershop/dto/CreateEventRequest.java @@ -1,5 +1,7 @@ package in.koreatech.koin.domain.ownershop.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import java.time.LocalDate; import java.util.List; @@ -15,24 +17,30 @@ @JsonNaming(value = SnakeCaseStrategy.class) public record CreateEventRequest( - @Schema(example = "감성떡볶이 이벤트합니다!!!", description = "제목") - @NotBlank String title, - - @Schema(example = "감성떡볶이 이벤트합니다!!! 많은관심 부탁드려요! 감성을 한스푼 더 얹어드립니다", description = "이벤트 내용") - @NotBlank String content, - - @Schema(description = "이벤트 이미지") - @NotNull + @Schema(example = "감성떡볶이 이벤트합니다!!!", description = "제목", requiredMode = REQUIRED) + @NotBlank(message = "제목은 필수입니다.") + String title, + + @Schema(example = "감성떡볶이 이벤트합니다!!! 많은관심 부탁드려요! 감성을 한스푼 더 얹어드립니다", description = "이벤트 내용", requiredMode = REQUIRED) + @NotBlank(message = "내용은 필수입니다.") + String content, + + @Schema(description = "이벤트 이미지", example = """ + [ "https://testimage.com", "https://testimage2.com" ] + """, requiredMode = REQUIRED) + @NotNull(message = "이벤트 이미지는 필수입니다.") @Size(min = 0, max = 3, message = "사진은 최대 3개까지 입력 가능합니다.") List thumbnailImages, - @Schema(example = "2024-10-24", description = "시작일") @DateTimeFormat(pattern = "yyyy-MM-dd") - @NotNull LocalDate startDate, + @Schema(example = "2024-10-24", description = "시작일", requiredMode = REQUIRED) + @NotNull(message = "시작일은 필수입니다.") + LocalDate startDate, - @Schema(example = "2024-11-24", description = "시작일") @DateTimeFormat(pattern = "yyyy-MM-dd") - @NotNull LocalDate endDate + @Schema(example = "2024-11-24", description = "종료일", requiredMode = REQUIRED) + @NotNull(message = "종료일은 필수입니다.") + LocalDate endDate ) { } diff --git a/src/main/java/in/koreatech/koin/domain/ownershop/dto/ModifyEventRequest.java b/src/main/java/in/koreatech/koin/domain/ownershop/dto/ModifyEventRequest.java index 002f8383e3..025fef34fb 100644 --- a/src/main/java/in/koreatech/koin/domain/ownershop/dto/ModifyEventRequest.java +++ b/src/main/java/in/koreatech/koin/domain/ownershop/dto/ModifyEventRequest.java @@ -1,5 +1,7 @@ package in.koreatech.koin.domain.ownershop.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import java.time.LocalDate; import java.util.List; @@ -13,22 +15,26 @@ @JsonNaming(value = SnakeCaseStrategy.class) public record ModifyEventRequest( - @Schema(example = "감성떡볶이 이벤트합니다!!!", description = "제목") - @NotBlank String title, + @Schema(example = "감성떡볶이 이벤트합니다!!!", description = "제목", requiredMode = REQUIRED) + @NotBlank(message = "제목은 필수입니다.") + String title, - @Schema(example = "감성떡볶이 이벤트합니다!!! 많은관심 부탁드려요! 감성을 한스푼 더 얹어드립니다", description = "이벤트 내용") - @NotBlank String content, + @Schema(example = "감성떡볶이 이벤트합니다!!! 많은관심 부탁드려요! 감성을 한스푼 더 얹어드립니다", description = "이벤트 내용", requiredMode = REQUIRED) + @NotBlank(message = "내용은 필수입니다.") + String content, - @Schema(description = "이벤트 이미지") - @NotNull + @Schema(description = "이벤트 이미지", requiredMode = REQUIRED) + @NotNull(message = "이벤트 이미지는 필수입니다.") @Size(min = 0, max = 3, message = "사진은 최대 3개까지 입력 가능합니다.") List thumbnailImages, - @Schema(example = "2024-10-24", description = "시작일") - @NotNull LocalDate startDate, + @Schema(example = "2024-10-24", description = "시작일", requiredMode = REQUIRED) + @NotNull(message = "시작일은 필수입니다.") + LocalDate startDate, - @Schema(example = "2024-11-24", description = "시작일") - @NotNull LocalDate endDate + @Schema(example = "2024-11-24", description = "종료일", requiredMode = REQUIRED) + @NotNull(message = "종료일은 필수입니다.") + LocalDate endDate ) { } diff --git a/src/main/java/in/koreatech/koin/domain/ownershop/dto/OwnerShopEventsResponse.java b/src/main/java/in/koreatech/koin/domain/ownershop/dto/OwnerShopEventsResponse.java index 6402c6cb07..3f89525488 100644 --- a/src/main/java/in/koreatech/koin/domain/ownershop/dto/OwnerShopEventsResponse.java +++ b/src/main/java/in/koreatech/koin/domain/ownershop/dto/OwnerShopEventsResponse.java @@ -1,5 +1,8 @@ package in.koreatech.koin.domain.ownershop.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import java.time.LocalDate; import java.util.ArrayList; import java.util.List; @@ -16,35 +19,35 @@ @JsonNaming(SnakeCaseStrategy.class) public record OwnerShopEventsResponse( - @Schema(description = "이벤트 목록") + @Schema(description = "이벤트 목록", requiredMode = NOT_REQUIRED) List events ) { @JsonNaming(value = SnakeCaseStrategy.class) public record InnerOwnerShopEventResponse( - @Schema(description = "상점 ID", example = "1") + @Schema(description = "상점 ID", example = "1", requiredMode = REQUIRED) Integer shopId, - @Schema(description = "상점 이름", example = "술꾼") + @Schema(description = "상점 이름", example = "술꾼", requiredMode = REQUIRED) String shopName, - @Schema(description = "이벤트 ID", example = "1") + @Schema(description = "이벤트 ID", example = "1", requiredMode = REQUIRED) Integer eventId, - @Schema(description = "이벤트 제목", example = "콩순이 사장님이 미쳤어요!!") + @Schema(description = "이벤트 제목", example = "콩순이 사장님이 미쳤어요!!", requiredMode = REQUIRED) String title, - @Schema(description = "이벤트 내용", example = "콩순이 가게 전메뉴 90% 할인! 가게 폐업 임박...") + @Schema(description = "이벤트 내용", example = "콩순이 가게 전메뉴 90% 할인! 가게 폐업 임박...", requiredMode = REQUIRED) String content, @Schema(description = "이벤트 이미지") List thumbnailImages, - @Schema(description = "시작일", example = "2024-10-22") @JsonFormat(pattern = "yyyy-MM-dd") + @Schema(description = "시작일", example = "2024-10-22", requiredMode = REQUIRED) LocalDate startDate, - @Schema(description = "종료일", example = "2024-10-25") + @Schema(description = "종료일", example = "2024-10-25", requiredMode = REQUIRED) @JsonFormat(pattern = "yyyy-MM-dd") LocalDate endDate ) { diff --git a/src/main/java/in/koreatech/koin/domain/ownershop/dto/OwnerShopsRequest.java b/src/main/java/in/koreatech/koin/domain/ownershop/dto/OwnerShopsRequest.java index 07ef7565c5..f52697470c 100644 --- a/src/main/java/in/koreatech/koin/domain/ownershop/dto/OwnerShopsRequest.java +++ b/src/main/java/in/koreatech/koin/domain/ownershop/dto/OwnerShopsRequest.java @@ -1,5 +1,7 @@ package in.koreatech.koin.domain.ownershop.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import java.time.LocalTime; import java.util.List; @@ -17,47 +19,51 @@ @JsonNaming(SnakeCaseStrategy.class) public record OwnerShopsRequest( - @Schema(description = "주소", example = "충청남도 천안시 동남구 병천면 충절로 1600") + @Schema(description = "주소", example = "충청남도 천안시 동남구 병천면 충절로 1600", requiredMode = REQUIRED) @NotBlank(message = "주소를 입력해주세요.") String address, - @Schema(description = "상점 카테고리 고유 id 리스트", example = "[1]") + @Schema(description = "상점 카테고리 고유 id 리스트", example = "[1]", requiredMode = REQUIRED) + @NotNull(message = "카테고리를 입력해주세요.") @Size(min = 1, message = "최소 한 개의 카테고리가 필요합니다.") List categoryIds, - @Schema(description = "배달 가능 여부", example = "false") + @Schema(description = "배달 가능 여부", example = "false", requiredMode = REQUIRED) @NotNull(message = "배달 가능 여부를 입력해주세요.") Boolean delivery, - @Schema(description = "배달 금액", example = "1000") + @Schema(description = "배달 금액", example = "1000", requiredMode = REQUIRED) @NotNull(message = "배달 금액을 입력해주세요.") @Min(value = 0, message = "배달 금액은 0원 이상이어야 합니다.") Integer deliveryPrice, - @Schema(description = "기타정보", example = "이번주 전 메뉴 10% 할인 이벤트합니다.") + @Schema(description = "기타정보", example = "이번주 전 메뉴 10% 할인 이벤트합니다.", requiredMode = REQUIRED) + @NotBlank(message = "상점 설명을 입력해주세요.") String description, - @Schema(description = "이미지 URL 리스트", example = "[\"string\"]") + @Schema(description = "이미지 URL 리스트", example = """ + [ "https://testimage.com" ] + """, requiredMode = REQUIRED) List imageUrls, - @Schema(description = "가게명", example = "써니 숯불 도시락") + @Schema(description = "가게명", example = "써니 숯불 도시락", requiredMode = REQUIRED) @NotBlank(message = "상점 이름을 입력해주세요.") String name, - @Schema(description = "요일별 운영 시간과 휴무 여부") + @Schema(description = "요일별 운영 시간과 휴무 여부", requiredMode = REQUIRED) List open, - @Schema(description = "계좌 이체 가능 여부", example = "true") + @Schema(description = "계좌 이체 가능 여부", example = "true", requiredMode = REQUIRED) @NotNull(message = "계좌 이체 가능 여부를 입력해주세요.") Boolean payBank, - @Schema(description = "카드 가능 여부", example = "true") + @Schema(description = "카드 가능 여부", example = "true", requiredMode = REQUIRED) @NotNull(message = "카드 가능 여부를 입력해주세요.") Boolean payCard, - @Schema(description = "전화번호", example = "041-123-4567") + @Schema(description = "전화번호", example = "041-123-4567", requiredMode = REQUIRED) @NotBlank(message = "전화번호를 입력해주세요.") - @Pattern(regexp = "^[0-9]{3}-[0-9]{3,4}-[0-9]{4}", message = "전화번호 형식이 올바르지 않습니다.") + @Pattern(regexp = "^\\d{3}-\\d{3,4}-\\d{4}", message = "전화번호 형식이 올바르지 않습니다.") String phone ) { @@ -83,17 +89,17 @@ public Shop toEntity(Owner owner) { @JsonNaming(value = SnakeCaseStrategy.class) public record InnerOpenRequest( - @Schema(description = "닫는 시간", example = "22:30") + @Schema(description = "닫는 시간", example = "22:30", requiredMode = REQUIRED) LocalTime closeTime, - @Schema(description = "휴무 여부", example = "false") + @Schema(description = "휴무 여부", example = "false", requiredMode = REQUIRED) Boolean closed, - @Schema(description = "요일", example = "MONDAY") + @Schema(description = "요일", example = "MONDAY", requiredMode = REQUIRED) @NotBlank(message = "영업 요일을 입력해주세요.") String dayOfWeek, - @Schema(description = "여는 시간", example = "10:00") + @Schema(description = "여는 시간", example = "10:00", requiredMode = REQUIRED) LocalTime openTime ) { diff --git a/src/main/java/in/koreatech/koin/domain/ownershop/dto/OwnerShopsResponse.java b/src/main/java/in/koreatech/koin/domain/ownershop/dto/OwnerShopsResponse.java index 022262261c..32f90c0b22 100644 --- a/src/main/java/in/koreatech/koin/domain/ownershop/dto/OwnerShopsResponse.java +++ b/src/main/java/in/koreatech/koin/domain/ownershop/dto/OwnerShopsResponse.java @@ -1,15 +1,21 @@ package in.koreatech.koin.domain.ownershop.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import java.util.List; import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; import in.koreatech.koin.domain.shop.model.Shop; +import io.swagger.v3.oas.annotations.media.Schema; @JsonNaming(value = SnakeCaseStrategy.class) public record OwnerShopsResponse( + @Schema(description = "매장 수", example = "3", requiredMode = REQUIRED) Integer count, + + @Schema(description = "매장 목록") List shops ) { @@ -19,8 +25,13 @@ public static OwnerShopsResponse from(List shops) { @JsonNaming(value = SnakeCaseStrategy.class) public record InnerShopResponse( + @Schema(description = "매장 ID", example = "1", requiredMode = REQUIRED) Integer id, + + @Schema(description = "매장 이름", example = "감성떡볶이", requiredMode = REQUIRED) String name, + + @Schema(description = "이벤트 진행 여부", example = "true", requiredMode = REQUIRED) boolean isEvent ) { diff --git a/src/main/java/in/koreatech/koin/domain/ownershop/service/OwnerShopService.java b/src/main/java/in/koreatech/koin/domain/ownershop/service/OwnerShopService.java index 4a6d0cbf0a..86d9c74453 100644 --- a/src/main/java/in/koreatech/koin/domain/ownershop/service/OwnerShopService.java +++ b/src/main/java/in/koreatech/koin/domain/ownershop/service/OwnerShopService.java @@ -12,7 +12,7 @@ import in.koreatech.koin.domain.owner.model.Owner; import in.koreatech.koin.domain.owner.repository.OwnerRepository; -import in.koreatech.koin.domain.ownershop.ShopEventCreateEvent; +import in.koreatech.koin.domain.ownershop.EventArticleCreateEvent; import in.koreatech.koin.domain.ownershop.dto.CreateEventRequest; import in.koreatech.koin.domain.ownershop.dto.ModifyEventRequest; import in.koreatech.koin.domain.ownershop.dto.OwnerShopEventsResponse; @@ -291,7 +291,7 @@ public void createEvent(Integer ownerId, Integer shopId, CreateEventRequest shop .build()); } eventPublisher.publishEvent( - new ShopEventCreateEvent( + new EventArticleCreateEvent( shop.getId(), shop.getName(), savedEventArticle.getTitle() diff --git a/src/main/java/in/koreatech/koin/domain/shop/dto/CreateCategoryRequest.java b/src/main/java/in/koreatech/koin/domain/shop/dto/CreateCategoryRequest.java index 21504b9b28..ac855fc912 100644 --- a/src/main/java/in/koreatech/koin/domain/shop/dto/CreateCategoryRequest.java +++ b/src/main/java/in/koreatech/koin/domain/shop/dto/CreateCategoryRequest.java @@ -1,11 +1,16 @@ package in.koreatech.koin.domain.shop.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.Size; public record CreateCategoryRequest( - @Schema(example = "사이드 메뉴", description = "카테고리명") - @NotBlank @Size(min = 1, max = 15) String name + @Schema(example = "사이드 메뉴", description = "카테고리명", requiredMode = REQUIRED) + @NotBlank(message = "카테고리명은 필수입니다.") + @Size(min = 1, max = 20, message = "카테고리명은 1자 이상 20자 이하로 입력해주세요.") + String name ) { + } diff --git a/src/main/java/in/koreatech/koin/domain/shop/dto/CreateMenuRequest.java b/src/main/java/in/koreatech/koin/domain/shop/dto/CreateMenuRequest.java index 1f1d56bbef..05fa3d8ea4 100644 --- a/src/main/java/in/koreatech/koin/domain/shop/dto/CreateMenuRequest.java +++ b/src/main/java/in/koreatech/koin/domain/shop/dto/CreateMenuRequest.java @@ -1,6 +1,8 @@ package in.koreatech.koin.domain.shop.dto; import static com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import java.util.List; @@ -13,25 +15,33 @@ @JsonNaming(value = SnakeCaseStrategy.class) public record CreateMenuRequest( - @Schema(example = "[1, 2, 3]", description = "선택된 카테고리 고유 id 리스트") - @NotNull List categoryIds, + @Schema(example = "[1, 2, 3]", description = "선택된 카테고리 고유 id 리스트", requiredMode = REQUIRED) + @NotNull(message = "카테고리는 필수입니다.") + List categoryIds, - @Schema(example = "저희 가게의 대표 메뉴 짜장면입니다.", description = "메뉴 구성 설명") - @Size(max = 80) String description, + @Schema(example = "저희 가게의 대표 메뉴 짜장면입니다.", description = "메뉴 구성 설명", requiredMode = REQUIRED) + @Size(max = 80, message = "메뉴 구성 설명은 80자 이하로 입력해주세요.") + String description, - @Schema(example = "[\"https://static.koreatech.in/example.png\"]", description = "이미지 URL 리스트") - @Size(max = 3) List imageUrls, + @Schema(example = """ + [ "https://static.koreatech.in/example.png" ] + """, description = "이미지 URL 리스트", requiredMode = REQUIRED) + @Size(max = 3, message = "이미지는 최대 3개까지 입력 가능합니다.") + List imageUrls, - @Schema(example = "true", description = "단일 메뉴 여부") - @NotNull boolean isSingle, + @Schema(example = "true", description = "단일 메뉴 여부", requiredMode = REQUIRED) + @NotNull(message = "단일 메뉴 여부는 필수입니다.") + boolean isSingle, @Schema(example = "짜장면", description = "메뉴명") - @NotNull @Size(min = 1, max = 25) String name, + @NotNull(message = "메뉴명은 필수입니다.") + @Size(min = 1, max = 25, message = "메뉴명은 1자 이상 25자 이하로 입력해주세요.") + String name, - @Schema(description = "단일 메뉴가 아닐때의 옵션에 따른 가격 리스트 / 단일 메뉴일 경우 null") + @Schema(description = "단일 메뉴가 아닐때의 옵션에 따른 가격 리스트 / 단일 메뉴일 경우 null", requiredMode = NOT_REQUIRED) List optionPrices, - @Schema(description = "단일 메뉴일때의 가격 / 단일 메뉴가 아닐 경우 null") + @Schema(description = "단일 메뉴일때의 가격 / 단일 메뉴가 아닐 경우 null", requiredMode = NOT_REQUIRED) Integer singlePrice ) { @@ -45,10 +55,10 @@ public Menu toEntity(Integer shopId) { @JsonNaming(value = SnakeCaseStrategy.class) public record InnerOptionPrice( - @Schema(example = "대", description = "옵션명") + @Schema(example = "대", description = "옵션명", requiredMode = REQUIRED) @NotNull @Size(min = 1, max = 50) String option, - @Schema(example = "26000", description = "가격") + @Schema(example = "26000", description = "가격", requiredMode = REQUIRED) @NotNull Integer price ) { diff --git a/src/main/java/in/koreatech/koin/domain/shop/dto/MenuCategoriesResponse.java b/src/main/java/in/koreatech/koin/domain/shop/dto/MenuCategoriesResponse.java index 704bc653cc..6b45ba3dd7 100644 --- a/src/main/java/in/koreatech/koin/domain/shop/dto/MenuCategoriesResponse.java +++ b/src/main/java/in/koreatech/koin/domain/shop/dto/MenuCategoriesResponse.java @@ -1,15 +1,21 @@ package in.koreatech.koin.domain.shop.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import java.util.List; import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; import in.koreatech.koin.domain.shop.model.MenuCategory; +import io.swagger.v3.oas.annotations.media.Schema; @JsonNaming(value = SnakeCaseStrategy.class) public record MenuCategoriesResponse( + @Schema(description = "카테고리 수", example = "3") Long count, + + @Schema(description = "카테고리 목록") List menuCategories ) { @@ -18,11 +24,14 @@ public static MenuCategoriesResponse from(List menuCategories) { .map(menuCategory -> MenuCategoryResponse.of(menuCategory.getId(), menuCategory.getName())) .toList(); - return new MenuCategoriesResponse((long)categories.size(), categories); + return new MenuCategoriesResponse((long) categories.size(), categories); } private record MenuCategoryResponse( + @Schema(description = "카테고리 ID", example = "1", requiredMode = REQUIRED) Integer id, + + @Schema(description = "카테고리 이름", example = "치킨", requiredMode = REQUIRED) String name ) { diff --git a/src/main/java/in/koreatech/koin/domain/shop/dto/MenuDetailResponse.java b/src/main/java/in/koreatech/koin/domain/shop/dto/MenuDetailResponse.java index 37dcb23dd3..8e10a2794d 100644 --- a/src/main/java/in/koreatech/koin/domain/shop/dto/MenuDetailResponse.java +++ b/src/main/java/in/koreatech/koin/domain/shop/dto/MenuDetailResponse.java @@ -1,5 +1,8 @@ package in.koreatech.koin.domain.shop.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import java.util.List; import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; @@ -15,34 +18,34 @@ @Slf4j @JsonNaming(value = SnakeCaseStrategy.class) public record MenuDetailResponse( - @Schema(example = "1", description = "고유id") + @Schema(example = "1", description = "고유id", requiredMode = REQUIRED) Integer id, - @Schema(example = "1", description = "메뉴가 소속된 상점의 고유 id ") + @Schema(example = "1", description = "메뉴가 소속된 상점의 고유 id", requiredMode = REQUIRED) Integer shopId, - @Schema(example = "탕수육", description = "이름") + @Schema(example = "탕수육", description = "이름", requiredMode = REQUIRED) String name, - @Schema(example = "false", description = "숨김 여부") + @Schema(example = "false", description = "숨김 여부", requiredMode = REQUIRED) Boolean isHidden, - @Schema(example = "false", description = "단일 메뉴 여부") + @Schema(example = "false", description = "단일 메뉴 여부", requiredMode = REQUIRED) Boolean isSingle, - @Schema(example = "7000", description = "단일 메뉴일때(is_single이 true일때)의 가격") + @Schema(example = "7000", description = "단일 메뉴일때(is_single이 true일때)의 가격", requiredMode = REQUIRED) Integer singlePrice, - @Schema(description = "옵션이 있는 메뉴일때(is_single이 false일때)의 가격") + @Schema(description = "옵션이 있는 메뉴일때(is_single이 false일때)의 가격", requiredMode = NOT_REQUIRED) List optionPrices, - @Schema(example = "돼지고기 + 튀김", description = "구성 설명") + @Schema(example = "돼지고기 + 튀김", description = "구성 설명", requiredMode = REQUIRED) String description, - @Schema(description = "소속되어 있는 메뉴 카테고리 고유 id 리스트") + @Schema(description = "소속되어 있는 메뉴 카테고리 고유 id 리스트", requiredMode = REQUIRED) List categoryIds, - @Schema(description = "이미지 URL 리스트") + @Schema(description = "이미지 URL 리스트", requiredMode = NOT_REQUIRED) List imageUrls ) { @@ -93,12 +96,13 @@ public static MenuDetailResponse createForMultipleOption(Menu menu, List categoryIds, - - @Schema(example = "저희 가게의 대표 메뉴 짜장면입니다.", description = "메뉴 구성 설명") - @Size(max = 80) String description, - - @Schema(example = "[\"https://static.koreatech.in/example.png\"]", description = "이미지 URL 리스트") - @Size(max = 3) List imageUrls, - - @Schema(example = "true", description = "단일 메뉴 여부") - @NotNull boolean isSingle, - - @Schema(example = "짜장면", description = "메뉴명") - @NotNull @Size(min = 1, max = 25) String name, - - @Schema(description = "단일 메뉴가 아닐때의 옵션에 따른 가격 리스트 / 단일 메뉴일 경우 null") + @Schema(example = "[1, 2, 3]", description = "선택된 카테고리 고유 id 리스트", requiredMode = REQUIRED) + @NotNull(message = "카테고리는 필수입니다.") + List categoryIds, + + @Schema(example = "저희 가게의 대표 메뉴 짜장면입니다.", description = "메뉴 구성 설명", requiredMode = REQUIRED) + @Size(max = 80, message = "메뉴 구성 설명은 80자 이하로 입력해주세요.") + String description, + + @Schema(example = """ + [ "https://static.koreatech.in/example.png" ] + """, description = "이미지 URL 리스트", requiredMode = NOT_REQUIRED) + @Size(max = 3, message = "이미지는 최대 3개까지 입력 가능합니다.") + List imageUrls, + + @Schema(example = "true", description = "단일 메뉴 여부", requiredMode = REQUIRED) + @NotNull(message = "단일 메뉴 여부는 필수입니다.") + boolean isSingle, + + @Schema(example = "짜장면", description = "메뉴명", requiredMode = REQUIRED) + @NotNull(message = "메뉴명은 필수입니다.") + @Size(min = 1, max = 25, message = "메뉴명은 1자 이상 25자 이하로 입력해주세요.") + String name, + + @Schema(description = "단일 메뉴가 아닐때의 옵션에 따른 가격 리스트 / 단일 메뉴일 경우 null", requiredMode = NOT_REQUIRED) List optionPrices, - @Schema(description = "단일 메뉴일때의 가격 / 단일 메뉴가 아닐 경우 null") + @Schema(description = "단일 메뉴일때의 가격 / 단일 메뉴가 아닐 경우 null", requiredMode = NOT_REQUIRED) Integer singlePrice ) { @JsonNaming(value = SnakeCaseStrategy.class) public record InnerOptionPrice( - @Schema(example = "대", description = "옵션명") - @NotNull @Size(min = 1, max = 50) String option, - - @Schema(example = "26000", description = "가격") - @NotNull Integer price + @Schema(example = "대", description = "옵션명", requiredMode = REQUIRED) + @NotNull(message = "옵션명은 필수입니다.") + @Size(min = 1, max = 50, message = "옵션명은 1자 이상 50자 이하로 입력해주세요.") + String option, + + @Schema(example = "26000", description = "가격", requiredMode = REQUIRED) + @NotNull(message = "가격은 필수입니다.") + Integer price ) { } diff --git a/src/main/java/in/koreatech/koin/domain/shop/dto/ModifyShopRequest.java b/src/main/java/in/koreatech/koin/domain/shop/dto/ModifyShopRequest.java index a673d65be1..546aa2e721 100644 --- a/src/main/java/in/koreatech/koin/domain/shop/dto/ModifyShopRequest.java +++ b/src/main/java/in/koreatech/koin/domain/shop/dto/ModifyShopRequest.java @@ -1,6 +1,8 @@ package in.koreatech.koin.domain.shop.dto; import static com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import java.time.LocalTime; import java.util.List; @@ -11,60 +13,75 @@ import in.koreatech.koin.domain.shop.model.Shop; import in.koreatech.koin.domain.shop.model.ShopOpen; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; @JsonNaming(value = SnakeCaseStrategy.class) public record ModifyShopRequest( - @Schema(example = "충청남도 천안시 동남구 병천면", description = "주소") + @Schema(example = "충청남도 천안시 동남구 병천면", description = "주소", requiredMode = NOT_REQUIRED) String address, - @Schema(example = "[1, 2]", description = "상점 카테고리 고유 id 리스트") + @Schema(example = "[1, 2]", description = "상점 카테고리 고유 id 리스트", requiredMode = REQUIRED) + @NotNull(message = "카테고리는 필수입니다.") List categoryIds, - @Schema(example = "true", description = "배달 가능 여부") + @Schema(example = "true", description = "배달 가능 여부", requiredMode = REQUIRED) + @NotNull(message = "배달 가능 여부는 필수입니다.") Boolean delivery, - @Schema(example = "1000", description = "배달비") + @Schema(example = "1000", description = "배달비", requiredMode = REQUIRED) + @NotNull(message = "배달비는 필수입니다.") Integer deliveryPrice, - @Schema(example = "string", description = "설명") + @Schema(example = "string", description = "설명", requiredMode = NOT_REQUIRED) String description, - @Schema(description = "이미지 URL 리스트") + @Schema(description = "이미지 URL 리스트", example = """ + [ "https://static.koreatech.in/example.png" ] + """, requiredMode = NOT_REQUIRED) List imageUrls, - @Schema(example = "수신반점", description = "이름") + @Schema(example = "수신반점", description = "이름", requiredMode = REQUIRED) + @NotBlank(message = "이름은 필수입니다.") String name, - @Schema(description = "요일별 휴무 여부 및 장사 시간") + @Schema(description = "요일별 휴무 여부 및 장사 시간", requiredMode = NOT_REQUIRED) List open, - @Schema(example = "true", description = "계좌 이체 가능 여부") + @Schema(example = "true", description = "계좌 이체 가능 여부", requiredMode = REQUIRED) + @NotNull(message = "계좌 이체 가능 여부는 필수입니다.") Boolean payBank, - @Schema(example = "false", description = "카드 계산 가능 여부") + @Schema(example = "false", description = "카드 계산 가능 여부", requiredMode = REQUIRED) + @NotNull(message = "카드 계산 가능 여부는 필수입니다.") Boolean payCard, - @Schema(example = "041-000-0000", description = "전화번호") + @Schema(example = "041-000-0000", description = "전화번호", requiredMode = NOT_REQUIRED) + @Size(max = 50, message = "전화번호는 50자 이하로 입력해주세요.") String phone ) { + @JsonNaming(value = SnakeCaseStrategy.class) public record InnerShopOpen( @Schema(example = "MONDAY", description = """ 요일 = ['MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY', 'SUNDAY'] - """) + """, requiredMode = REQUIRED) String dayOfWeek, - @Schema(example = "false", description = "휴무 여부") + @Schema(example = "false", description = "휴무 여부", requiredMode = REQUIRED) + @NotNull(message = "휴무 여부는 필수입니다.") Boolean closed, - @Schema(example = "02:00", description = "오픈 시간") @JsonFormat(pattern = "HH:mm") + @Schema(example = "02:00", description = "오픈 시간", requiredMode = NOT_REQUIRED) LocalTime openTime, - @Schema(example = "16:00", description = "마감 시간") @JsonFormat(pattern = "HH:mm") + @Schema(example = "16:00", description = "마감 시간", requiredMode = NOT_REQUIRED) LocalTime closeTime ) { + public ShopOpen toEntity(Shop shop) { return ShopOpen.builder() .shop(shop) diff --git a/src/main/java/in/koreatech/koin/domain/shop/dto/ShopCategoriesResponse.java b/src/main/java/in/koreatech/koin/domain/shop/dto/ShopCategoriesResponse.java index e31b106e5f..09ff84589e 100644 --- a/src/main/java/in/koreatech/koin/domain/shop/dto/ShopCategoriesResponse.java +++ b/src/main/java/in/koreatech/koin/domain/shop/dto/ShopCategoriesResponse.java @@ -1,6 +1,8 @@ package in.koreatech.koin.domain.shop.dto; import static com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import java.util.List; @@ -11,10 +13,10 @@ @JsonNaming(value = SnakeCaseStrategy.class) public record ShopCategoriesResponse( - @Schema(example = "10", description = "개수") + @Schema(example = "10", description = "상점 카테고리 개수", requiredMode = REQUIRED) Integer totalCount, - @Schema(description = "모든 상점 카테고리 리스트") + @Schema(description = "모든 상점 카테고리 리스트", requiredMode = NOT_REQUIRED) List shopCategories ) { @@ -27,13 +29,13 @@ public static ShopCategoriesResponse from(List shopCategories) { @JsonNaming(value = SnakeCaseStrategy.class) private record InnerShopCategory( - @Schema(example = "2", description = "고유 id") + @Schema(example = "2", description = "고유 id", requiredMode = REQUIRED) Integer id, - @Schema(example = "https://static.koreatech.in/test.png", description = "이미지 URL") + @Schema(example = "https://static.koreatech.in/test.png", description = "이미지 URL", requiredMode = NOT_REQUIRED) String imageUrl, - @Schema(example = "치킨", description = "이름") + @Schema(example = "치킨", description = "이름", requiredMode = REQUIRED) String name ) { diff --git a/src/main/java/in/koreatech/koin/domain/shop/dto/ShopEventsResponse.java b/src/main/java/in/koreatech/koin/domain/shop/dto/ShopEventsResponse.java index 1a3d0351af..ef8e38ff62 100644 --- a/src/main/java/in/koreatech/koin/domain/shop/dto/ShopEventsResponse.java +++ b/src/main/java/in/koreatech/koin/domain/shop/dto/ShopEventsResponse.java @@ -1,5 +1,8 @@ package in.koreatech.koin.domain.shop.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import java.time.Clock; import java.time.LocalDate; import java.util.ArrayList; @@ -23,30 +26,32 @@ public record ShopEventsResponse( @JsonNaming(value = SnakeCaseStrategy.class) public record InnerShopEventResponse( - @Schema(description = "상점 ID", example = "1") + @Schema(description = "상점 ID", example = "1", requiredMode = REQUIRED) Integer shopId, - @Schema(description = "상점 이름", example = "술꾼") + @Schema(description = "상점 이름", example = "술꾼", requiredMode = REQUIRED) String shopName, - @Schema(description = "이벤트 ID", example = "1") + @Schema(description = "이벤트 ID", example = "1", requiredMode = REQUIRED) Integer eventId, - @Schema(description = "이벤트 제목", example = "콩순이 사장님이 미쳤어요!!") + @Schema(description = "이벤트 제목", example = "콩순이 사장님이 미쳤어요!!", requiredMode = REQUIRED) String title, - @Schema(description = "이벤트 내용", example = "콩순이 가게 전메뉴 90% 할인! 가게 폐업 임박...") + @Schema(description = "이벤트 내용", example = "콩순이 가게 전메뉴 90% 할인! 가게 폐업 임박...", requiredMode = REQUIRED) String content, - @Schema(description = "이벤트 이미지") + @Schema(description = "이벤트 이미지", example = """ + [ "https://static.koreatech.in/example.png" ] + """, requiredMode = NOT_REQUIRED) List thumbnailImages, - @Schema(description = "시작일", example = "2024-10-22") @JsonFormat(pattern = "yyyy-MM-dd") + @Schema(description = "시작일", example = "2024-10-22", requiredMode = REQUIRED) LocalDate startDate, - @Schema(description = "종료일", example = "2024-10-25") @JsonFormat(pattern = "yyyy-MM-dd") + @Schema(description = "종료일", example = "2024-10-25", requiredMode = REQUIRED) LocalDate endDate ) { diff --git a/src/main/java/in/koreatech/koin/domain/shop/dto/ShopMenuResponse.java b/src/main/java/in/koreatech/koin/domain/shop/dto/ShopMenuResponse.java index af1bc7df0e..0ae82ae550 100644 --- a/src/main/java/in/koreatech/koin/domain/shop/dto/ShopMenuResponse.java +++ b/src/main/java/in/koreatech/koin/domain/shop/dto/ShopMenuResponse.java @@ -1,5 +1,8 @@ package in.koreatech.koin.domain.shop.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; @@ -17,14 +20,14 @@ @JsonNaming(value = SnakeCaseStrategy.class) public record ShopMenuResponse( - @Schema(example = "20", description = "개수") + @Schema(example = "20", description = "개수", requiredMode = REQUIRED) Integer count, @Schema(description = "카테고리 별로 분류된 소속 메뉴 리스트") List menuCategories, - @Schema(example = "2024-03-16", description = "해당 상점 마지막 메뉴 업데이트 날짜") @JsonFormat(pattern = "yyyy-MM-dd") + @Schema(example = "2024-03-16", description = "해당 상점 마지막 메뉴 업데이트 날짜", requiredMode = REQUIRED) LocalDateTime updatedAt ) { @@ -74,10 +77,10 @@ private static Integer getInnerMenuCategoriesResponseIndex( @JsonNaming(value = SnakeCaseStrategy.class) private record InnerMenuCategoriesResponse( - @Schema(example = "1", description = "카테고리 id") + @Schema(example = "1", description = "카테고리 id", requiredMode = REQUIRED) Integer id, - @Schema(example = "중식", description = "카테고리 이름") + @Schema(example = "중식", description = "카테고리 이름", requiredMode = REQUIRED) String name, @Schema(description = "해당 상점의 모든 메뉴 리스트") @@ -94,28 +97,30 @@ public static InnerMenuCategoriesResponse from(MenuCategory menuCategory) { @JsonNaming(value = SnakeCaseStrategy.class) private record InnerMenuResponse( - @Schema(example = "1", description = "고유 id") + @Schema(example = "1", description = "고유 id", requiredMode = REQUIRED) Integer id, - @Schema(example = "탕수육", description = "이름") + @Schema(example = "탕수육", description = "이름", requiredMode = NOT_REQUIRED) String name, - @Schema(example = "false", description = "숨김 여부") + @Schema(example = "false", description = "숨김 여부", requiredMode = REQUIRED) Boolean isHidden, - @Schema(example = "false", description = "단일 메뉴 여부") + @Schema(example = "false", description = "단일 메뉴 여부", requiredMode = REQUIRED) Boolean isSingle, - @Schema(example = "10000", description = "단일 메뉴일때(is_single이 true일때)의 가격 / 단일 메뉴가 아니라면 null") + @Schema(example = "10000", description = "단일 메뉴일때(is_single이 true일때)의 가격 / 단일 메뉴가 아니라면 null", requiredMode = NOT_REQUIRED) Integer singlePrice, - @Schema(description = "옵션이 있는 메뉴일때(is_single이 false일때)의 옵션에 따른 가격 리스트 / 단일 메뉴 라면 null") + @Schema(description = "옵션이 있는 메뉴일때(is_single이 false일때)의 옵션에 따른 가격 리스트 / 단일 메뉴 라면 null", requiredMode = NOT_REQUIRED) List optionPrices, - @Schema(example = "저희 식당의 대표 메뉴 탕수육입니다.", description = "설명") + @Schema(example = "저희 식당의 대표 메뉴 탕수육입니다.", description = "설명", requiredMode = NOT_REQUIRED) String description, - @Schema(description = "이미지 URL리스트") + @Schema(description = "이미지 URL리스트", example = """ + [ "https://static.koreatech.in/example.png", "https://static.koreatech.in/example2.png" ] + """, requiredMode = NOT_REQUIRED) List imageUrls ) { @@ -136,10 +141,10 @@ public static InnerMenuResponse from(MenuCategoryMap menuCategoryMap) { @JsonNaming(value = SnakeCaseStrategy.class) private record InnerOptionPrice( - @Schema(example = "대", description = "옵션명") + @Schema(example = "대", description = "옵션명", requiredMode = REQUIRED) String option, - @Schema(example = "26000", description = "가격") + @Schema(example = "26000", description = "가격", requiredMode = REQUIRED) Integer price ) { diff --git a/src/main/java/in/koreatech/koin/domain/shop/dto/ShopResponse.java b/src/main/java/in/koreatech/koin/domain/shop/dto/ShopResponse.java index a47595144a..28ad8681da 100644 --- a/src/main/java/in/koreatech/koin/domain/shop/dto/ShopResponse.java +++ b/src/main/java/in/koreatech/koin/domain/shop/dto/ShopResponse.java @@ -1,6 +1,8 @@ package in.koreatech.koin.domain.shop.dto; import static com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import java.time.LocalDateTime; import java.time.LocalTime; @@ -23,13 +25,13 @@ public record ShopResponse( @Schema(example = "true", description = "배달 가능 여부") Boolean delivery, - @Schema(example = "1000", description = "배달비") + @Schema(example = "1000", description = "배달비", requiredMode = REQUIRED) Integer deliveryPrice, @Schema(example = "string", description = "설명") String description, - @Schema(example = "1", description = "고유 id") + @Schema(example = "1", description = "고유 id", requiredMode = REQUIRED) Integer id, @Schema(description = "이미지 URL 리스트") @@ -44,23 +46,23 @@ public record ShopResponse( @Schema(description = "요일별 휴무 여부 및 장사 시간") List open, - @Schema(example = "true", description = "계좌 이체 가능 여부") + @Schema(example = "true", description = "계좌 이체 가능 여부", requiredMode = REQUIRED) Boolean payBank, - @Schema(example = "false", description = "카드 계산 가능 여부") + @Schema(example = "false", description = "카드 계산 가능 여부", requiredMode = REQUIRED) Boolean payCard, - @Schema(example = "041-000-0000", description = "전화번호") + @Schema(example = "041-000-0000", description = "전화번호", requiredMode = NOT_REQUIRED) String phone, @Schema(description = "소속된 상점 카테고리 리스트") List shopCategories, @JsonFormat(pattern = "yyyy-MM-dd") - @Schema(example = "2024-03-01", description = "업데이트 날짜") + @Schema(example = "2024-03-01", description = "업데이트 날짜", requiredMode = REQUIRED) LocalDateTime updatedAt, - @Schema(example = "true", description = "상점 이벤트 진행 여부") + @Schema(example = "true", description = "상점 이벤트 진행 여부", requiredMode = REQUIRED) Boolean isEvent ) { @@ -108,18 +110,18 @@ public static ShopResponse from(Shop shop, Boolean isEvent) { public record InnerShopOpen( @Schema(example = "MONDAY", description = """ 요일 = ['MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY', 'SUNDAY'] - """) + """, requiredMode = REQUIRED) String dayOfWeek, - @Schema(example = "false", description = "휴무 여부") + @Schema(example = "false", description = "휴무 여부", requiredMode = REQUIRED) Boolean closed, - @Schema(example = "02:00", description = "오픈 시간") @JsonFormat(pattern = "HH:mm") + @Schema(example = "02:00", description = "오픈 시간", requiredMode = NOT_REQUIRED) LocalTime openTime, - @Schema(example = "16:00", description = "마감 시간") @JsonFormat(pattern = "HH:mm") + @Schema(example = "16:00", description = "마감 시간", requiredMode = NOT_REQUIRED) LocalTime closeTime ) { @@ -134,20 +136,20 @@ public static InnerShopOpen from(ShopOpen shopOpen) { } private record InnerShopCategory( - @Schema(example = "1", description = "고유 id") + @Schema(example = "1", description = "고유 id", requiredMode = REQUIRED) Integer id, - @Schema(example = "중국집", description = "이름") + @Schema(example = "중국집", description = "이름", requiredMode = REQUIRED) String name ) { } private record InnerMenuCategory( - @Schema(example = "1", description = "고유 id") + @Schema(example = "1", description = "고유 id", requiredMode = REQUIRED) Integer id, - @Schema(example = "대표 메뉴", description = "이름") + @Schema(example = "대표 메뉴", description = "이름", requiredMode = REQUIRED) String name ) { diff --git a/src/main/java/in/koreatech/koin/domain/shop/dto/ShopsResponse.java b/src/main/java/in/koreatech/koin/domain/shop/dto/ShopsResponse.java index 97d3da0330..eb870da113 100644 --- a/src/main/java/in/koreatech/koin/domain/shop/dto/ShopsResponse.java +++ b/src/main/java/in/koreatech/koin/domain/shop/dto/ShopsResponse.java @@ -1,6 +1,8 @@ package in.koreatech.koin.domain.shop.dto; import static com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import java.util.List; @@ -12,7 +14,7 @@ @JsonNaming(value = SnakeCaseStrategy.class) public record ShopsResponse( - @Schema(example = "100", description = "상점 개수") + @Schema(example = "100", description = "상점 개수", requiredMode = REQUIRED) Integer count, @Schema(description = "상점 정보") @@ -25,31 +27,31 @@ public static ShopsResponse from(List shops) { @JsonNaming(value = SnakeCaseStrategy.class) public record InnerShopResponse( - @Schema(example = "[1, 2, 3]", description = " 속해있는 상점 카테고리들의 고유 id 리스트") + @Schema(example = "[1, 2, 3]", description = " 속해있는 상점 카테고리들의 고유 id 리스트", requiredMode = NOT_REQUIRED) List categoryIds, - @Schema(example = "true", description = "배달 가능 여부") + @Schema(example = "true", description = "배달 가능 여부", requiredMode = REQUIRED) boolean delivery, - @Schema(example = "1", description = "고유 id") + @Schema(example = "1", description = "고유 id", requiredMode = REQUIRED) Integer id, - @Schema(example = "수신반점", description = "이름") + @Schema(example = "수신반점", description = "이름", requiredMode = REQUIRED) String name, @Schema(description = "요일별 휴무 여부 및 장사 시간") List open, - @Schema(example = "true", description = "계좌 이체 가능 여부 ") + @Schema(example = "true", description = "계좌 이체 가능 여부", requiredMode = REQUIRED) boolean payBank, - @Schema(example = "true", description = "카드 계산 가능 여부") + @Schema(example = "true", description = "카드 계산 가능 여부", requiredMode = REQUIRED) boolean payCard, - @Schema(example = "041-000-0000", description = "전화번호") + @Schema(example = "041-000-0000", description = "전화번호", requiredMode = NOT_REQUIRED) String phone, - @Schema(example = "true", description = "삭제 여부") + @Schema(example = "true", description = "삭제 여부", requiredMode = REQUIRED) boolean isEvent ) { diff --git a/src/main/java/in/koreatech/koin/domain/shop/model/EventArticle.java b/src/main/java/in/koreatech/koin/domain/shop/model/EventArticle.java index 634bc3618b..46616c2d20 100644 --- a/src/main/java/in/koreatech/koin/domain/shop/model/EventArticle.java +++ b/src/main/java/in/koreatech/koin/domain/shop/model/EventArticle.java @@ -80,6 +80,10 @@ public class EventArticle extends BaseEntity { @Column(name = "nickname", nullable = false) private String nickname = ""; + /** + * 미사용 컬럼 + * TODO: 마이그레이션 종료 후 flyway로 제거 + */ @Size(max = 255) @Column(name = "thumbnail") private String thumbnail; diff --git a/src/main/java/in/koreatech/koin/domain/shop/model/ShopEventListener.java b/src/main/java/in/koreatech/koin/domain/shop/model/ShopEventListener.java index 2e498bc3a0..72ed3abf32 100644 --- a/src/main/java/in/koreatech/koin/domain/shop/model/ShopEventListener.java +++ b/src/main/java/in/koreatech/koin/domain/shop/model/ShopEventListener.java @@ -8,7 +8,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.event.TransactionalEventListener; -import in.koreatech.koin.domain.ownershop.ShopEventCreateEvent; +import in.koreatech.koin.domain.ownershop.EventArticleCreateEvent; import in.koreatech.koin.domain.user.repository.UserRepository; import in.koreatech.koin.global.domain.notification.model.NotificationFactory; import in.koreatech.koin.global.domain.notification.service.NotificationService; @@ -24,7 +24,7 @@ public class ShopEventListener { private final UserRepository userRepository; @TransactionalEventListener(phase = AFTER_COMMIT) - public void onShopEventCreate(ShopEventCreateEvent event) { + public void onShopEventCreate(EventArticleCreateEvent event) { var notifications = userRepository.findAllByDeviceTokenIsNotNull() .stream() .map(user -> notificationFactory.generateShopEventCreateNotification( diff --git a/src/main/java/in/koreatech/koin/domain/timetable/controller/TimetableApi.java b/src/main/java/in/koreatech/koin/domain/timetable/controller/TimetableApi.java index ea4c4991ba..f169d8e519 100644 --- a/src/main/java/in/koreatech/koin/domain/timetable/controller/TimetableApi.java +++ b/src/main/java/in/koreatech/koin/domain/timetable/controller/TimetableApi.java @@ -13,7 +13,7 @@ import in.koreatech.koin.domain.timetable.dto.LectureResponse; import in.koreatech.koin.domain.timetable.dto.SemesterResponse; -import in.koreatech.koin.domain.timetable.dto.TimeTableRequest; +import in.koreatech.koin.domain.timetable.dto.TimeTableCreateRequest; import in.koreatech.koin.domain.timetable.dto.TimeTableResponse; import in.koreatech.koin.domain.timetable.dto.TimeTableUpdateRequest; import in.koreatech.koin.global.auth.Auth; @@ -82,7 +82,7 @@ ResponseEntity getTimeTables( @SecurityRequirement(name = "Jwt Authentication") @PostMapping("/timetables") ResponseEntity createTimeTables( - @RequestBody TimeTableRequest timeTableRequest, + @RequestBody TimeTableCreateRequest timeTableCreateRequest, @Auth(permit = {STUDENT}) Integer userId ); diff --git a/src/main/java/in/koreatech/koin/domain/timetable/controller/TimetableController.java b/src/main/java/in/koreatech/koin/domain/timetable/controller/TimetableController.java index c3b3b95410..fbe6b65e3a 100644 --- a/src/main/java/in/koreatech/koin/domain/timetable/controller/TimetableController.java +++ b/src/main/java/in/koreatech/koin/domain/timetable/controller/TimetableController.java @@ -15,7 +15,7 @@ import in.koreatech.koin.domain.timetable.dto.LectureResponse; import in.koreatech.koin.domain.timetable.dto.SemesterResponse; -import in.koreatech.koin.domain.timetable.dto.TimeTableRequest; +import in.koreatech.koin.domain.timetable.dto.TimeTableCreateRequest; import in.koreatech.koin.domain.timetable.dto.TimeTableResponse; import in.koreatech.koin.domain.timetable.dto.TimeTableUpdateRequest; import in.koreatech.koin.domain.timetable.service.SemesterService; @@ -56,7 +56,7 @@ public ResponseEntity getTimeTables( @PostMapping("/timetables") public ResponseEntity createTimeTables( - @Valid @RequestBody TimeTableRequest request, + @Valid @RequestBody TimeTableCreateRequest request, @Auth(permit = {STUDENT}) Integer userId ) { TimeTableResponse timeTableResponse = timetableService.createTimeTables(userId, request); diff --git a/src/main/java/in/koreatech/koin/domain/timetable/dto/LectureResponse.java b/src/main/java/in/koreatech/koin/domain/timetable/dto/LectureResponse.java index 239d06aa49..3d2136a185 100644 --- a/src/main/java/in/koreatech/koin/domain/timetable/dto/LectureResponse.java +++ b/src/main/java/in/koreatech/koin/domain/timetable/dto/LectureResponse.java @@ -1,5 +1,8 @@ package in.koreatech.koin.domain.timetable.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import java.util.Collections; import java.util.List; @@ -12,42 +15,43 @@ @JsonNaming(value = SnakeCaseStrategy.class) public record LectureResponse( - @Schema(name = "과목 코드", example = "ARB244") + @Schema(name = "과목 코드", example = "ARB244", requiredMode = REQUIRED) String code, - @Schema(name = "과목 이름", example = "건축구조의 이해 및 실습") + @Schema(name = "과목 이름", example = "건축구조의 이해 및 실습", requiredMode = REQUIRED) String name, - @Schema(name = "대상 학년", example = "3") + @Schema(name = "대상 학년", example = "3", requiredMode = REQUIRED) String grades, - @Schema(name = "분반", example = "01") + @Schema(name = "분반", example = "01", requiredMode = REQUIRED) String lectureClass, - @Schema(name = "수강 인원", example = "25") + @Schema(name = "수강 인원", example = "25", requiredMode = NOT_REQUIRED) String regularNumber, - @Schema(name = "학부", example = "디자인ㆍ건축공학부") + @Schema(name = "학부", example = "디자인ㆍ건축공학부", requiredMode = REQUIRED) String department, - @Schema(name = "대상", example = "디자 1 건축") + @Schema(name = "대상", example = "디자 1 건축", requiredMode = REQUIRED) String target, - @Schema(name = "강의 교수", example = "이돈우") + @Schema(name = "강의 교수", example = "이돈우", requiredMode = NOT_REQUIRED) String professor, - @Schema(name = "영어 수업인지", example = "N") + @Schema(name = "영어 수업인지", example = "N", requiredMode = REQUIRED) String isEnglish, - @Schema(name = "설계 학점", example = "0") + @Schema(name = "설계 학점", example = "0", requiredMode = REQUIRED) String designScore, - @Schema(name = "이러닝인지", example = "Y") + @Schema(name = "이러닝인지", example = "Y", requiredMode = REQUIRED) String isElearning, - @Schema(name = "강의 시간", example = "[200,201,202,203,204,205,206,207]") + @Schema(name = "강의 시간", example = "[200,201,202,203,204,205,206,207]", requiredMode = REQUIRED) List classTime ) { + public static LectureResponse from(Lecture lecture) { return new LectureResponse( lecture.getCode(), diff --git a/src/main/java/in/koreatech/koin/domain/timetable/dto/SemesterResponse.java b/src/main/java/in/koreatech/koin/domain/timetable/dto/SemesterResponse.java index 4f6ff0ecdf..82096c37cf 100644 --- a/src/main/java/in/koreatech/koin/domain/timetable/dto/SemesterResponse.java +++ b/src/main/java/in/koreatech/koin/domain/timetable/dto/SemesterResponse.java @@ -1,5 +1,7 @@ package in.koreatech.koin.domain.timetable.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; @@ -8,10 +10,10 @@ @JsonNaming(value = SnakeCaseStrategy.class) public record SemesterResponse( - @Schema(description = "id", example = "1") + @Schema(description = "id", example = "1", requiredMode = REQUIRED) Integer id, - @Schema(description = "학기", example = "20241") + @Schema(description = "학기", example = "20241", requiredMode = REQUIRED) String semester ) { diff --git a/src/main/java/in/koreatech/koin/domain/timetable/dto/TimeTableRequest.java b/src/main/java/in/koreatech/koin/domain/timetable/dto/TimeTableCreateRequest.java similarity index 59% rename from src/main/java/in/koreatech/koin/domain/timetable/dto/TimeTableRequest.java rename to src/main/java/in/koreatech/koin/domain/timetable/dto/TimeTableCreateRequest.java index 3e72aab3d3..4310e88f64 100644 --- a/src/main/java/in/koreatech/koin/domain/timetable/dto/TimeTableRequest.java +++ b/src/main/java/in/koreatech/koin/domain/timetable/dto/TimeTableCreateRequest.java @@ -1,5 +1,8 @@ package in.koreatech.koin.domain.timetable.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import java.util.Arrays; import java.util.List; @@ -13,59 +16,68 @@ import jakarta.validation.Valid; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; @JsonNaming(value = SnakeCaseStrategy.class) -public record TimeTableRequest( - @Schema(description = "시간표 정보", example = "[...]") +public record TimeTableCreateRequest( @Valid + @Schema(description = "시간표 정보", requiredMode = REQUIRED) @NotNull(message = "시간표 정보를 입력해주세요.") List timetable, - @Schema(description = "학기 정보", example = "20192") + @Schema(description = "학기 정보", example = "20192", requiredMode = REQUIRED) @NotBlank(message = "학기 정보를 입력해주세요.") String semester ) { + @JsonNaming(value = SnakeCaseStrategy.class) public record InnerTimeTableRequest( - @Schema(description = "과목 코드", example = "CPC490") + @Schema(description = "과목 코드", example = "CPC490", requiredMode = NOT_REQUIRED) String code, - @Schema(description = "강의 이름", example = "운영체제") + @Schema(description = "강의 이름", example = "운영체제", requiredMode = REQUIRED) @NotBlank(message = "강의 이름을 입력해주세요.") String classTitle, - @Schema(description = "강의 시간", example = "[210, 211]") + @Schema(description = "강의 시간", example = "[210, 211]", requiredMode = REQUIRED) @NotNull(message = "강의 시간을 입력해주세요.") List classTime, - @Schema(description = "강의 장소", example = "null") + @Schema(description = "강의 장소", example = "2공학관", requiredMode = NOT_REQUIRED) String classPlace, - @Schema(name = "강의 교수", example = "이돈우") + @Schema(name = "강의 교수", example = "이돈우", requiredMode = NOT_REQUIRED) String professor, - @Schema(description = "대상 학년", example = "3") + @Schema(description = "대상 학년", example = "3", requiredMode = REQUIRED) @NotBlank(message = "대상 학년을 입력해주세요.") String grades, - @Schema(name = "분반", example = "01") + @Schema(name = "분반", example = "01", requiredMode = REQUIRED) + @Size(max = 3, message = "분반은 3자 이하로 입력해주세요.") String lectureClass, - @Schema(name = "대상", example = "디자 1 건축") + @Schema(name = "대상", example = "디자 1 건축", requiredMode = NOT_REQUIRED) + @Size(max = 200, message = "대상은 200자 이하로 입력해주세요.") String target, - @Schema(name = "수강 인원", example = "25") + @Schema(name = "수강 인원", example = "25", requiredMode = NOT_REQUIRED) + @Size(max = 4, message = "수강 인원은 4자 이하로 입력해주세요.") String regularNumber, - @Schema(name = "설계 학점", example = "0") + @Schema(name = "설계 학점", example = "0", requiredMode = NOT_REQUIRED) + @Size(max = 4, message = "설계 학점은 4자 이하로 입력해주세요.") String designScore, - @Schema(name = "학부", example = "디자인ㆍ건축공학부") + @Schema(name = "학부", example = "디자인ㆍ건축공학부", requiredMode = NOT_REQUIRED) + @Size(max = 30, message = "학부는 30자 이하로 입력해주세요.") String department, - @Schema(name = "memo", example = "null") + @Schema(name = "memo", example = "메모메모", requiredMode = NOT_REQUIRED) + @Size(max = 200, message = "메모는 200자 이하로 입력해주세요.") String memo ) { + public TimeTable toTimeTable(User user, Semester semester) { return TimeTable.builder() .user(user) diff --git a/src/main/java/in/koreatech/koin/domain/timetable/dto/TimeTableResponse.java b/src/main/java/in/koreatech/koin/domain/timetable/dto/TimeTableResponse.java index e75611a729..bdcad14f4e 100644 --- a/src/main/java/in/koreatech/koin/domain/timetable/dto/TimeTableResponse.java +++ b/src/main/java/in/koreatech/koin/domain/timetable/dto/TimeTableResponse.java @@ -1,6 +1,7 @@ package in.koreatech.koin.domain.timetable.dto; import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import java.util.Arrays; import java.util.Collections; @@ -14,7 +15,7 @@ @JsonNaming(value = SnakeCaseStrategy.class) public record TimeTableResponse( - @Schema(name = "학기", example = "20241") + @Schema(name = "학기", example = "20241", requiredMode = REQUIRED) String semester, @Schema(name = "시간표 상세정보") @@ -23,43 +24,43 @@ public record TimeTableResponse( @JsonNaming(value = SnakeCaseStrategy.class) public record InnerTimeTableResponse( - @Schema(name = "시간표 ID", example = "1") + @Schema(name = "시간표 ID", example = "1", requiredMode = REQUIRED) Integer id, - @Schema(name = "과목 코드", example = "ARB244") + @Schema(name = "과목 코드", example = "ARB244", requiredMode = NOT_REQUIRED) String regularNumber, - @Schema(name = "과목 코드", example = "ARB244") + @Schema(name = "과목 코드", example = "ARB244", requiredMode = NOT_REQUIRED) String code, - @Schema(description = "설계 학점", example = "0") + @Schema(description = "설계 학점", example = "0", requiredMode = NOT_REQUIRED) String designScore, - @Schema(description = "강의 시간", example = "[204, 205, 206, 207, 302, 303]") + @Schema(description = "강의 시간", example = "[204, 205, 206, 207, 302, 303]", requiredMode = REQUIRED) List classTime, - @Schema(description = "강의 장소", example = "null") + @Schema(description = "강의 장소", example = "2 공학관", requiredMode = REQUIRED) String classPlace, @Schema(description = "메모", example = "null", requiredMode = NOT_REQUIRED) String memo, - @Schema(name = "대상 학년", example = "3") + @Schema(name = "대상 학년", example = "3", requiredMode = REQUIRED) String grades, - @Schema(name = "강의 이름", example = "한국사") + @Schema(name = "강의 이름", example = "한국사", requiredMode = REQUIRED) String classTitle, - @Schema(name = "분반", example = "01") + @Schema(name = "분반", example = "01", requiredMode = NOT_REQUIRED) String lectureClass, - @Schema(name = "대상", example = "디자 1 건축") + @Schema(name = "대상", example = "디자 1 건축", requiredMode = NOT_REQUIRED) String target, - @Schema(name = "강의 교수", example = "이돈우") + @Schema(name = "강의 교수", example = "이돈우", requiredMode = NOT_REQUIRED) String professor, - @Schema(name = "학부", example = "디자인ㆍ건축공학부") + @Schema(name = "학부", example = "디자인ㆍ건축공학부", requiredMode = NOT_REQUIRED) String department ) { diff --git a/src/main/java/in/koreatech/koin/domain/timetable/dto/TimeTableUpdateRequest.java b/src/main/java/in/koreatech/koin/domain/timetable/dto/TimeTableUpdateRequest.java index cf82567f07..be6c596f81 100644 --- a/src/main/java/in/koreatech/koin/domain/timetable/dto/TimeTableUpdateRequest.java +++ b/src/main/java/in/koreatech/koin/domain/timetable/dto/TimeTableUpdateRequest.java @@ -1,5 +1,8 @@ package in.koreatech.koin.domain.timetable.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import java.util.List; import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; @@ -9,61 +12,69 @@ import jakarta.validation.Valid; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; @JsonNaming(value = SnakeCaseStrategy.class) public record TimeTableUpdateRequest( - @Schema(description = "시간표 정보", example = "[...]") @Valid + @Schema(description = "시간표 정보", requiredMode = NOT_REQUIRED) @NotNull(message = "시간표 정보를 입력해주세요.") List timetable, - @Schema(description = "학기 정보", example = "20192") + @Schema(description = "학기 정보", example = "20192", requiredMode = NOT_REQUIRED) @NotBlank(message = "학기 정보를 입력해주세요.") String semester ) { + @JsonNaming(value = SnakeCaseStrategy.class) public record InnerTimeTableRequest( - @Schema(description = "시간표 식별 번호", example = "1") + @Schema(description = "시간표 식별 번호", example = "1", requiredMode = REQUIRED) @NotNull(message = "시간표 식별 번호를 입력해주세요.") Integer id, - @Schema(description = "과목 코드", example = "CPC490") + @Schema(description = "과목 코드", example = "CPC490", requiredMode = NOT_REQUIRED) String code, - @Schema(description = "강의 이름", example = "운영체제") + @Schema(description = "강의 이름", example = "운영체제", requiredMode = REQUIRED) @NotBlank(message = "강의 이름을 입력해주세요.") String classTitle, - @Schema(description = "강의 시간", example = "[210, 211]") + @Schema(description = "강의 시간", example = "[210, 211]", requiredMode = REQUIRED) @NotNull(message = "강의 시간을 입력해주세요.") List classTime, - @Schema(description = "강의 장소", example = "null") + @Schema(description = "강의 장소", example = "null", requiredMode = NOT_REQUIRED) String classPlace, - @Schema(name = "강의 교수", example = "이돈우") + @Schema(name = "강의 교수", example = "이돈우", requiredMode = NOT_REQUIRED) String professor, - @Schema(description = "대상 학년", example = "3") + @Schema(description = "대상 학년", example = "3", requiredMode = REQUIRED) @NotBlank(message = "대상 학년을 입력해주세요.") String grades, - @Schema(name = "분반", example = "01") + @Schema(name = "분반", example = "01", requiredMode = NOT_REQUIRED) + @Size(max = 3, message = "분반은 3자 이하로 입력해주세요.") String lectureClass, - @Schema(name = "대상", example = "디자 1 건축") + @Schema(name = "대상", example = "디자 1 건축", requiredMode = NOT_REQUIRED) + @Size(max = 200, message = "대상은 200자 이하로 입력해주세요.") String target, - @Schema(name = "수강 인원", example = "25") + @Schema(name = "수강 인원", example = "25", requiredMode = NOT_REQUIRED) + @Size(max = 4, message = "수강 인원은 4자 이하로 입력해주세요.") String regularNumber, - @Schema(name = "설계 학점", example = "0") + @Schema(name = "설계 학점", example = "0", requiredMode = NOT_REQUIRED) + @Size(max = 4, message = "설계 학점은 4자 이하로 입력해주세요.") String designScore, - @Schema(name = "학부", example = "디자인ㆍ건축공학부") + @Schema(name = "학부", example = "디자인ㆍ건축공학부", requiredMode = NOT_REQUIRED) + @Size(max = 30, message = "학부는 30자 이하로 입력해주세요.") String department, - @Schema(name = "memo", example = "null") + @Schema(name = "memo", example = "메모메모", requiredMode = NOT_REQUIRED) + @Size(max = 200, message = "메모는 200자 이하로 입력해주세요.") String memo ) { diff --git a/src/main/java/in/koreatech/koin/domain/timetable/model/TimeTable.java b/src/main/java/in/koreatech/koin/domain/timetable/model/TimeTable.java index 5fa1384304..c454c12e68 100644 --- a/src/main/java/in/koreatech/koin/domain/timetable/model/TimeTable.java +++ b/src/main/java/in/koreatech/koin/domain/timetable/model/TimeTable.java @@ -1,6 +1,7 @@ package in.koreatech.koin.domain.timetable.model; import static jakarta.persistence.GenerationType.IDENTITY; +import static lombok.AccessLevel.PROTECTED; import org.hibernate.annotations.Where; @@ -17,7 +18,6 @@ import jakarta.persistence.Table; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Size; -import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; @@ -26,7 +26,7 @@ @Entity @Table(name = "timetables") @Where(clause = "is_deleted=0") -@NoArgsConstructor(access = AccessLevel.PROTECTED) +@NoArgsConstructor(access = PROTECTED) public class TimeTable extends BaseEntity { @Id @@ -98,8 +98,9 @@ public class TimeTable extends BaseEntity { @Builder private TimeTable(User user, Semester semester, String code, String classTitle, String classTime, - String classPlace, String professor, String grades, String lectureClass, String target, String regularNumber, - String designScore, String department, String memo, boolean isDeleted) { + String classPlace, String professor, String grades, String lectureClass, String target, + String regularNumber, + String designScore, String department, String memo, boolean isDeleted) { this.user = user; this.semester = semester; this.code = code; diff --git a/src/main/java/in/koreatech/koin/domain/timetable/service/TimetableService.java b/src/main/java/in/koreatech/koin/domain/timetable/service/TimetableService.java index 73eb255fa7..48d2ef58da 100644 --- a/src/main/java/in/koreatech/koin/domain/timetable/service/TimetableService.java +++ b/src/main/java/in/koreatech/koin/domain/timetable/service/TimetableService.java @@ -6,7 +6,7 @@ import org.springframework.transaction.annotation.Transactional; import in.koreatech.koin.domain.timetable.dto.LectureResponse; -import in.koreatech.koin.domain.timetable.dto.TimeTableRequest; +import in.koreatech.koin.domain.timetable.dto.TimeTableCreateRequest; import in.koreatech.koin.domain.timetable.dto.TimeTableResponse; import in.koreatech.koin.domain.timetable.dto.TimeTableUpdateRequest; import in.koreatech.koin.domain.timetable.exception.SemesterNotFoundException; @@ -46,10 +46,10 @@ public TimeTableResponse getTimeTables(Integer userId, String semesterRequest) { } @Transactional - public TimeTableResponse createTimeTables(Integer userId, TimeTableRequest request) { + public TimeTableResponse createTimeTables(Integer userId, TimeTableCreateRequest request) { User user = userRepository.getById(userId); Semester semester = semesterRepository.getBySemester(request.semester()); - for (TimeTableRequest.InnerTimeTableRequest timeTableRequest : request.timetable()) { + for (TimeTableCreateRequest.InnerTimeTableRequest timeTableRequest : request.timetable()) { TimeTable timeTable = timeTableRequest.toTimeTable(user, semester); timeTableRepository.save(timeTable); } diff --git a/src/main/java/in/koreatech/koin/domain/user/dto/AuthResponse.java b/src/main/java/in/koreatech/koin/domain/user/dto/AuthResponse.java index 8e73e06ad9..796aaba0fc 100644 --- a/src/main/java/in/koreatech/koin/domain/user/dto/AuthResponse.java +++ b/src/main/java/in/koreatech/koin/domain/user/dto/AuthResponse.java @@ -1,5 +1,7 @@ package in.koreatech.koin.domain.user.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; @@ -8,7 +10,7 @@ @JsonNaming(SnakeCaseStrategy.class) public record AuthResponse( - @Schema(description = "사용자 권한 타입", example = "STUDENT") + @Schema(description = "사용자 권한 타입", example = "STUDENT", requiredMode = REQUIRED) String userType ) { diff --git a/src/main/java/in/koreatech/koin/domain/user/dto/AuthTokenRequest.java b/src/main/java/in/koreatech/koin/domain/user/dto/AuthTokenRequest.java index 7f73ce918b..df7cdff6bb 100644 --- a/src/main/java/in/koreatech/koin/domain/user/dto/AuthTokenRequest.java +++ b/src/main/java/in/koreatech/koin/domain/user/dto/AuthTokenRequest.java @@ -1,6 +1,7 @@ package in.koreatech.koin.domain.user.dto; import static com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import com.fasterxml.jackson.databind.annotation.JsonNaming; @@ -9,7 +10,7 @@ @JsonNaming(value = SnakeCaseStrategy.class) public record AuthTokenRequest( - @Schema(description = "인증토큰") + @Schema(description = "인증토큰", example = "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0QGdtYWlsLmNvbSJ", requiredMode = REQUIRED) @NotBlank(message = "토큰은 필수입니다.") String authToken ) { diff --git a/src/main/java/in/koreatech/koin/domain/user/dto/CoopResponse.java b/src/main/java/in/koreatech/koin/domain/user/dto/CoopResponse.java index be5cbd9796..0fb191fe24 100644 --- a/src/main/java/in/koreatech/koin/domain/user/dto/CoopResponse.java +++ b/src/main/java/in/koreatech/koin/domain/user/dto/CoopResponse.java @@ -1,5 +1,8 @@ package in.koreatech.koin.domain.user.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import com.fasterxml.jackson.databind.PropertyNamingStrategies; import com.fasterxml.jackson.databind.annotation.JsonNaming; @@ -8,19 +11,19 @@ @JsonNaming(value = PropertyNamingStrategies.SnakeCaseStrategy.class) public record CoopResponse( - @Schema(description = "이메일 주소", example = "koin123@koreatech.ac.kr") + @Schema(description = "이메일 주소", example = "koin123@koreatech.ac.kr", requiredMode = REQUIRED) String email, - @Schema(description = "성별(남:0, 여:1)", example = "1") + @Schema(description = "성별(남:0, 여:1)", example = "1", requiredMode = NOT_REQUIRED) Integer gender, - @Schema(description = "이름", example = "최준호") + @Schema(description = "이름", example = "최준호", requiredMode = NOT_REQUIRED) String name, - @Schema(description = "휴대폰 번호", example = "010-0000-0000") + @Schema(description = "휴대폰 번호", example = "010-0000-0000", requiredMode = NOT_REQUIRED) String phoneNumber, - @Schema(description = "유저 타입", example = "COOP") + @Schema(description = "유저 타입", example = "COOP", requiredMode = REQUIRED) String userType ) { diff --git a/src/main/java/in/koreatech/koin/domain/user/dto/EmailCheckExistsRequest.java b/src/main/java/in/koreatech/koin/domain/user/dto/EmailCheckExistsRequest.java index baebbbe8ec..754333c2a3 100644 --- a/src/main/java/in/koreatech/koin/domain/user/dto/EmailCheckExistsRequest.java +++ b/src/main/java/in/koreatech/koin/domain/user/dto/EmailCheckExistsRequest.java @@ -1,12 +1,14 @@ package in.koreatech.koin.domain.user.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Email; import jakarta.validation.constraints.NotBlank; public record EmailCheckExistsRequest( - @Schema(description = "이메일", example = "koin123@koreatech.ac.kr") - @Email(message = "이메일 형식을 지켜주세요.") + @Schema(description = "이메일", example = "koin123@koreatech.ac.kr", requiredMode = REQUIRED) + @Email(message = "이메일 형식이 올바르지 않습니다. ${validatedValue}") @NotBlank(message = "이메일을 입력해주세요.") String email ) { diff --git a/src/main/java/in/koreatech/koin/domain/user/dto/FindPasswordRequest.java b/src/main/java/in/koreatech/koin/domain/user/dto/FindPasswordRequest.java index 69475186f1..98b5673bbc 100644 --- a/src/main/java/in/koreatech/koin/domain/user/dto/FindPasswordRequest.java +++ b/src/main/java/in/koreatech/koin/domain/user/dto/FindPasswordRequest.java @@ -3,13 +3,13 @@ import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.Email; import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Pattern; public record FindPasswordRequest( - @Email(message = "아우누리 계정 형식이 아닙니다. ${validatedValue}") - @NotNull(message = "이메일은 비어있을 수 없습니다.") - @Schema(description = "이메일 주소", requiredMode = REQUIRED, example = "asdf@koreatech.ac.kr") + @Schema(description = "이메일 주소", example = "asdf@koreatech.ac.kr", requiredMode = REQUIRED) + @Pattern(regexp = "^[a-zA-Z0-9._%+-]+@koreatech.ac.kr$", message = "아우누리 계정 형식이 아닙니다. ${validatedValue}") + @NotNull(message = "이메일을 입력해주세요.") String email ) { diff --git a/src/main/java/in/koreatech/koin/domain/user/dto/NicknameCheckExistsRequest.java b/src/main/java/in/koreatech/koin/domain/user/dto/NicknameCheckExistsRequest.java index e73029fc61..a2d1c76e2f 100644 --- a/src/main/java/in/koreatech/koin/domain/user/dto/NicknameCheckExistsRequest.java +++ b/src/main/java/in/koreatech/koin/domain/user/dto/NicknameCheckExistsRequest.java @@ -1,13 +1,15 @@ package in.koreatech.koin.domain.user.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.Size; public record NicknameCheckExistsRequest( - @Schema(description = "닉네임", example = "홍길동") + @Schema(description = "닉네임", example = "홍길동", requiredMode = REQUIRED) @Size(max = 10, message = "닉네임은 최대 10자입니다.") - @NotBlank(message = "이메일을 입력해주세요.") + @NotBlank(message = "닉네임을 입력해주세요.") String nickname ) { diff --git a/src/main/java/in/koreatech/koin/domain/user/dto/StudentRegisterRequest.java b/src/main/java/in/koreatech/koin/domain/user/dto/StudentRegisterRequest.java index f7cf42420e..d995a4d68b 100644 --- a/src/main/java/in/koreatech/koin/domain/user/dto/StudentRegisterRequest.java +++ b/src/main/java/in/koreatech/koin/domain/user/dto/StudentRegisterRequest.java @@ -1,6 +1,8 @@ package in.koreatech.koin.domain.user.dto; import static com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; import java.time.Clock; import java.time.LocalDateTime; @@ -24,41 +26,58 @@ @JsonNaming(value = SnakeCaseStrategy.class) public record StudentRegisterRequest( - @Schema(description = "이메일", example = "koin123@koreatech.ac.kr") - @Email(message = "이메일 형식을 지켜주세요.") + @Schema(description = "이메일", example = "koin123@koreatech.ac.kr", requiredMode = REQUIRED) + @Email(message = "이메일 형식을 지켜주세요. ${validatedValue}") @NotBlank(message = "이메일을 입력해주세요.") String email, - @Schema(description = "이름", example = "최준호") + @Schema(description = "이름", example = "최준호", requiredMode = NOT_REQUIRED) @Size(max = 50, message = "이름은 50자 이내여야 합니다.") String name, - @Schema(description = " SHA 256 해시 알고리즘으로 암호화된 비밀번호", example = "cd06f8c2b0dd065faf6ef910c7f15934363df71c33740fd245590665286ed268") + @Schema(description = " SHA 256 해시 알고리즘으로 암호화된 비밀번호", example = "cd06f8c2b0dd065faf6ef910c7f15934363df71c33740fd245590665286ed268", requiredMode = REQUIRED) @NotBlank(message = "비밀번호를 입력해주세요.") String password, - @Schema(description = "닉네임", example = "bbo") + @Schema(description = "닉네임", example = "bbo", requiredMode = NOT_REQUIRED) @Size(max = 10, message = "닉네임은 최대 10자입니다.") String nickname, - @Schema(description = "성별(남:0, 여:1)", example = "0") + @Schema(description = "성별(남:0, 여:1)", example = "0", requiredMode = NOT_REQUIRED) UserGender gender, - @Schema(description = "졸업 여부", example = "false") - Boolean isGraduated, + @Schema(description = "졸업 여부", example = "false", requiredMode = NOT_REQUIRED) + boolean isGraduated, - @Schema(description = "전공{기계공학부, 컴퓨터공학부, 메카트로닉스공학부, 전기전자통신공학부, 디자인공학부, 건축공학부, 화학생명공학부, 에너지신소재공학부, 산업경영학부, 고용서비스정책학과}", example = "컴퓨터공학부") + @Schema( + description = """ + - 전공 + - 기계공학부 + - 컴퓨터공학부 + - 메카트로닉스공학부 + - 전기전자통신공학부 + - 디자인공학부 + - 건축공학부 + - 화학생명공학부 + - 에너지신소재공학부 + - 산업경영학부 + - 고용서비스정책학과 + """, + example = "컴퓨터공학부", + requiredMode = REQUIRED + ) @JsonProperty("major") String department, - @Schema(description = "학번", example = "2021136012") + @Schema(description = "학번", example = "2021136012", requiredMode = NOT_REQUIRED) @Size(min = 10, max = 10, message = "학번은 10자여야합니다.") String studentNumber, - @Schema(description = "휴대폰 번호", example = "010-0000-0000") - @Pattern(regexp = "^[0-9]{3}-[0-9]{3,4}-[0-9]{4}", message = "전화번호 형식이 올바르지 않습니다.") + @Schema(description = "휴대폰 번호", example = "010-0000-0000", requiredMode = NOT_REQUIRED) + @Pattern(regexp = "^\\d{3}-\\d{3,4}-\\d{4}", message = "전화번호 형식이 올바르지 않습니다.") String phoneNumber ) { + public Student toStudent(PasswordEncoder passwordEncoder, Clock clock) { User user = User.builder() .password(passwordEncoder.encode(password)) diff --git a/src/main/java/in/koreatech/koin/domain/user/dto/StudentResponse.java b/src/main/java/in/koreatech/koin/domain/user/dto/StudentResponse.java index aa6aa452e3..f5b0c56f5e 100644 --- a/src/main/java/in/koreatech/koin/domain/user/dto/StudentResponse.java +++ b/src/main/java/in/koreatech/koin/domain/user/dto/StudentResponse.java @@ -1,5 +1,7 @@ package in.koreatech.koin.domain.user.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; + import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; @@ -9,29 +11,40 @@ @JsonNaming(value = SnakeCaseStrategy.class) public record StudentResponse( - @Schema(description = "익명 닉네임", example = "익명_1676688416361") + @Schema(description = "익명 닉네임", example = "익명_1676688416361", requiredMode = NOT_REQUIRED) String anonymousNickname, - @Schema(description = "이메일 주소", example = "koin123@koreatech.ac.kr") + @Schema(description = "이메일 주소", example = "koin123@koreatech.ac.kr", requiredMode = NOT_REQUIRED) String email, - @Schema(description = "성별(남:0, 여:1)", example = "1") + @Schema(description = "성별(남:0, 여:1)", example = "1", requiredMode = NOT_REQUIRED) Integer gender, - @Schema(description = "전공{기계공학부, 컴퓨터공학부, 메카트로닉스공학부, 전기전자통신공학부, 디자인공학부, " - + "건축공학부, 화학생명공학부, 에너지신소재공학부, 산업경영학부, 고용서비스정책학과}", example = "컴퓨터공학부") + @Schema(description = """ + 전공 + - 기계공학부 + - 컴퓨터공학부 + - 메카트로닉스공학부 + - 전기전자통신공학부 + - 디자인공학부 + - 건축공학부 + - 화학생명공학부 + - 에너지신소재공학부 + - 산업경영학부 + - 고용서비스정책학부 + """, example = "컴퓨터공학부", requiredMode = NOT_REQUIRED) String major, - @Schema(description = "이름", example = "최준호") + @Schema(description = "이름", example = "최준호", requiredMode = NOT_REQUIRED) String name, - @Schema(description = "닉네임", example = "juno") + @Schema(description = "닉네임", example = "juno", requiredMode = NOT_REQUIRED) String nickname, - @Schema(description = "휴대폰 번호", example = "010-0000-0000") + @Schema(description = "휴대폰 번호", example = "010-0000-0000", requiredMode = NOT_REQUIRED) String phoneNumber, - @Schema(description = "학번", example = "2029136012") + @Schema(description = "학번", example = "2029136012", requiredMode = NOT_REQUIRED) String studentNumber ) { diff --git a/src/main/java/in/koreatech/koin/domain/user/dto/StudentUpdateRequest.java b/src/main/java/in/koreatech/koin/domain/user/dto/StudentUpdateRequest.java index a5a782a0a5..104d95d1ba 100644 --- a/src/main/java/in/koreatech/koin/domain/user/dto/StudentUpdateRequest.java +++ b/src/main/java/in/koreatech/koin/domain/user/dto/StudentUpdateRequest.java @@ -1,5 +1,7 @@ package in.koreatech.koin.domain.user.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; + import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; @@ -9,32 +11,44 @@ @JsonNaming(value = SnakeCaseStrategy.class) public record StudentUpdateRequest ( - @Schema(description = "성별(남:0, 여:1)", example = "1") + @Schema(description = "성별(남:0, 여:1)", example = "1", requiredMode = NOT_REQUIRED) Integer gender, - @Schema(description = "[NOT UPDATE]신원(학생, 사장님)", example = "학생") + @Schema(description = "[NOT UPDATE]신원(학생, 사장님)", example = "학생", requiredMode = NOT_REQUIRED) Integer userIdentity, - @Schema(description = "[NOT UPDATE]졸업 여부(true, false)", example = "false") + @Schema(description = "[NOT UPDATE]졸업 여부(true, false)", example = "false", requiredMode = NOT_REQUIRED) Boolean isGraduated, - @Schema(description = "전공{기계공학부, 컴퓨터공학부, 메카트로닉스공학부, 전기전자통신공학부, 디자인공학부," - + "건축공학부, 화학생명공학부, 에너지신소재공학부, 산업경영학부, 고용서비스정책학과}", example = "컴퓨터공학부") + @Schema(description = """ + 전공 + - 기계공학부 + - 컴퓨터공학부 + - 메카트로닉스공학부 + - 전기전자통신공학부 + - 디자인공학부 + - 건축공학부 + - 화학생명공학부 + - 에너지신소재공학부 + - 산업경영학부 + - 고용서비스정책학부 + """, example = "컴퓨터공학부", requiredMode = NOT_REQUIRED) String major, @Size(max = 50, message = "이름의 길이는 최대 50자 입니다.") - @Schema(description = "이름", example = "최준호") + @Schema(description = "이름", example = "최준호", requiredMode = NOT_REQUIRED) String name, @Size(max = 10, message = "닉네임은 10자 이내여야 합니다.") - @Schema(description = "닉네임", example = "juno") + @Schema(description = "닉네임", example = "juno", requiredMode = NOT_REQUIRED) String nickname, - @Schema(description = "휴대폰 번호", example = "010-0000-0000") + @Schema(description = "휴대폰 번호", example = "010-0000-0000", requiredMode = NOT_REQUIRED) String phoneNumber, @Size(min = 10, max = 10, message = "학번은 10자여야 합니다.") - @Schema(description = "학번", example = "2020136065") + @Schema(description = "학번", example = "2020136065", requiredMode = NOT_REQUIRED) String studentNumber ) { + } diff --git a/src/main/java/in/koreatech/koin/domain/user/dto/StudentUpdateResponse.java b/src/main/java/in/koreatech/koin/domain/user/dto/StudentUpdateResponse.java index 2414c41385..12d995f7a6 100644 --- a/src/main/java/in/koreatech/koin/domain/user/dto/StudentUpdateResponse.java +++ b/src/main/java/in/koreatech/koin/domain/user/dto/StudentUpdateResponse.java @@ -1,5 +1,8 @@ package in.koreatech.koin.domain.user.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; @@ -9,29 +12,40 @@ @JsonNaming(value = SnakeCaseStrategy.class) public record StudentUpdateResponse( - @Schema(description = "익명 닉네임", example = "익명_1676688416361") + @Schema(description = "익명 닉네임", example = "익명_1676688416361", requiredMode = NOT_REQUIRED) String anonymousNickname, - @Schema(description = "이메일 주소", example = "koin123@koreatech.ac.kr") + @Schema(description = "이메일 주소", example = "koin123@koreatech.ac.kr", requiredMode = REQUIRED) String email, - @Schema(description = "성별(남:0, 여:1)", example = "1") + @Schema(description = "성별(남:0, 여:1)", example = "1", requiredMode = NOT_REQUIRED) Integer gender, - @Schema(description = "전공{기계공학부, 컴퓨터공학부, 메카트로닉스공학부, 전기전자통신공학부, 디자인공학부," - + "건축공학부, 화학생명공학부, 에너지신소재공학부, 산업경영학부, 고용서비스정책학과}", example = "컴퓨터공학부") + @Schema(description = """ + 전공 + - 기계공학부 + - 컴퓨터공학부 + - 메카트로닉스공학부 + - 전기전자통신공학부 + - 디자인공학부 + - 건축공학부 + - 화학생명공학부 + - 에너지신소재공학부 + - 산업경영학부 + - 고용서비스정책학부 + """, example = "컴퓨터공학부", requiredMode = NOT_REQUIRED) String major, - @Schema(description = "이름", example = "최준호") + @Schema(description = "이름", example = "최준호", requiredMode = NOT_REQUIRED) String name, - @Schema(description = "닉네임", example = "juno") + @Schema(description = "닉네임", example = "juno", requiredMode = NOT_REQUIRED) String nickname, - @Schema(description = "휴대폰 번호", example = "010-0000-0000") + @Schema(description = "휴대폰 번호", example = "010-0000-0000", requiredMode = NOT_REQUIRED) String phoneNumber, - @Schema(description = "학번", example = "2029136012") + @Schema(description = "학번", example = "2029136012", requiredMode = NOT_REQUIRED) String studentNumber ) { diff --git a/src/main/java/in/koreatech/koin/domain/user/dto/UserLoginRequest.java b/src/main/java/in/koreatech/koin/domain/user/dto/UserLoginRequest.java index 4a0ebc43e4..34759c3929 100644 --- a/src/main/java/in/koreatech/koin/domain/user/dto/UserLoginRequest.java +++ b/src/main/java/in/koreatech/koin/domain/user/dto/UserLoginRequest.java @@ -1,18 +1,24 @@ package in.koreatech.koin.domain.user.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.Email; import jakarta.validation.constraints.NotBlank; public record UserLoginRequest( - @Schema(description = "이메일", example = "koin123@koreatech.ac.kr") - @Email(message = "이메일 형식을 지켜주세요.") @NotBlank(message = "이메일을 입력해주세요.") String email, + @Schema(description = "이메일", example = "koin123@koreatech.ac.kr", requiredMode = REQUIRED) + @Email(message = "이메일 형식을 지켜주세요. ${validatedValue}") + @NotBlank(message = "이메일을 입력해주세요.") + String email, - @Schema(description = """ - SHA 256 해시 알고리즘으로 암호화된 비밀번호 - example: asdf1234! - """, example = "cd06f8c2b0dd065faf6ef910c7f15934363df71c33740fd245590665286ed268") - @NotBlank(message = "비밀번호를 입력해주세요.") String password + @Schema( + description = "SHA 256 해시 알고리즘으로 암호화된 비밀번호", + example = "cd06f8c2b0dd065faf6ef910c7f15934363df71c33740fd245590665286ed268", + requiredMode = REQUIRED + ) + @NotBlank(message = "비밀번호를 입력해주세요.") + String password ) { } diff --git a/src/main/java/in/koreatech/koin/domain/user/dto/UserLoginResponse.java b/src/main/java/in/koreatech/koin/domain/user/dto/UserLoginResponse.java index ad691edae5..f72752527d 100644 --- a/src/main/java/in/koreatech/koin/domain/user/dto/UserLoginResponse.java +++ b/src/main/java/in/koreatech/koin/domain/user/dto/UserLoginResponse.java @@ -1,24 +1,33 @@ package in.koreatech.koin.domain.user.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; public record UserLoginResponse( - @Schema(description = "Jwt accessToken", example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c") - @JsonProperty("token") String accessToken, + @Schema( + description = "Jwt accessToken", + example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", + requiredMode = REQUIRED + ) + @JsonProperty("token") + String accessToken, - @Schema(description = "Random UUID refresh token", example = "RANDOM-KEY-VALUE") - @JsonProperty("refresh_token") String refreshToken, + @Schema(description = "Random UUID refresh token", example = "RANDOM-KEY-VALUE", requiredMode = REQUIRED) + @JsonProperty("refresh_token") + String refreshToken, @Schema( description = """ 로그인한 회원의 신원 - `STUDENT`: 학생 - - `OWNER`: 사장님" - """, example = "STUDENT" + - `OWNER`: 사장님 + """, example = "STUDENT", requiredMode = REQUIRED ) - @JsonProperty("user_type") String userType + @JsonProperty("user_type") + String userType ) { public static UserLoginResponse of(String token, String refreshToken, String userType) { diff --git a/src/main/java/in/koreatech/koin/domain/user/dto/UserPasswordChangeRequest.java b/src/main/java/in/koreatech/koin/domain/user/dto/UserPasswordChangeRequest.java index e35a849a90..aa7d338bd1 100644 --- a/src/main/java/in/koreatech/koin/domain/user/dto/UserPasswordChangeRequest.java +++ b/src/main/java/in/koreatech/koin/domain/user/dto/UserPasswordChangeRequest.java @@ -1,10 +1,17 @@ package in.koreatech.koin.domain.user.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; + @JsonNaming(SnakeCaseStrategy.class) public record UserPasswordChangeRequest( + @Schema(description = "변경할 비밀번호 (SHA 256 해싱된 값)", example = "password", requiredMode = REQUIRED) + @NotBlank(message = "비밀번호를 입력해주세요.") String password ) { diff --git a/src/main/java/in/koreatech/koin/domain/user/dto/UserTokenRefreshRequest.java b/src/main/java/in/koreatech/koin/domain/user/dto/UserTokenRefreshRequest.java index 97daa53953..8b8279d04a 100644 --- a/src/main/java/in/koreatech/koin/domain/user/dto/UserTokenRefreshRequest.java +++ b/src/main/java/in/koreatech/koin/domain/user/dto/UserTokenRefreshRequest.java @@ -1,15 +1,20 @@ package in.koreatech.koin.domain.user.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; @JsonNaming(value = SnakeCaseStrategy.class) public record UserTokenRefreshRequest( + @Schema(description = "refresh_token", example = "eyJhbGciOiJIUzI1NiJ9", requiredMode = REQUIRED) @NotNull(message = "refresh_token을 입력해주세요.") - @JsonProperty("refresh_token") String refreshToken + @JsonProperty("refresh_token") + String refreshToken ) { } diff --git a/src/main/java/in/koreatech/koin/domain/user/dto/UserTokenRefreshResponse.java b/src/main/java/in/koreatech/koin/domain/user/dto/UserTokenRefreshResponse.java index 2c099d23af..3f9a6dcc93 100644 --- a/src/main/java/in/koreatech/koin/domain/user/dto/UserTokenRefreshResponse.java +++ b/src/main/java/in/koreatech/koin/domain/user/dto/UserTokenRefreshResponse.java @@ -1,15 +1,23 @@ package in.koreatech.koin.domain.user.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.v3.oas.annotations.media.Schema; public record UserTokenRefreshResponse( - @Schema(description = "Jwt accessToken", example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c") - @JsonProperty("token") String accessToken, + @Schema( + description = "Jwt accessToken", + example = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c", + requiredMode = REQUIRED + ) + @JsonProperty("token") + String accessToken, - @Schema(description = "Random UUID refreshToken", example = "RANDOM-KEY-VALUE") - @JsonProperty("refresh_token") String refreshToken + @Schema(description = "Random UUID refreshToken", example = "RANDOM-KEY-VALUE", requiredMode = REQUIRED) + @JsonProperty("refresh_token") + String refreshToken ) { public static UserTokenRefreshResponse of(String accessToken, String refreshToken) { diff --git a/src/main/java/in/koreatech/koin/domain/version/dto/VersionResponse.java b/src/main/java/in/koreatech/koin/domain/version/dto/VersionResponse.java index 6ec0b1a7eb..e546bb9ef2 100644 --- a/src/main/java/in/koreatech/koin/domain/version/dto/VersionResponse.java +++ b/src/main/java/in/koreatech/koin/domain/version/dto/VersionResponse.java @@ -1,19 +1,35 @@ package in.koreatech.koin.domain.version.dto; +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.PropertyNamingStrategies.SnakeCaseStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; import in.koreatech.koin.domain.version.model.Version; +import io.swagger.v3.oas.annotations.media.Schema; @JsonNaming(SnakeCaseStrategy.class) public record VersionResponse( + @Schema(description = "버전 ID", example = "1", requiredMode = REQUIRED) Integer id, + + @Schema(description = "버전", example = "1.0.0", requiredMode = REQUIRED) String version, + + @Schema(description = "버전 타입", example = "android", requiredMode = REQUIRED) String type, + + @Schema(description = "생성일", example = "2021-06-21 13:00:00", requiredMode = REQUIRED) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime createdAt, - LocalDateTime updatedAt) { + + @Schema(description = "수정일", example = "2021-06-21", requiredMode = REQUIRED) + @JsonFormat(pattern = "yyyy-MM-dd") + LocalDateTime updatedAt +) { public static VersionResponse from(Version version) { return new VersionResponse( diff --git a/src/main/java/in/koreatech/koin/global/config/SwaggerConfig.java b/src/main/java/in/koreatech/koin/global/config/SwaggerConfig.java index e8f4dada98..5e8a6c6bfb 100644 --- a/src/main/java/in/koreatech/koin/global/config/SwaggerConfig.java +++ b/src/main/java/in/koreatech/koin/global/config/SwaggerConfig.java @@ -36,6 +36,7 @@ public OpenAPI openAPI() { Server server = new Server(); server.setUrl(serverUrl); return new OpenAPI() + .openapi("3.1.0") .components(new Components()) .info(apiInfo()) .addSecurityItem(securityRequirement) diff --git a/src/test/java/in/koreatech/koin/acceptance/CommunityApiTest.java b/src/test/java/in/koreatech/koin/acceptance/CommunityApiTest.java index fd60969efd..0c86470089 100644 --- a/src/test/java/in/koreatech/koin/acceptance/CommunityApiTest.java +++ b/src/test/java/in/koreatech/koin/acceptance/CommunityApiTest.java @@ -188,9 +188,9 @@ void getArticle() { softly.assertThat(response.jsonPath().getBoolean("comments[0].is_deleted")) .isEqualTo(comment.getIsDeleted()); softly.assertThat(response.jsonPath().getBoolean("comments[0].grantEdit")) - .isEqualTo(comment.getGrantEdit()); + .isEqualTo(comment.isGrantEdit()); softly.assertThat(response.jsonPath().getBoolean("comments[0].grantDelete")) - .isEqualTo(comment.getGrantDelete()); + .isEqualTo(comment.isGrantDelete()); } ); } @@ -226,9 +226,9 @@ void getArticleAuthorizationComment() { assertSoftly( softly -> { softly.assertThat(response.jsonPath().getBoolean("comments[0].grantEdit")) - .isEqualTo(comment.getGrantEdit()); + .isEqualTo(comment.isGrantEdit()); softly.assertThat(response.jsonPath().getBoolean("comments[0].grantDelete")) - .isEqualTo(comment.getGrantDelete()); + .isEqualTo(comment.isGrantDelete()); } ); } diff --git a/src/test/java/in/koreatech/koin/acceptance/OwnerShopApiTest.java b/src/test/java/in/koreatech/koin/acceptance/OwnerShopApiTest.java index c08c75ed2a..9be4cd71be 100644 --- a/src/test/java/in/koreatech/koin/acceptance/OwnerShopApiTest.java +++ b/src/test/java/in/koreatech/koin/acceptance/OwnerShopApiTest.java @@ -503,7 +503,6 @@ void findOwnerShopMenu() { .when() .get("/owner/shops/menus") .then() - .log().all() .statusCode(HttpStatus.OK.value()) .extract(); @@ -980,7 +979,6 @@ void modifyManyOptionMenu() { .when() .put("/owner/shops/menus/{menuId}", createdMenu.getId()) .then() - .log().all() .statusCode(HttpStatus.CREATED.value()) .extract(); @@ -1233,7 +1231,6 @@ void ownerShopCreateEvent() { .when() .post("/owner/shops/{shopId}/event", shop.getId()) .then() - .log().all() .statusCode(HttpStatus.CREATED.value()) .extract(); diff --git a/src/test/java/in/koreatech/koin/acceptance/ShopApiTest.java b/src/test/java/in/koreatech/koin/acceptance/ShopApiTest.java index 26add1cc3f..a89b1ae91c 100644 --- a/src/test/java/in/koreatech/koin/acceptance/ShopApiTest.java +++ b/src/test/java/in/koreatech/koin/acceptance/ShopApiTest.java @@ -279,7 +279,6 @@ void findMenuMultipleOption() { .get("/shops/{shopId}/menus/{menuId}", menu.getShopId(), menu.getId()) .then() .statusCode(HttpStatus.OK.value()) - .log().all() .extract(); JsonAssertions.assertThat(response.asPrettyString()) @@ -606,7 +605,6 @@ void getShopMenus() { .get("/shops/{shopId}/menus", shop.getId()) .then() .statusCode(HttpStatus.OK.value()) - .log().all() .extract(); JsonAssertions.assertThat(response.asPrettyString()) @@ -1069,7 +1067,6 @@ void getShopWithEvents() { .when() .get("/shops/{shopId}", newShop.getId()) .then() - .log().all() .statusCode(HttpStatus.OK.value()) .extract(); diff --git a/src/main/resources/application-test.yml b/src/test/resources/application.yml similarity index 100% rename from src/main/resources/application-test.yml rename to src/test/resources/application.yml diff --git a/src/test/resources/koin-firebase-adminsdk.json b/src/test/resources/koin-firebase-adminsdk.json new file mode 100644 index 0000000000..6d48b460df --- /dev/null +++ b/src/test/resources/koin-firebase-adminsdk.json @@ -0,0 +1,13 @@ +{ + "type": "test", + "project_id": "test", + "private_key_id": "test", + "private_key": "-----test", + "client_email": "test", + "client_id": "test", + "auth_uri": "test", + "token_uri": "test", + "auth_provider_x509_cert_url": "test", + "client_x509_cert_url": "test", + "universe_domain": "testm" +}