From 4e7539096dcab3e3fed74000f81b70d3457fe302 Mon Sep 17 00:00:00 2001 From: jwpark1211 <1211abc@naver.com> Date: Thu, 16 May 2024 22:33:59 +0900 Subject: [PATCH 1/2] fix : dto name fix for swagger --- .../controller/BookStateController.java | 10 +++++----- .../domain/controller/CommentController.java | 12 +++++------ .../domain/controller/MemberController.java | 8 ++++---- .../domain/controller/StarController.java | 12 +++++------ .../bookitty/domain/dto/BookStateDTO.java | 10 +++++----- .../bookitty/domain/dto/CommentDTO.java | 10 +++++----- .../bookitty/domain/dto/MemberDTO.java | 14 ++++++------- .../capstone/bookitty/domain/dto/StarDTO.java | 10 +++++----- .../domain/service/BookStateService.java | 19 ++++++++---------- .../domain/service/CommentService.java | 20 +++++++++---------- .../domain/service/MemberService.java | 14 ++++++------- .../bookitty/domain/service/StarService.java | 20 +++++++++---------- 12 files changed, 77 insertions(+), 82 deletions(-) diff --git a/src/main/java/capstone/bookitty/domain/controller/BookStateController.java b/src/main/java/capstone/bookitty/domain/controller/BookStateController.java index 7bcb11b..551ea5a 100644 --- a/src/main/java/capstone/bookitty/domain/controller/BookStateController.java +++ b/src/main/java/capstone/bookitty/domain/controller/BookStateController.java @@ -29,7 +29,7 @@ public class BookStateController { @Operation(summary = "책 상태 생성") @PostMapping(path = "/new") public ResponseEntity saveBookState( - @RequestBody @Valid SaveRequest request + @RequestBody @Valid StateSaveRequest request ){ return ResponseEntity.ok() .body(new ResponseCounter( @@ -44,7 +44,7 @@ public ResponseEntity getStateByISBN( @PageableDefault(sort = "id", size=10) Pageable pageable ){ return ResponseEntity.ok() - .body(new ResponseCounter>( + .body(new ResponseCounter>( bookStateService.findStateByISBN(isbn, pageable))); } @@ -54,7 +54,7 @@ public ResponseEntity getStateById( @PathVariable("state-id") Long stateId ){ return ResponseEntity.ok() - .body(new ResponseCounter( + .body(new ResponseCounter( bookStateService.findStateByStateId(stateId))); } @@ -66,7 +66,7 @@ public ResponseEntity getStateByMemberId( @PageableDefault(sort = "id", size=10) Pageable pageable ){ return ResponseEntity.ok() - .body(new ResponseCounter>( + .body(new ResponseCounter>( bookStateService.findStateByMemberId(memberId,pageable))); } @@ -74,7 +74,7 @@ public ResponseEntity getStateByMemberId( @PatchMapping(path = "/{state-id}") public ResponseEntity updateState( @PathVariable("state-id") Long stateId, - @RequestBody @Valid UpdateRequest request + @RequestBody @Valid StateUpdateRequest request ){ bookStateService.updateState(stateId, request); return ResponseEntity.ok() diff --git a/src/main/java/capstone/bookitty/domain/controller/CommentController.java b/src/main/java/capstone/bookitty/domain/controller/CommentController.java index 548d779..e60bfa5 100644 --- a/src/main/java/capstone/bookitty/domain/controller/CommentController.java +++ b/src/main/java/capstone/bookitty/domain/controller/CommentController.java @@ -28,7 +28,7 @@ public class CommentController { @Operation(summary = "코멘트 생성") @PostMapping(path = "/new") public ResponseEntity saveComment( - @RequestBody @Valid SaveRequest request + @RequestBody @Valid CommentSaveRequest request ){ return ResponseEntity.ok() .body(new ResponseCounter( @@ -41,7 +41,7 @@ public ResponseEntity getCommentById( @PathVariable("comment-id") Long commentId ){ return ResponseEntity.ok() - .body(new ResponseCounter( + .body(new ResponseCounter( commentService.findCommentByCommentId(commentId))); } @@ -52,7 +52,7 @@ public ResponseEntity getAll( @PageableDefault(size = 10, sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable ){ return ResponseEntity.ok() - .body(new ResponseCounter>( + .body(new ResponseCounter>( commentService.findAllComment(pageable))); } @@ -64,7 +64,7 @@ public ResponseEntity getCommentByISBN( @PageableDefault(size = 10, sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable ){ return ResponseEntity.ok() - .body(new ResponseCounter>( + .body(new ResponseCounter>( commentService.findCommentByIsbn(isbn, pageable))); } @@ -76,7 +76,7 @@ public ResponseEntity getCommentByMemberId( @PageableDefault(size = 10, sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable ){ return ResponseEntity.ok() - .body(new ResponseCounter>( + .body(new ResponseCounter>( commentService.findCommentByMemberId(memberId, pageable))); } @@ -84,7 +84,7 @@ public ResponseEntity getCommentByMemberId( @PatchMapping(path = "/{comment-id}") public ResponseEntity updateComment( @PathVariable("comment-id") Long commentId, - @RequestBody @Valid UpdateRequest request + @RequestBody @Valid CommentUpdateRequest request ){ commentService.updateComment(commentId, request); return ResponseEntity.ok() diff --git a/src/main/java/capstone/bookitty/domain/controller/MemberController.java b/src/main/java/capstone/bookitty/domain/controller/MemberController.java index 9757184..f0a0048 100644 --- a/src/main/java/capstone/bookitty/domain/controller/MemberController.java +++ b/src/main/java/capstone/bookitty/domain/controller/MemberController.java @@ -33,7 +33,7 @@ public String test(){ @Operation(summary = "회원가입") @PostMapping(path = "/new") public ResponseEntity save( - @RequestBody @Valid SaveRequest request){ + @RequestBody @Valid MemberSaveRequest request){ return ResponseEntity.ok() .body(new ResponseCounter( memberService.saveMember(request))); @@ -52,7 +52,7 @@ public ResponseEntity isEmailUnique( @Operation(summary = "로그인") @PostMapping(path = "/login") public ResponseEntity login( - @RequestBody @Valid LoginRequest request + @RequestBody @Valid MemberLoginRequest request ){ memberService.login(request); return ResponseEntity.ok() @@ -65,7 +65,7 @@ public ResponseEntity findOneMember( @PathVariable("id") Long memberId ){ return ResponseEntity.ok( - new ResponseCounter( + new ResponseCounter( memberService.getMemberInfoWithId(memberId))); } @@ -76,7 +76,7 @@ public ResponseEntity findAllMembers( @PageableDefault(sort="id",size = 10) Pageable pageable ){ return ResponseEntity.ok( - new ResponseCounter>( + new ResponseCounter>( memberService.getAllMemberInfo(pageable))); } diff --git a/src/main/java/capstone/bookitty/domain/controller/StarController.java b/src/main/java/capstone/bookitty/domain/controller/StarController.java index 008314c..2c52c99 100644 --- a/src/main/java/capstone/bookitty/domain/controller/StarController.java +++ b/src/main/java/capstone/bookitty/domain/controller/StarController.java @@ -28,7 +28,7 @@ public class StarController { @Operation(summary = "평점 생성[평점은 0.5부터 5까지 0.5단위로 증가합니다.") @PostMapping(path = "/new") public ResponseEntity saveStar( - @RequestBody @Valid SaveRequest request + @RequestBody @Valid StarSaveRequest request ){ return ResponseEntity.ok() .body(new ResponseCounter( @@ -41,7 +41,7 @@ public ResponseEntity getStarById( @PathVariable("star-id") Long starId ){ return ResponseEntity.ok() - .body(new ResponseCounter( + .body(new ResponseCounter( starService.findStarByStarId(starId))); } @@ -53,7 +53,7 @@ public ResponseEntity getAllStar( @PageableDefault(size = 10, sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable ){ return ResponseEntity.ok() - .body(new ResponseCounter>( + .body(new ResponseCounter>( starService.findAllStar(pageable))); } @@ -65,7 +65,7 @@ public ResponseEntity getStarByISBN( @PageableDefault(size = 10, sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable ){ return ResponseEntity.ok() - .body(new ResponseCounter>( + .body(new ResponseCounter>( starService.findStarByISBN(isbn,pageable))); } @@ -77,7 +77,7 @@ public ResponseEntity getStarByMemberId( @PageableDefault(sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable ){ return ResponseEntity.ok() - .body(new ResponseCounter>( + .body(new ResponseCounter>( starService.findStarByMemberId(memberId,pageable))); } @@ -85,7 +85,7 @@ public ResponseEntity getStarByMemberId( @PatchMapping(path="/{star-id}") public ResponseEntity updateStar( @PathVariable("star-id") Long starId, - @RequestBody @Valid UpdateRequest request + @RequestBody @Valid StarUpdateRequest request ){ starService.updateStar(starId, request); return ResponseEntity.ok() diff --git a/src/main/java/capstone/bookitty/domain/dto/BookStateDTO.java b/src/main/java/capstone/bookitty/domain/dto/BookStateDTO.java index 032b215..51cdeb4 100644 --- a/src/main/java/capstone/bookitty/domain/dto/BookStateDTO.java +++ b/src/main/java/capstone/bookitty/domain/dto/BookStateDTO.java @@ -16,7 +16,7 @@ public class BookStateDTO { @Data - public static class SaveRequest { + public static class StateSaveRequest { @NotBlank(message = "ISBN is a requred entry value.") private String isbn; @NotNull(message = "memberId is a required entry value.") @@ -30,7 +30,7 @@ public static class SaveRequest { } @Data - public static class UpdateRequest{ + public static class StateUpdateRequest{ @ValidEnum(enumClass = State.class, message = "State is not valid.") private State state; } @@ -48,7 +48,7 @@ public static IdResponse of (BookState bookState){ @Getter @AllArgsConstructor @NoArgsConstructor - public static class InfoResponse{ + public static class StateInfoResponse{ private Long id; private Long memberId; private String isbn; @@ -60,8 +60,8 @@ public static class InfoResponse{ @DateTimeFormat(pattern = "yyyy-mm-dd'T'HH:mm:ss") private LocalDateTime readAt; - public static InfoResponse of(BookState state){ - return new InfoResponse(state.getId(), state.getMember().getId(), state.getIsbn(), + public static StateInfoResponse of(BookState state){ + return new StateInfoResponse(state.getId(), state.getMember().getId(), state.getIsbn(), state.getState(),state.getCategoryName(),state.getBookTitle(),state.getBookAuthor(), state.getBookImgUrl(),state.getReadAt()); } diff --git a/src/main/java/capstone/bookitty/domain/dto/CommentDTO.java b/src/main/java/capstone/bookitty/domain/dto/CommentDTO.java index 78c839e..ffd69ec 100644 --- a/src/main/java/capstone/bookitty/domain/dto/CommentDTO.java +++ b/src/main/java/capstone/bookitty/domain/dto/CommentDTO.java @@ -16,7 +16,7 @@ public class CommentDTO { @Data - public static class SaveRequest{ + public static class CommentSaveRequest{ @NotBlank(message = "Isbn is a required entry value.") private String isbn; @NotNull(message = "memberId is a required entry value.") @@ -27,7 +27,7 @@ public static class SaveRequest{ } @Data - public static class UpdateRequest{ + public static class CommentUpdateRequest{ @NotEmpty(message = "content is a required entry value.") @Size(min = 1, max = 100, message = "Name must be between 1 and 100 characters") private String content; @@ -46,7 +46,7 @@ public static IdResponse of(Comment comment){ @Getter @AllArgsConstructor @NoArgsConstructor - public static class InfoResponse{ + public static class CommentInfoResponse{ private Long id; private Long memberId; private String isbn; @@ -57,8 +57,8 @@ public static class InfoResponse{ @DateTimeFormat(pattern = "yyyy-mm-dd'T'HH:mm:ss") private LocalDateTime modifiedAt; - public static InfoResponse of(Comment comment, int like_count){ - return new InfoResponse(comment.getId(), comment.getMember().getId(),comment.getIsbn(), + public static CommentInfoResponse of(Comment comment, int like_count){ + return new CommentInfoResponse(comment.getId(), comment.getMember().getId(),comment.getIsbn(), comment.getContent(), like_count ,comment.getCreatedAt(), comment.getModifiedAt()); } diff --git a/src/main/java/capstone/bookitty/domain/dto/MemberDTO.java b/src/main/java/capstone/bookitty/domain/dto/MemberDTO.java index 733bff9..800e1c6 100644 --- a/src/main/java/capstone/bookitty/domain/dto/MemberDTO.java +++ b/src/main/java/capstone/bookitty/domain/dto/MemberDTO.java @@ -17,7 +17,7 @@ public class MemberDTO { @Data - public static class SaveRequest { + public static class MemberSaveRequest { @NotBlank(message = "Email is a required entry value.") @Email(message = "Email format is not valid.") private String email; @@ -26,7 +26,7 @@ public static class SaveRequest { message = "비밀번호는 영문 대,소문자와 숫자, 특수기호가 적어도 1개 이상씩 포함된 8자 ~ 20자의 비밀번호여야 합니다.") private String password; @ValidEnum(enumClass = Gender.class, message = "Invalid gender") - private Gender gender; + private Gender gender; //FEMALE 혹은 MALE @DateTimeFormat(pattern = "yyyy-mm-dd") private LocalDate birthdate; @NotBlank(message = "name is a required entry value.") @@ -34,7 +34,7 @@ public static class SaveRequest { } @Data - public static class LoginRequest { + public static class MemberLoginRequest { @NotBlank(message = "Email is a required entry value.") @Email(message = "Email format is not valid.") private String email; @@ -56,13 +56,13 @@ public static IdResponse of (Member member){ @AllArgsConstructor @NoArgsConstructor public static class BoolResponse{ - private boolean isUnique; + private boolean unique; } @Getter @AllArgsConstructor @NoArgsConstructor - public static class InfoResponse{ + public static class MemberInfoResponse{ private Long id; private String email; private String profileImg; @@ -71,8 +71,8 @@ public static class InfoResponse{ @DateTimeFormat(pattern="yyyy-mm-dd") private LocalDate birthDate; - public static InfoResponse of(Member member){ - return new InfoResponse(member.getId(), member.getEmail(), member.getProfileImg(), + public static MemberInfoResponse of(Member member){ + return new MemberInfoResponse(member.getId(), member.getEmail(), member.getProfileImg(), member.getName(), member.getGender(), member.getBirthDate()); } } diff --git a/src/main/java/capstone/bookitty/domain/dto/StarDTO.java b/src/main/java/capstone/bookitty/domain/dto/StarDTO.java index 46af677..dc86be2 100644 --- a/src/main/java/capstone/bookitty/domain/dto/StarDTO.java +++ b/src/main/java/capstone/bookitty/domain/dto/StarDTO.java @@ -14,7 +14,7 @@ public class StarDTO { @Data - public static class SaveRequest{ + public static class StarSaveRequest{ @NotBlank(message = "Isbn is a required entry value.") private String isbn; @NotNull(message = "memberId is a required entry value.") @@ -24,7 +24,7 @@ public static class SaveRequest{ } @Data - public static class UpdateRequest{ + public static class StarUpdateRequest{ @NotNull(message = "score is a required entry value.") @ValidScore private double score; @@ -43,7 +43,7 @@ public static IdResponse of(Star star){ @Getter @AllArgsConstructor @NoArgsConstructor - public static class InfoResponse{ + public static class StarInfoResponse{ private Long id; private Long memberId; private String isbn; @@ -53,8 +53,8 @@ public static class InfoResponse{ @DateTimeFormat(pattern = "yyyy-mm-dd'T'HH:mm:ss") private LocalDateTime modifiedAt; - public static InfoResponse of(Star star){ - return new InfoResponse(star.getId(), star.getMember().getId(),star.getIsbn(), + public static StarInfoResponse of(Star star){ + return new StarInfoResponse(star.getId(), star.getMember().getId(),star.getIsbn(), star.getScore(),star.getCreatedAt(),star.getModifiedAt()); } } diff --git a/src/main/java/capstone/bookitty/domain/service/BookStateService.java b/src/main/java/capstone/bookitty/domain/service/BookStateService.java index bc9ea98..b08fff6 100644 --- a/src/main/java/capstone/bookitty/domain/service/BookStateService.java +++ b/src/main/java/capstone/bookitty/domain/service/BookStateService.java @@ -13,9 +13,6 @@ import org.springframework.transaction.annotation.Transactional; -import java.util.List; -import java.util.stream.Collectors; - import static capstone.bookitty.domain.dto.BookStateDTO.*; @Service @@ -27,7 +24,7 @@ public class BookStateService { private final MemberRepository memberRepository; @Transactional - public IdResponse saveState(SaveRequest request) { + public IdResponse saveState(StateSaveRequest request) { Member member = memberRepository.findById(request.getMemberId()) .orElseThrow(()->new EntityNotFoundException( @@ -52,28 +49,28 @@ public IdResponse saveState(SaveRequest request) { return new IdResponse(bookState.getId()); } - public Page findStateByISBN(String isbn, Pageable pageable) { + public Page findStateByISBN(String isbn, Pageable pageable) { return stateRepository.findByIsbn(isbn, pageable) - .map(InfoResponse::of); + .map(StateInfoResponse::of); } - public InfoResponse findStateByStateId(Long stateId) { + public StateInfoResponse findStateByStateId(Long stateId) { return stateRepository.findById(stateId) - .map(InfoResponse::of) + .map(StateInfoResponse::of) .orElseThrow(() -> new EntityNotFoundException("BookState with ID " + stateId + " not found.")); } - public Page findStateByMemberId(Long memberId, Pageable pageable) { + public Page findStateByMemberId(Long memberId, Pageable pageable) { Member member = memberRepository.findById(memberId) .orElseThrow(()->new EntityNotFoundException( "Member with ID: "+memberId+" not found.")); return stateRepository.findByMemberId(memberId,pageable) - .map(InfoResponse::of); + .map(StateInfoResponse::of); } @Transactional - public void updateState(Long stateId, UpdateRequest request) { + public void updateState(Long stateId, StateUpdateRequest request) { BookState bookState = stateRepository.findById(stateId) .orElseThrow(() -> new EntityNotFoundException("BookState not found for ID: " + stateId)); diff --git a/src/main/java/capstone/bookitty/domain/service/CommentService.java b/src/main/java/capstone/bookitty/domain/service/CommentService.java index 159c42b..5812429 100644 --- a/src/main/java/capstone/bookitty/domain/service/CommentService.java +++ b/src/main/java/capstone/bookitty/domain/service/CommentService.java @@ -25,7 +25,7 @@ public class CommentService { private final MemberRepository memberRepository; @Transactional - public IdResponse saveComment(SaveRequest request) { + public IdResponse saveComment(CommentSaveRequest request) { Member member = memberRepository.findById(request.getMemberId()) .orElseThrow(()->new EntityNotFoundException( "Member with ID "+request.getMemberId()+" not found.")); @@ -42,41 +42,41 @@ public IdResponse saveComment(SaveRequest request) { return new IdResponse(comment.getId()); } - public InfoResponse findCommentByCommentId(Long commentId) { + public CommentInfoResponse findCommentByCommentId(Long commentId) { Comment comment = commentRepository.findById(commentId) .orElseThrow(() -> new EntityNotFoundException("Comment with ID " + commentId + " not found.")); int like_count = likeRepository.findByCommentId(commentId).size(); - return InfoResponse.of(comment, like_count); + return CommentInfoResponse.of(comment, like_count); } - public Page findAllComment(Pageable pageable) { + public Page findAllComment(Pageable pageable) { return commentRepository.findAll(pageable) .map(comment -> { int like_count = likeRepository.findByCommentId(comment.getId()).size(); - return InfoResponse.of(comment,like_count); + return CommentInfoResponse.of(comment,like_count); }); } - public Page findCommentByIsbn(String isbn, Pageable pageable) { + public Page findCommentByIsbn(String isbn, Pageable pageable) { return commentRepository.findByIsbn(isbn,pageable) .map(comment -> { int like_count = likeRepository.findByCommentId(comment.getId()).size(); - return InfoResponse.of(comment,like_count); + return CommentInfoResponse.of(comment,like_count); }); } - public Page findCommentByMemberId(Long memberId, Pageable pageable) { + public Page findCommentByMemberId(Long memberId, Pageable pageable) { Member member = memberRepository.findById(memberId) .orElseThrow(()->new EntityNotFoundException("Member with ID "+memberId+" not found.")); return commentRepository.findByMemberId(memberId,pageable) .map(comment -> { int like_count = likeRepository.findByCommentId(comment.getId()).size(); - return InfoResponse.of(comment,like_count); + return CommentInfoResponse.of(comment,like_count); }); } @Transactional - public void updateComment(Long commentId, UpdateRequest request) { + public void updateComment(Long commentId, CommentUpdateRequest request) { Comment comment = commentRepository.findById(commentId) .orElseThrow(() -> new EntityNotFoundException("Comment with ID " + commentId + " not found.")); comment.updateContent(request.getContent()); diff --git a/src/main/java/capstone/bookitty/domain/service/MemberService.java b/src/main/java/capstone/bookitty/domain/service/MemberService.java index b8ef70f..017b0fb 100644 --- a/src/main/java/capstone/bookitty/domain/service/MemberService.java +++ b/src/main/java/capstone/bookitty/domain/service/MemberService.java @@ -9,8 +9,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.List; -import java.util.stream.Collectors; import static capstone.bookitty.domain.dto.MemberDTO.*; @@ -21,7 +19,7 @@ public class MemberService { private final MemberRepository memberRepository; @Transactional - public IdResponse saveMember(SaveRequest request) { + public IdResponse saveMember(MemberSaveRequest request) { if(memberRepository.existsByEmail(request.getEmail())) throw new IllegalArgumentException("Email already in use."); @@ -42,22 +40,22 @@ public BoolResponse isEmailUnique(String email) { } @Transactional - public void login(LoginRequest request) { + public void login(MemberLoginRequest request) { Member member = memberRepository.findByEmail(request.getEmail()) .orElseThrow(()-> new EntityNotFoundException("Member not found.")); if(!member.getPassword().equals(request.getPassword())) throw new IllegalArgumentException("Invalid login credentials."); } - public InfoResponse getMemberInfoWithId(Long memberId) { + public MemberInfoResponse getMemberInfoWithId(Long memberId) { return memberRepository.findById(memberId) - .map(InfoResponse::of) + .map(MemberInfoResponse::of) .orElseThrow(()-> new EntityNotFoundException("Member not found.")); } - public Page getAllMemberInfo(Pageable pageable) { + public Page getAllMemberInfo(Pageable pageable) { return memberRepository.findAll(pageable) - .map(InfoResponse::of); + .map(MemberInfoResponse::of); } /*TODO: S3 관련 처리 diff --git a/src/main/java/capstone/bookitty/domain/service/StarService.java b/src/main/java/capstone/bookitty/domain/service/StarService.java index 2713428..81b411a 100644 --- a/src/main/java/capstone/bookitty/domain/service/StarService.java +++ b/src/main/java/capstone/bookitty/domain/service/StarService.java @@ -25,7 +25,7 @@ public class StarService { private final MemberRepository memberRepository; @Transactional - public IdResponse saveStar(SaveRequest request) { + public IdResponse saveStar(StarSaveRequest request) { Member member = memberRepository.findById(request.getMemberId()) .orElseThrow(()->new EntityNotFoundException( "Member with ID "+request.getMemberId()+" not found.")); @@ -44,26 +44,26 @@ public IdResponse saveStar(SaveRequest request) { return new IdResponse(star.getId()); } - public InfoResponse findStarByStarId(Long starId) { + public StarInfoResponse findStarByStarId(Long starId) { return starRepository.findById(starId) - .map(InfoResponse::of) + .map(StarInfoResponse::of) .orElseThrow(()->new EntityNotFoundException("Star with ID "+starId+" not found.")); } - public Page findStarByISBN(String isbn, Pageable pageable) { + public Page findStarByISBN(String isbn, Pageable pageable) { return starRepository.findByIsbn(isbn,pageable) - .map(InfoResponse::of); + .map(StarInfoResponse::of); } - public Page findStarByMemberId(Long memberId, Pageable pageable) { + public Page findStarByMemberId(Long memberId, Pageable pageable) { Member member = memberRepository.findById(memberId) .orElseThrow(()-> new EntityNotFoundException("Member with ID "+ memberId+" not found.")); return starRepository.findByMemberId(memberId,pageable) - .map(InfoResponse::of); + .map(StarInfoResponse::of); } @Transactional - public void updateStar(Long starId, UpdateRequest request) { + public void updateStar(Long starId, StarUpdateRequest request) { Star star = starRepository.findById(starId) .orElseThrow(()-> new EntityNotFoundException("Star with ID "+starId+" not found.")); star.updateStar(request.getScore()); @@ -76,8 +76,8 @@ public void deleteStar(Long starId) { starRepository.delete(star); } - public Page findAllStar(Pageable pageable) { + public Page findAllStar(Pageable pageable) { return starRepository.findAll(pageable) - .map(InfoResponse::of); + .map(StarInfoResponse::of); } } From 933458e979de2d9ff1a1b39b1df5234c030cbe06 Mon Sep 17 00:00:00 2001 From: jwpark1211 <1211abc@naver.com> Date: Thu, 16 May 2024 22:58:53 +0900 Subject: [PATCH 2/2] fix : api summary fix for swagger --- .../bookitty/domain/controller/BookStateController.java | 4 ++-- .../bookitty/domain/controller/CommentController.java | 4 ++-- .../bookitty/domain/controller/MemberController.java | 9 +++++---- .../bookitty/domain/controller/StarController.java | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/capstone/bookitty/domain/controller/BookStateController.java b/src/main/java/capstone/bookitty/domain/controller/BookStateController.java index 551ea5a..b2cf513 100644 --- a/src/main/java/capstone/bookitty/domain/controller/BookStateController.java +++ b/src/main/java/capstone/bookitty/domain/controller/BookStateController.java @@ -26,7 +26,7 @@ public class BookStateController { private final BookStateService bookStateService; - @Operation(summary = "책 상태 생성") + @Operation(summary = "책 상태 생성 / state=READING or WANT_TO_READ or READ_ALREADY") @PostMapping(path = "/new") public ResponseEntity saveBookState( @RequestBody @Valid StateSaveRequest request @@ -70,7 +70,7 @@ public ResponseEntity getStateByMemberId( bookStateService.findStateByMemberId(memberId,pageable))); } - @Operation(summary = "state 정보 수정") + @Operation(summary = "state 정보 수정 / state=READING or WANT_TO_READ or READ_ALREADY") @PatchMapping(path = "/{state-id}") public ResponseEntity updateState( @PathVariable("state-id") Long stateId, diff --git a/src/main/java/capstone/bookitty/domain/controller/CommentController.java b/src/main/java/capstone/bookitty/domain/controller/CommentController.java index e60bfa5..b8fe6fc 100644 --- a/src/main/java/capstone/bookitty/domain/controller/CommentController.java +++ b/src/main/java/capstone/bookitty/domain/controller/CommentController.java @@ -25,7 +25,7 @@ public class CommentController { private final CommentService commentService; - @Operation(summary = "코멘트 생성") + @Operation(summary = "코멘트 생성 / content는 최소 1자, 최대 100자") @PostMapping(path = "/new") public ResponseEntity saveComment( @RequestBody @Valid CommentSaveRequest request @@ -80,7 +80,7 @@ public ResponseEntity getCommentByMemberId( commentService.findCommentByMemberId(memberId, pageable))); } - @Operation(summary = "코멘트 수정") + @Operation(summary = "코멘트 수정 / content는 최소 1자, 최대 100자") @PatchMapping(path = "/{comment-id}") public ResponseEntity updateComment( @PathVariable("comment-id") Long commentId, diff --git a/src/main/java/capstone/bookitty/domain/controller/MemberController.java b/src/main/java/capstone/bookitty/domain/controller/MemberController.java index f0a0048..3eab624 100644 --- a/src/main/java/capstone/bookitty/domain/controller/MemberController.java +++ b/src/main/java/capstone/bookitty/domain/controller/MemberController.java @@ -24,13 +24,14 @@ public class MemberController { private final MemberService memberService; - @Operation(summary = "deloy test") + @Operation(summary = "deploy test") @GetMapping("/test") public String test(){ - return "DEPLOY 0515"; + return "DEPLOY 0517"; } - @Operation(summary = "회원가입") + @Operation(summary = "회원가입/"+"비밀번호=영문 대,소문자와 숫자, 특수기호가 적어도 1개 이상씩 포함된 8자 ~ 20자/" + +"gender=MALE or FEMALE/"+"birthdate=yyyy-mm-dd/"+"email=이메일 format 준수") @PostMapping(path = "/new") public ResponseEntity save( @RequestBody @Valid MemberSaveRequest request){ @@ -90,7 +91,7 @@ public ResponseEntity updateMemberProfile( return ResponseEntity.ok().build(); }*/ - @Operation(summary = "회원 탈퇴/추가 구현 필요(미완성)") + @Operation(summary = "회원 탈퇴") @DeleteMapping(path = "/{id}") public ResponseEntity deleteMember( @PathVariable("id") Long memberId diff --git a/src/main/java/capstone/bookitty/domain/controller/StarController.java b/src/main/java/capstone/bookitty/domain/controller/StarController.java index 2c52c99..4b1d391 100644 --- a/src/main/java/capstone/bookitty/domain/controller/StarController.java +++ b/src/main/java/capstone/bookitty/domain/controller/StarController.java @@ -25,7 +25,7 @@ public class StarController { private final StarService starService; - @Operation(summary = "평점 생성[평점은 0.5부터 5까지 0.5단위로 증가합니다.") + @Operation(summary = "평점 생성[평점은 0.5부터 5까지 0.5단위로 증가합니다.]") @PostMapping(path = "/new") public ResponseEntity saveStar( @RequestBody @Valid StarSaveRequest request