From 1cd44082ba2b57a9bed220b5f094d145402284ee Mon Sep 17 00:00:00 2001 From: RyuKwanKon Date: Sun, 21 Jan 2024 23:18:12 +0900 Subject: [PATCH 1/5] =?UTF-8?q?[fix]=20#55=20post=20=EC=83=81=EC=84=B8=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=EC=8B=9C=20=EC=AA=BD=EC=A7=80=EB=A5=BC=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20userId=20=EC=A0=84=EB=8B=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/post/dto/response/PostDetailResponseDto.java | 2 ++ .../checkmate/domain/post/dto/support/PostDetailDto.java | 4 +++- .../domain/post/repository/PostCustomRepositoryImpl.java | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gachon/checkmate/domain/post/dto/response/PostDetailResponseDto.java b/src/main/java/org/gachon/checkmate/domain/post/dto/response/PostDetailResponseDto.java index d6148f7..4df81d9 100644 --- a/src/main/java/org/gachon/checkmate/domain/post/dto/response/PostDetailResponseDto.java +++ b/src/main/java/org/gachon/checkmate/domain/post/dto/response/PostDetailResponseDto.java @@ -6,6 +6,7 @@ @Builder public record PostDetailResponseDto( + Long memberId, String name, String major, String profile, @@ -16,6 +17,7 @@ public record PostDetailResponseDto( ) { public static PostDetailResponseDto of(PostDetailDto postDetailDto, CheckListResponseDto checkList, boolean isScrap) { return PostDetailResponseDto.builder() + .memberId(postDetailDto.memberId()) .name(postDetailDto.name()) .major(postDetailDto.major()) .profile(postDetailDto.profile()) diff --git a/src/main/java/org/gachon/checkmate/domain/post/dto/support/PostDetailDto.java b/src/main/java/org/gachon/checkmate/domain/post/dto/support/PostDetailDto.java index 8425796..c4f5086 100644 --- a/src/main/java/org/gachon/checkmate/domain/post/dto/support/PostDetailDto.java +++ b/src/main/java/org/gachon/checkmate/domain/post/dto/support/PostDetailDto.java @@ -7,6 +7,7 @@ import org.gachon.checkmate.domain.member.entity.ProfileImageType; public record PostDetailDto( + Long memberId, String major, MbtiType mbti, GenderType gender, @@ -15,7 +16,8 @@ public record PostDetailDto( PostCheckList postCheckList ) { @QueryProjection - public PostDetailDto(String major, MbtiType mbti, GenderType gender, String name, String profile, PostCheckList postCheckList) { + public PostDetailDto(Long memberId, String major, MbtiType mbti, GenderType gender, String name, String profile, PostCheckList postCheckList) { + this.memberId = memberId; this.major = major; this.mbti = mbti; this.gender = gender; diff --git a/src/main/java/org/gachon/checkmate/domain/post/repository/PostCustomRepositoryImpl.java b/src/main/java/org/gachon/checkmate/domain/post/repository/PostCustomRepositoryImpl.java index dc99cd9..5220732 100644 --- a/src/main/java/org/gachon/checkmate/domain/post/repository/PostCustomRepositoryImpl.java +++ b/src/main/java/org/gachon/checkmate/domain/post/repository/PostCustomRepositoryImpl.java @@ -28,6 +28,7 @@ public class PostCustomRepositoryImpl implements PostCustomRepository { public Optional findPostDetail(Long postId) { return Optional.ofNullable(queryFactory .select(new QPostDetailDto( + user.id, user.major, user.mbtiType, user.gender, From 6a1907bc21ce5ca6fbbaa2f9ddc2330865b954ca Mon Sep 17 00:00:00 2001 From: RyuKwanKon Date: Sun, 21 Jan 2024 23:47:32 +0900 Subject: [PATCH 2/5] =?UTF-8?q?[fix]=20#55=20=EA=B2=8C=EC=8B=9C=EA=B8=80?= =?UTF-8?q?=EC=97=90=20=EA=B8=B0=EC=88=99=EC=82=AC=20=EC=9C=A0=ED=98=95=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/post/controller/PostController.java | 7 ++++--- .../post/converter/DormitoryTypeConverter.java | 13 +++++++++++++ .../post/dto/request/PostCreateRequestDto.java | 4 +++- .../post/dto/request/PostUpdateRequestDto.java | 4 +++- .../post/dto/support/PostSearchCondition.java | 5 ++++- .../domain/post/entity/DormitoryType.java | 17 +++++++++++++++++ .../checkmate/domain/post/entity/Post.java | 9 +++++---- .../repository/PostCustomRepositoryImpl.java | 7 +++++++ .../domain/post/service/PostService.java | 4 ++-- .../checkmate/global/error/ErrorCode.java | 1 + 10 files changed, 59 insertions(+), 12 deletions(-) create mode 100644 src/main/java/org/gachon/checkmate/domain/post/converter/DormitoryTypeConverter.java create mode 100644 src/main/java/org/gachon/checkmate/domain/post/entity/DormitoryType.java diff --git a/src/main/java/org/gachon/checkmate/domain/post/controller/PostController.java b/src/main/java/org/gachon/checkmate/domain/post/controller/PostController.java index 148816f..2e0a794 100644 --- a/src/main/java/org/gachon/checkmate/domain/post/controller/PostController.java +++ b/src/main/java/org/gachon/checkmate/domain/post/controller/PostController.java @@ -24,11 +24,12 @@ public class PostController { @GetMapping public ResponseEntity> getAllPosts(@UserId final Long userId, - @RequestParam(required = false) final String key, @RequestParam final String type, + @RequestParam(required = false) final String key, @RequestParam(required = false) final String gender, + @RequestParam(required = false) final String dormitory, final Pageable pageable) { - final PostSearchResponseDto responseDto = postService.getAllPosts(userId, key, type, gender, pageable); + final PostSearchResponseDto responseDto = postService.getAllPosts(userId, key, type, gender, dormitory, pageable); return SuccessResponse.ok(responseDto); } @@ -54,7 +55,7 @@ public ResponseEntity> getMyPosts(@UserId final Long userId, return SuccessResponse.ok(responseDto); } - @PatchMapping("{id}") + @PatchMapping("/{id}") public ResponseEntity> updateMyPost(@UserId final Long userId, @PathVariable("id") final Long postId, @RequestBody @Valid final PostUpdateRequestDto requestDto) { diff --git a/src/main/java/org/gachon/checkmate/domain/post/converter/DormitoryTypeConverter.java b/src/main/java/org/gachon/checkmate/domain/post/converter/DormitoryTypeConverter.java new file mode 100644 index 0000000..83586c7 --- /dev/null +++ b/src/main/java/org/gachon/checkmate/domain/post/converter/DormitoryTypeConverter.java @@ -0,0 +1,13 @@ +package org.gachon.checkmate.domain.post.converter; + +import jakarta.persistence.Converter; +import org.gachon.checkmate.domain.post.entity.DormitoryType; +import org.gachon.checkmate.global.utils.AbstractEnumCodeAttributeConverter; + +@Converter +public class DormitoryTypeConverter extends AbstractEnumCodeAttributeConverter { + public DormitoryTypeConverter() { + super(DormitoryType.class); + } +} + diff --git a/src/main/java/org/gachon/checkmate/domain/post/dto/request/PostCreateRequestDto.java b/src/main/java/org/gachon/checkmate/domain/post/dto/request/PostCreateRequestDto.java index 8f0d5e3..26d63de 100644 --- a/src/main/java/org/gachon/checkmate/domain/post/dto/request/PostCreateRequestDto.java +++ b/src/main/java/org/gachon/checkmate/domain/post/dto/request/PostCreateRequestDto.java @@ -5,6 +5,7 @@ import lombok.NonNull; import org.gachon.checkmate.domain.checkList.dto.request.CheckListRequestDto; +import org.gachon.checkmate.domain.post.entity.DormitoryType; import org.gachon.checkmate.domain.post.entity.ImportantKeyType; import org.gachon.checkmate.domain.post.entity.RoomType; import org.gachon.checkmate.domain.post.entity.SimilarityKeyType; @@ -16,7 +17,8 @@ public record PostCreateRequestDto( @NotBlank(message = "내용을 입력해주세요") String content, @NotNull(message = "중요 키워드를 입력해주세요") ImportantKeyType importantKey, @NotNull(message = "유사도를 입력해주세요") SimilarityKeyType similarityKey, - @NotNull(message = "기숙사 유형을 입력해주세요") RoomType roomType, + @NotNull(message = "호실을 입력해주세요") RoomType roomType, + @NotNull(message = "기숙사 유형을 입력해주세요") DormitoryType dormitoryType, @NotNull(message = "모집 마감기간을 입력해주세요") LocalDate endDate, @NotNull(message = "체크리스트를 입력해주세요") CheckListRequestDto checkList ) { diff --git a/src/main/java/org/gachon/checkmate/domain/post/dto/request/PostUpdateRequestDto.java b/src/main/java/org/gachon/checkmate/domain/post/dto/request/PostUpdateRequestDto.java index dbfb18d..700dbc4 100644 --- a/src/main/java/org/gachon/checkmate/domain/post/dto/request/PostUpdateRequestDto.java +++ b/src/main/java/org/gachon/checkmate/domain/post/dto/request/PostUpdateRequestDto.java @@ -3,6 +3,7 @@ import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import org.gachon.checkmate.domain.checkList.dto.request.CheckListRequestDto; +import org.gachon.checkmate.domain.post.entity.DormitoryType; import org.gachon.checkmate.domain.post.entity.ImportantKeyType; import org.gachon.checkmate.domain.post.entity.RoomType; import org.gachon.checkmate.domain.post.entity.SimilarityKeyType; @@ -14,7 +15,8 @@ public record PostUpdateRequestDto( @NotBlank(message = "내용을 입력해주세요") String content, @NotNull(message = "중요 키워드를 입력해주세요") ImportantKeyType importantKey, @NotNull(message = "유사도를 입력해주세요") SimilarityKeyType similarityKey, - @NotNull(message = "기숙사 유형을 입력해주세요") RoomType roomType, + @NotNull(message = "호실을 입력해주세요") RoomType roomType, + @NotNull(message = "기숙사 유형을 입력해주세요") DormitoryType dormitoryType, @NotNull(message = "모집 마감기간을 입력해주세요") LocalDate endDate, @NotNull(message = "체크리스트를 입력해주세요") CheckListRequestDto checkList ) { diff --git a/src/main/java/org/gachon/checkmate/domain/post/dto/support/PostSearchCondition.java b/src/main/java/org/gachon/checkmate/domain/post/dto/support/PostSearchCondition.java index a0de622..d7fc828 100644 --- a/src/main/java/org/gachon/checkmate/domain/post/dto/support/PostSearchCondition.java +++ b/src/main/java/org/gachon/checkmate/domain/post/dto/support/PostSearchCondition.java @@ -4,6 +4,7 @@ import lombok.AccessLevel; import lombok.Builder; import org.gachon.checkmate.domain.member.entity.GenderType; +import org.gachon.checkmate.domain.post.entity.DormitoryType; import org.gachon.checkmate.domain.post.entity.ImportantKeyType; import org.gachon.checkmate.domain.post.utils.PostSortType; import org.springframework.data.domain.Pageable; @@ -14,14 +15,16 @@ public record PostSearchCondition( ImportantKeyType importantKeyType, GenderType genderType, + DormitoryType dormitoryType, @NotNull PostSortType postSortType, Pageable pageable ) { - public static PostSearchCondition of(@NotNull String sortType, String importantKeyType, String genderType, Pageable pageable) { + public static PostSearchCondition of(@NotNull String sortType, String importantKeyType, String genderType, String dormitoryType, Pageable pageable) { return PostSearchCondition.builder() .importantKeyType(importantKeyType != null ? toEntityCode(ImportantKeyType.class, importantKeyType) : null) .genderType(genderType != null ? toEntityCode(GenderType.class, genderType) : null) + .dormitoryType(dormitoryType != null ? toEntityCode(DormitoryType.class, dormitoryType) : null) .postSortType(toEntityCode(PostSortType.class, sortType)) .pageable(pageable) .build(); diff --git a/src/main/java/org/gachon/checkmate/domain/post/entity/DormitoryType.java b/src/main/java/org/gachon/checkmate/domain/post/entity/DormitoryType.java new file mode 100644 index 0000000..4d193a5 --- /dev/null +++ b/src/main/java/org/gachon/checkmate/domain/post/entity/DormitoryType.java @@ -0,0 +1,17 @@ +package org.gachon.checkmate.domain.post.entity; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.gachon.checkmate.global.utils.EnumField; + +@AllArgsConstructor(access = AccessLevel.PRIVATE) +@Getter +public enum DormitoryType implements EnumField { + FIRST("1", "1기숙사"), + SECOND("2", "2기숙사"), + THIRD("3", "3기숙사"); + + private final String code; + private final String desc; +} diff --git a/src/main/java/org/gachon/checkmate/domain/post/entity/Post.java b/src/main/java/org/gachon/checkmate/domain/post/entity/Post.java index 68c6e29..b7a85a2 100644 --- a/src/main/java/org/gachon/checkmate/domain/post/entity/Post.java +++ b/src/main/java/org/gachon/checkmate/domain/post/entity/Post.java @@ -4,10 +4,7 @@ import lombok.*; import org.gachon.checkmate.domain.checkList.entity.PostCheckList; import org.gachon.checkmate.domain.member.entity.User; -import org.gachon.checkmate.domain.post.converter.ImportantKeyTypeConverter; -import org.gachon.checkmate.domain.post.converter.PostStateConverter; -import org.gachon.checkmate.domain.post.converter.RoomTypeConverter; -import org.gachon.checkmate.domain.post.converter.SimilarityKeyTypeConverter; +import org.gachon.checkmate.domain.post.converter.*; import org.gachon.checkmate.domain.post.dto.request.PostCreateRequestDto; import org.gachon.checkmate.domain.post.dto.request.PostStateUpdateRequestDto; import org.gachon.checkmate.domain.post.dto.request.PostUpdateRequestDto; @@ -35,6 +32,8 @@ public class Post extends BaseTimeEntity { private PostState postState; @Convert(converter = RoomTypeConverter.class) private RoomType roomType; + @Convert(converter = DormitoryTypeConverter.class) + private DormitoryType dormitoryType; @Convert(converter = ImportantKeyTypeConverter.class) private ImportantKeyType importantKeyType; @Convert(converter = SimilarityKeyTypeConverter.class) @@ -55,6 +54,7 @@ public static Post createPost(PostCreateRequestDto postCreateRequestDto, User us .endDate(postCreateRequestDto.endDate()) .postState(PostState.RECRUITING) .roomType(postCreateRequestDto.roomType()) + .dormitoryType(postCreateRequestDto.dormitoryType()) .importantKeyType(postCreateRequestDto.importantKey()) .similarityKeyType(postCreateRequestDto.similarityKey()) .user(user) @@ -77,6 +77,7 @@ public void updatePost(PostUpdateRequestDto postUpdateRequestDto) { this.importantKeyType = postUpdateRequestDto.importantKey(); this.similarityKeyType = postUpdateRequestDto.similarityKey(); this.roomType = postUpdateRequestDto.roomType(); + this.dormitoryType = postUpdateRequestDto.dormitoryType(); this.endDate = postUpdateRequestDto.endDate(); this.postCheckList.updatePostCheckList(postUpdateRequestDto.checkList()); } diff --git a/src/main/java/org/gachon/checkmate/domain/post/repository/PostCustomRepositoryImpl.java b/src/main/java/org/gachon/checkmate/domain/post/repository/PostCustomRepositoryImpl.java index 5220732..d182b2b 100644 --- a/src/main/java/org/gachon/checkmate/domain/post/repository/PostCustomRepositoryImpl.java +++ b/src/main/java/org/gachon/checkmate/domain/post/repository/PostCustomRepositoryImpl.java @@ -7,6 +7,7 @@ import org.gachon.checkmate.domain.member.entity.GenderType; import org.gachon.checkmate.domain.member.entity.UserState; import org.gachon.checkmate.domain.post.dto.support.*; +import org.gachon.checkmate.domain.post.entity.DormitoryType; import org.gachon.checkmate.domain.post.entity.ImportantKeyType; import org.gachon.checkmate.domain.post.entity.Post; import org.springframework.data.domain.Page; @@ -67,6 +68,7 @@ public Page searchPosts(PostSearchCondition condition) { .where( eqImportantKey(condition.importantKeyType()), eqGenderType(condition.genderType()), + eqDormitoryType(condition.dormitoryType()), validateUserState() ) .orderBy(post.id.desc()) @@ -79,6 +81,7 @@ public Page searchPosts(PostSearchCondition condition) { .where( eqImportantKey(condition.importantKeyType()), eqGenderType(condition.genderType()), + eqDormitoryType(condition.dormitoryType()), validateUserState() ); return PageableExecutionUtils.getPage(content, condition.pageable(), countQuery::fetchCount); @@ -137,6 +140,10 @@ private BooleanExpression eqGenderType(GenderType genderType) { return genderType != null ? user.gender.eq(genderType) : null; } + private BooleanExpression eqDormitoryType(DormitoryType dormitoryType) { + return dormitoryType != null ? post.dormitoryType.eq(dormitoryType) : null; + } + private BooleanExpression eqImportantKey(ImportantKeyType importantKeyType) { return importantKeyType != null ? post.importantKeyType.eq(importantKeyType) : null; } diff --git a/src/main/java/org/gachon/checkmate/domain/post/service/PostService.java b/src/main/java/org/gachon/checkmate/domain/post/service/PostService.java index b6b132c..b010de9 100644 --- a/src/main/java/org/gachon/checkmate/domain/post/service/PostService.java +++ b/src/main/java/org/gachon/checkmate/domain/post/service/PostService.java @@ -65,9 +65,9 @@ public PostSearchResponseDto getMyPosts(Long userId, Pageable pageable) { return PostSearchResponseDto.of(searchResults, postSearchList.getTotalPages(), postSearchList.getTotalElements()); } - public PostSearchResponseDto getAllPosts(Long userId, String key, String type, String gender, Pageable pageable) { + public PostSearchResponseDto getAllPosts(Long userId, String key, String type, String gender, String dormitory, Pageable pageable) { CheckList checkList = getCheckList(userId); - PostSearchCondition condition = PostSearchCondition.of(type, key, gender, pageable); + PostSearchCondition condition = PostSearchCondition.of(type, key, gender, dormitory, pageable); Page postSearchList = getSearchResults(condition); List searchResults = createPostSearchResponseDto(postSearchList, checkList); PostSortingUtils.sortByTypeForSearchResults(searchResults, condition.postSortType()); diff --git a/src/main/java/org/gachon/checkmate/global/error/ErrorCode.java b/src/main/java/org/gachon/checkmate/global/error/ErrorCode.java index c3ae8f3..124cdd0 100644 --- a/src/main/java/org/gachon/checkmate/global/error/ErrorCode.java +++ b/src/main/java/org/gachon/checkmate/global/error/ErrorCode.java @@ -48,6 +48,7 @@ public enum ErrorCode { CHATROOM_NOT_FOUND(HttpStatus.NOT_FOUND, "해당하는 채팅방을 찾을 수 없습니다."), REFRESH_TOKEN_NOT_FOUND(HttpStatus.NOT_FOUND, "해당하는 리프레시 토큰을 찾을 수 없습니다. 다시 로그인해 주세요."), UNAFFILIATED_EMAIL(HttpStatus.CONFLICT, "가입되지 않은 이메일입니다."), + POST_LIST_NOT_FOUND(HttpStatus.NOT_FOUND, "필터에 해당한 게시글들을 찾을 수 없습니다."), /** * 405 Method Not Allowed From a68e2ade6953cd894d28dc7b6a0d50dd0d21f547 Mon Sep 17 00:00:00 2001 From: RyuKwanKon Date: Sun, 21 Jan 2024 23:50:57 +0900 Subject: [PATCH 3/5] =?UTF-8?q?[fix]=20#55=20=ED=95=84=ED=84=B0=EC=97=90?= =?UTF-8?q?=20=ED=95=B4=EB=8B=B9=ED=95=98=EB=8A=94=20=EA=B2=8C=EC=8B=9C?= =?UTF-8?q?=EA=B8=80=EC=9D=B4=20=EC=97=86=EC=9D=84=20=EA=B2=BD=EC=9A=B0=20?= =?UTF-8?q?=EC=98=88=EC=99=B8=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../checkmate/global/utils/PagingUtils.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/gachon/checkmate/global/utils/PagingUtils.java b/src/main/java/org/gachon/checkmate/global/utils/PagingUtils.java index 34458b5..29403fa 100644 --- a/src/main/java/org/gachon/checkmate/global/utils/PagingUtils.java +++ b/src/main/java/org/gachon/checkmate/global/utils/PagingUtils.java @@ -2,19 +2,31 @@ import lombok.AccessLevel; import lombok.NoArgsConstructor; +import org.gachon.checkmate.global.error.exception.EntityNotFoundException; import org.gachon.checkmate.global.error.exception.InvalidValueException; import java.util.List; import static org.gachon.checkmate.global.error.ErrorCode.INVALID_PAGING_SIZE; +import static org.gachon.checkmate.global.error.ErrorCode.POST_LIST_NOT_FOUND; @NoArgsConstructor(access = AccessLevel.PRIVATE) public class PagingUtils { public static List convertPaging(List dataList, long offset, int size) { - if (dataList.size() <= offset) - throw new InvalidValueException(INVALID_PAGING_SIZE); + validFilterResult(dataList); + validOffsetSize(dataList, offset); int startIndex = (int) offset; int endIndex = Math.min(dataList.size(), startIndex + size); return dataList.subList(startIndex, endIndex); } + + private static void validFilterResult(List dataList) { + if (dataList.size() == 0) + throw new EntityNotFoundException(POST_LIST_NOT_FOUND); + } + + private static void validOffsetSize(List dataList, long offset){ + if (dataList.size() <= offset) + throw new InvalidValueException(INVALID_PAGING_SIZE); + } } From 7d3469d8946ff02a6588e8714ecc80fb618f6aa8 Mon Sep 17 00:00:00 2001 From: RyuKwanKon Date: Sun, 21 Jan 2024 23:58:30 +0900 Subject: [PATCH 4/5] =?UTF-8?q?[fix]=20#55=20=ED=95=84=ED=84=B0=20?= =?UTF-8?q?=EA=B2=B0=EA=B3=BC=EA=B0=80=20=EC=97=86=EC=9D=84=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=20=EC=98=88=EC=99=B8=20=EC=BD=94=EB=93=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/gachon/checkmate/global/error/ErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/gachon/checkmate/global/error/ErrorCode.java b/src/main/java/org/gachon/checkmate/global/error/ErrorCode.java index 124cdd0..e41b40b 100644 --- a/src/main/java/org/gachon/checkmate/global/error/ErrorCode.java +++ b/src/main/java/org/gachon/checkmate/global/error/ErrorCode.java @@ -48,7 +48,6 @@ public enum ErrorCode { CHATROOM_NOT_FOUND(HttpStatus.NOT_FOUND, "해당하는 채팅방을 찾을 수 없습니다."), REFRESH_TOKEN_NOT_FOUND(HttpStatus.NOT_FOUND, "해당하는 리프레시 토큰을 찾을 수 없습니다. 다시 로그인해 주세요."), UNAFFILIATED_EMAIL(HttpStatus.CONFLICT, "가입되지 않은 이메일입니다."), - POST_LIST_NOT_FOUND(HttpStatus.NOT_FOUND, "필터에 해당한 게시글들을 찾을 수 없습니다."), /** * 405 Method Not Allowed @@ -63,6 +62,7 @@ public enum ErrorCode { DUPLICATE_CHECK_LIST(HttpStatus.CONFLICT, "체크리스트가 이미 존재합니다."), DUPLICATE_POST_REPORT(HttpStatus.CONFLICT, "이전에 신고했던 게시물입니다."), DUPLICATE_CHATROOM_REPORT(HttpStatus.CONFLICT, "이전에 신고했던 채팅방입니다."), + POST_LIST_NOT_FOUND(HttpStatus.CONFLICT, "필터에 해당한 게시글들을 찾을 수 없습니다."), /** * 500 Internal Server Error From 20fb53be0dc5b55316ee2a4f7df5697527620e45 Mon Sep 17 00:00:00 2001 From: RyuKwanKon Date: Mon, 22 Jan 2024 00:05:27 +0900 Subject: [PATCH 5/5] =?UTF-8?q?[fix]=20#55=20=EB=A1=9C=EA=B7=B8=EC=9D=B8?= =?UTF-8?q?=EC=8B=9C=20=EC=84=B1=EB=B3=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/dto/response/MemberSignInResponseDto.java | 4 ++++ .../gachon/checkmate/domain/member/service/MemberService.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gachon/checkmate/domain/member/dto/response/MemberSignInResponseDto.java b/src/main/java/org/gachon/checkmate/domain/member/dto/response/MemberSignInResponseDto.java index b594764..f62157e 100644 --- a/src/main/java/org/gachon/checkmate/domain/member/dto/response/MemberSignInResponseDto.java +++ b/src/main/java/org/gachon/checkmate/domain/member/dto/response/MemberSignInResponseDto.java @@ -1,18 +1,22 @@ package org.gachon.checkmate.domain.member.dto.response; import lombok.Builder; +import org.gachon.checkmate.domain.member.entity.GenderType; @Builder public record MemberSignInResponseDto( Long memberId, + String gender, String accessToken, String refreshToken ) { public static MemberSignInResponseDto of(Long memberId, + GenderType genderType, String accessToken, String refreshToken) { return MemberSignInResponseDto.builder() .memberId(memberId) + .gender(genderType.getDesc()) .accessToken(accessToken) .refreshToken(refreshToken) .build(); diff --git a/src/main/java/org/gachon/checkmate/domain/member/service/MemberService.java b/src/main/java/org/gachon/checkmate/domain/member/service/MemberService.java index f8e70e3..7193a98 100644 --- a/src/main/java/org/gachon/checkmate/domain/member/service/MemberService.java +++ b/src/main/java/org/gachon/checkmate/domain/member/service/MemberService.java @@ -66,7 +66,7 @@ public MemberSignInResponseDto signIn(MemberSignInRequestDto memberSignInRequest String accessToken = issueNewAccessToken(user.getId()); String refreshToken = issueNewRefreshToken(user.getId()); saveTokenInfo(user.getId(), refreshToken); - return MemberSignInResponseDto.of(user.getId(), accessToken, refreshToken); + return MemberSignInResponseDto.of(user.getId(), user.getGender(), accessToken, refreshToken); } public void withdraw(Long userId) {