diff --git a/src/main/java/com/example/demo/controller/CafeController.java b/src/main/java/com/example/demo/controller/CafeController.java index 8e51c8d6..496836fa 100644 --- a/src/main/java/com/example/demo/controller/CafeController.java +++ b/src/main/java/com/example/demo/controller/CafeController.java @@ -11,8 +11,8 @@ import com.example.demo.domain.auth.CafegoryTokenManager; import com.example.demo.dto.PagedResponse; -import com.example.demo.dto.cafe.CafeResponse; -import com.example.demo.dto.cafe.CafeSearchRequest; +import com.example.demo.dto.cafe.CafeSearchListRequest; +import com.example.demo.dto.cafe.CafeSearchListResponse; import com.example.demo.dto.cafe.CafeSearchResponse; import com.example.demo.service.cafe.CafeService; @@ -26,22 +26,22 @@ public class CafeController { private final CafegoryTokenManager cafegoryTokenManager; @GetMapping("/cafe/list") - public ResponseEntity> searchCafeList( - @ModelAttribute CafeSearchRequest cafeSearchRequest) { - PagedResponse response = cafeService.searchWithPagingByDynamicFilter( - cafeSearchRequest); + public ResponseEntity> searchCafeList( + @ModelAttribute CafeSearchListRequest cafeSearchListRequest) { + PagedResponse response = cafeService.searchWithPagingByDynamicFilter( + cafeSearchListRequest); return new ResponseEntity<>(response, HttpStatus.OK); } @GetMapping("/cafe/{cafeId}") - public ResponseEntity searchCafe(@PathVariable Long cafeId, + public ResponseEntity searchCafe(@PathVariable Long cafeId, @RequestHeader(value = "Authorization", required = false) String authorization) { if (StringUtils.hasText(authorization)) { long memberId = cafegoryTokenManager.getIdentityId(authorization); - CafeResponse response = cafeService.searchCafeForMemberByCafeId(cafeId, memberId); + CafeSearchResponse response = cafeService.searchCafeForMemberByCafeId(cafeId, memberId); return new ResponseEntity<>(response, HttpStatus.OK); } - CafeResponse response = cafeService.searchCafeForNotMemberByCafeId(cafeId); + CafeSearchResponse response = cafeService.searchCafeForNotMemberByCafeId(cafeId); return new ResponseEntity<>(response, HttpStatus.OK); } diff --git a/src/main/java/com/example/demo/controller/MailController.java b/src/main/java/com/example/demo/controller/MailController.java index c38c6a66..0885cf88 100644 --- a/src/main/java/com/example/demo/controller/MailController.java +++ b/src/main/java/com/example/demo/controller/MailController.java @@ -8,8 +8,9 @@ import com.example.demo.domain.auth.CafegoryTokenManager; import com.example.demo.dto.email.CustomEmailSendRequest; +import com.example.demo.dto.email.EmailSendCustomTemplateResponse; import com.example.demo.dto.email.EmailSendRequest; -import com.example.demo.dto.email.EmailTemplateResponse; +import com.example.demo.dto.email.EmailSendTemplateResponse; import com.example.demo.service.email.MailService; import lombok.RequiredArgsConstructor; @@ -22,18 +23,18 @@ public class MailController { private final MailService mailService; @PostMapping("/email") - public ResponseEntity sendEmail( + public ResponseEntity sendEmail( @RequestHeader("Authorization") String authorization, @RequestBody EmailSendRequest request) { cafegoryTokenManager.getIdentityId(authorization); - EmailTemplateResponse response = mailService.sendEmail(request); + EmailSendTemplateResponse response = mailService.sendEmail(request); return ResponseEntity.ok(response); } @PostMapping("/email/custom") - public ResponseEntity sendCustomEmail( + public ResponseEntity sendCustomEmail( @RequestHeader("Authorization") String authorization, @RequestBody CustomEmailSendRequest request) { cafegoryTokenManager.getIdentityId(authorization); - EmailTemplateResponse response = mailService.sendCustomEmail(request); + EmailSendCustomTemplateResponse response = mailService.sendCustomEmail(request); return ResponseEntity.ok(response); } } diff --git a/src/main/java/com/example/demo/controller/ProfileController.java b/src/main/java/com/example/demo/controller/ProfileController.java index c626e589..97b5bf17 100644 --- a/src/main/java/com/example/demo/controller/ProfileController.java +++ b/src/main/java/com/example/demo/controller/ProfileController.java @@ -10,8 +10,9 @@ import org.springframework.web.bind.annotation.RestController; import com.example.demo.domain.auth.CafegoryTokenManager; -import com.example.demo.dto.profile.ProfileResponse; +import com.example.demo.dto.profile.ProfileGetResponse; import com.example.demo.dto.profile.ProfileUpdateRequest; +import com.example.demo.dto.profile.ProfileUpdateResponse; import com.example.demo.service.profile.ProfileService; import lombok.RequiredArgsConstructor; @@ -24,19 +25,20 @@ public class ProfileController { private final CafegoryTokenManager cafegoryTokenManager; @GetMapping("/{memberId:[0-9]+}") - public ResponseEntity get(@PathVariable("memberId") Long targetMemberId, + public ResponseEntity get(@PathVariable("memberId") Long targetMemberId, @RequestHeader("Authorization") String authorization) { long requestMemberId = cafegoryTokenManager.getIdentityId(authorization); - ProfileResponse profileResponse = profileService.get(requestMemberId, targetMemberId); - return ResponseEntity.ok(profileResponse); + ProfileGetResponse profileGetResponse = profileService.get(requestMemberId, targetMemberId); + return ResponseEntity.ok(profileGetResponse); } @PatchMapping("/{memberId:[0-9]+}") - public ResponseEntity update(@PathVariable("memberId") Long targetMemberId, + public ResponseEntity update(@PathVariable("memberId") Long targetMemberId, @RequestBody ProfileUpdateRequest profileUpdateRequest, @RequestHeader("Authorization") String authorization) { long requestMemberId = cafegoryTokenManager.getIdentityId(authorization); - ProfileResponse profileResponse = profileService.update(requestMemberId, targetMemberId, profileUpdateRequest); + ProfileUpdateResponse profileResponse = profileService.update(requestMemberId, targetMemberId, + profileUpdateRequest); return ResponseEntity.ok(profileResponse); } } diff --git a/src/main/java/com/example/demo/controller/ReviewController.java b/src/main/java/com/example/demo/controller/ReviewController.java index e4345c03..f9d25bf9 100644 --- a/src/main/java/com/example/demo/controller/ReviewController.java +++ b/src/main/java/com/example/demo/controller/ReviewController.java @@ -16,8 +16,8 @@ import com.example.demo.dto.PagedResponse; import com.example.demo.dto.review.ReviewResponse; import com.example.demo.dto.review.ReviewSaveRequest; -import com.example.demo.dto.review.ReviewSearchRequest; -import com.example.demo.dto.review.ReviewSearchResponse; +import com.example.demo.dto.review.ReviewSearchListRequest; +import com.example.demo.dto.review.ReviewSearchListResponse; import com.example.demo.dto.review.ReviewUpdateRequest; import com.example.demo.service.review.ReviewQueryService; import com.example.demo.service.review.ReviewService; @@ -33,8 +33,8 @@ public class ReviewController { private final CafegoryTokenManager cafegoryTokenManager; @GetMapping("/cafe/{cafeId}/review/list") - public ResponseEntity> reviewList(ReviewSearchRequest request) { - PagedResponse response = reviewQueryService.searchWithPagingByCafeId( + public ResponseEntity> reviewList(ReviewSearchListRequest request) { + PagedResponse response = reviewQueryService.searchWithPagingByCafeId( request); return new ResponseEntity<>(response, HttpStatus.OK); } diff --git a/src/main/java/com/example/demo/controller/StudyOnceController.java b/src/main/java/com/example/demo/controller/StudyOnceController.java index dec8ca42..01d85703 100644 --- a/src/main/java/com/example/demo/controller/StudyOnceController.java +++ b/src/main/java/com/example/demo/controller/StudyOnceController.java @@ -21,16 +21,18 @@ import com.example.demo.domain.auth.CafegoryTokenManager; import com.example.demo.dto.PagedResponse; -import com.example.demo.dto.cafe.CafeSearchResponse; -import com.example.demo.dto.study.StudyMembersResponse; +import com.example.demo.dto.cafe.CafeSearchListResponse; +import com.example.demo.dto.study.StudyMemberListResponse; import com.example.demo.dto.study.StudyOnceCommentRequest; import com.example.demo.dto.study.StudyOnceCommentResponse; +import com.example.demo.dto.study.StudyOnceCommentSaveRequest; +import com.example.demo.dto.study.StudyOnceCommentSearchListResponse; import com.example.demo.dto.study.StudyOnceCommentUpdateRequest; -import com.example.demo.dto.study.StudyOnceCommentsSearchResponse; import com.example.demo.dto.study.StudyOnceCreateRequest; import com.example.demo.dto.study.StudyOnceCreateResponse; -import com.example.demo.dto.study.StudyOnceInfoResponse; import com.example.demo.dto.study.StudyOnceJoinResult; +import com.example.demo.dto.study.StudyOnceQuitResponse; +import com.example.demo.dto.study.StudyOnceResponse; import com.example.demo.dto.study.StudyOnceSearchListResponse; import com.example.demo.dto.study.StudyOnceSearchRequest; import com.example.demo.dto.study.StudyOnceSearchResponse; @@ -87,7 +89,7 @@ public ResponseEntity create( } @PatchMapping("/{studyOnceId:[0-9]+}") - public ResponseEntity update(@PathVariable Long studyOnceId, + public ResponseEntity update(@PathVariable Long studyOnceId, @RequestBody @Validated StudyOnceUpdateRequest request, @RequestHeader("Authorization") String authorization) { long leaderId = cafegoryTokenManager.getIdentityId(authorization); @@ -96,7 +98,7 @@ public ResponseEntity update(@PathVariable Long studyOnce } else { studyOnceService.updateStudyOncePartially(leaderId, studyOnceId, request, LocalDateTime.now()); } - StudyOnceInfoResponse response = studyOnceService.findStudyOnce(studyOnceId, LocalDateTime.now()); + StudyOnceResponse response = studyOnceService.findStudyOnce(studyOnceId, LocalDateTime.now()); return ResponseEntity.ok(response); } @@ -110,12 +112,12 @@ public ResponseEntity tryJoin(@PathVariable Long studyOnceI } @DeleteMapping("/{studyOnceId:[0-9]+}") - public ResponseEntity tryQuit(@PathVariable Long studyOnceId, + public ResponseEntity tryQuit(@PathVariable Long studyOnceId, @RequestHeader("Authorization") String authorization) { long memberId = cafegoryTokenManager.getIdentityId(authorization); LocalDateTime requestTime = LocalDateTime.now(); studyOnceService.tryQuit(memberId, studyOnceId); - return ResponseEntity.ok(new StudyOnceJoinResult(requestTime, true)); + return ResponseEntity.ok(new StudyOnceQuitResponse(requestTime, true)); } @PatchMapping("/{studyOnceId:[0-9]+}/attendance") @@ -129,30 +131,30 @@ public ResponseEntity takeAttendance(@PathVariable Lon } @PatchMapping("/{studyOnceId:[0-9]+}/location") - public ResponseEntity changeCafe(@PathVariable Long studyOnceId, + public ResponseEntity changeCafe(@PathVariable Long studyOnceId, @RequestHeader("Authorization") String authorization, @RequestBody Long cafeId) { long leaderId = cafegoryTokenManager.getIdentityId(authorization); Long changedCafeId = studyOnceService.changeCafe(leaderId, studyOnceId, cafeId); - CafeSearchResponse response = cafeService.searchCafeBasicInfoById(changedCafeId); + CafeSearchListResponse response = cafeService.searchCafeBasicInfoById(changedCafeId); return ResponseEntity.ok(response); } @GetMapping("/{studyOnceId:[0-9]+}/member/list") - public ResponseEntity findStudyMemberList(@PathVariable Long studyOnceId, + public ResponseEntity searchStudyMemberList(@PathVariable Long studyOnceId, @RequestHeader("Authorization") String authorization) { long leaderId = cafegoryTokenManager.getIdentityId(authorization); if (!studyOnceService.isStudyOnceLeader(leaderId, studyOnceId)) { throw new CafegoryException(STUDY_ONCE_LEADER_PERMISSION_DENIED); } - StudyMembersResponse response = studyOnceService.findStudyMembersById(studyOnceId); + StudyMemberListResponse response = studyOnceService.findStudyMembersById(studyOnceId); return ResponseEntity.ok(response); } @PostMapping("/{studyOnceId:[0-9]+}/question") public ResponseEntity saveQuestion(@PathVariable Long studyOnceId, @RequestHeader("Authorization") String authorization, - @RequestBody @Validated StudyOnceCommentRequest request) { + @RequestBody @Validated StudyOnceCommentSaveRequest request) { long memberId = cafegoryTokenManager.getIdentityId(authorization); Long savedCommentId = studyOnceCommentService.saveQuestion(memberId, studyOnceId, request); StudyOnceCommentResponse response = studyOnceQAndAQueryService.searchComment( @@ -217,10 +219,10 @@ public ResponseEntity deleteReply(@PathVariable final } @GetMapping("/{studyOnceId:[0-9]+}/comment/list") - public ResponseEntity searchComments(@PathVariable Long studyOnceId, + public ResponseEntity searchComments(@PathVariable Long studyOnceId, @RequestHeader("Authorization") String authorization) { cafegoryTokenManager.getIdentityId(authorization); - StudyOnceCommentsSearchResponse response = studyOnceCommentQueryService.searchSortedCommentsByStudyOnceId( + StudyOnceCommentSearchListResponse response = studyOnceCommentQueryService.searchSortedCommentsByStudyOnceId( studyOnceId); return ResponseEntity.ok(response); } diff --git a/src/main/java/com/example/demo/dto/cafe/CafeResponse.java b/src/main/java/com/example/demo/dto/cafe/CafeResponse.java deleted file mode 100644 index d8b9f422..00000000 --- a/src/main/java/com/example/demo/dto/cafe/CafeResponse.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.example.demo.dto.cafe; - -import java.util.List; - -import com.example.demo.dto.review.ReviewResponse; -import com.example.demo.dto.study.CanMakeStudyOnceResponse; -import com.example.demo.dto.study.StudyOnceForCafeResponse; - -import lombok.Builder; -import lombok.Getter; - -@Getter -@Builder -public class CafeResponse { - - private final CafeBasicInfoResponse basicInfo; - private final List review; - private final List meetings; - private final List canMakeMeeting; -} diff --git a/src/main/java/com/example/demo/dto/cafe/CafeSearchBasicInfoResponse.java b/src/main/java/com/example/demo/dto/cafe/CafeSearchBasicInfoResponse.java new file mode 100644 index 00000000..595fe635 --- /dev/null +++ b/src/main/java/com/example/demo/dto/cafe/CafeSearchBasicInfoResponse.java @@ -0,0 +1,21 @@ +package com.example.demo.dto.cafe; + +import java.util.List; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class CafeSearchBasicInfoResponse { + private final long cafeId; + private final String name; + private final String address; + private final List businessHours; + private final Boolean isOpen; + private final List sns; + private final String phone; + private final int minBeveragePrice; + private final int maxTime; + private final double avgReviewRate; +} diff --git a/src/main/java/com/example/demo/dto/cafe/CafeSearchBusinessHourResponse.java b/src/main/java/com/example/demo/dto/cafe/CafeSearchBusinessHourResponse.java new file mode 100644 index 00000000..a36e4241 --- /dev/null +++ b/src/main/java/com/example/demo/dto/cafe/CafeSearchBusinessHourResponse.java @@ -0,0 +1,12 @@ +package com.example.demo.dto.cafe; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class CafeSearchBusinessHourResponse { + private final String day; + private final String startTime; + private final String endTime; +} diff --git a/src/main/java/com/example/demo/dto/cafe/CafeSearchRequest.java b/src/main/java/com/example/demo/dto/cafe/CafeSearchListRequest.java similarity index 85% rename from src/main/java/com/example/demo/dto/cafe/CafeSearchRequest.java rename to src/main/java/com/example/demo/dto/cafe/CafeSearchListRequest.java index 6724ba11..ee2b77f1 100644 --- a/src/main/java/com/example/demo/dto/cafe/CafeSearchRequest.java +++ b/src/main/java/com/example/demo/dto/cafe/CafeSearchListRequest.java @@ -9,12 +9,11 @@ @Getter @Setter @ToString -public class CafeSearchRequest extends PagedRequest { +public class CafeSearchListRequest extends PagedRequest { private int startTime = 0; private int endTime = 24; private boolean canStudy; private int minBeveragePrice = 0; private int maxTime = 0; private String area; - } diff --git a/src/main/java/com/example/demo/dto/cafe/CafeBasicInfoResponse.java b/src/main/java/com/example/demo/dto/cafe/CafeSearchListResponse.java similarity index 88% rename from src/main/java/com/example/demo/dto/cafe/CafeBasicInfoResponse.java rename to src/main/java/com/example/demo/dto/cafe/CafeSearchListResponse.java index e69de455..2187f103 100644 --- a/src/main/java/com/example/demo/dto/cafe/CafeBasicInfoResponse.java +++ b/src/main/java/com/example/demo/dto/cafe/CafeSearchListResponse.java @@ -7,11 +7,12 @@ @Getter @RequiredArgsConstructor -public class CafeBasicInfoResponse { +public class CafeSearchListResponse { private final long cafeId; private final String name; private final String address; + private final String area; private final List businessHours; private final Boolean isOpen; private final List sns; @@ -19,4 +20,5 @@ public class CafeBasicInfoResponse { private final int minBeveragePrice; private final int maxTime; private final double avgReviewRate; + } diff --git a/src/main/java/com/example/demo/dto/cafe/CafeSearchResponse.java b/src/main/java/com/example/demo/dto/cafe/CafeSearchResponse.java index f7b7f48a..bf75e4bf 100644 --- a/src/main/java/com/example/demo/dto/cafe/CafeSearchResponse.java +++ b/src/main/java/com/example/demo/dto/cafe/CafeSearchResponse.java @@ -2,23 +2,17 @@ import java.util.List; +import com.example.demo.dto.study.CanMakeStudyOnceResponse; + +import lombok.Builder; import lombok.Getter; -import lombok.RequiredArgsConstructor; @Getter -@RequiredArgsConstructor +@Builder public class CafeSearchResponse { - private final long cafeId; - private final String name; - private final String address; - private final String area; - private final List businessHours; - private final Boolean isOpen; - private final List sns; - private final String phone; - private final int minBeveragePrice; - private final int maxTime; - private final double avgReviewRate; - + private final CafeSearchBasicInfoResponse basicInfo; + private final List review; + private final List meetings; + private final List canMakeMeeting; } diff --git a/src/main/java/com/example/demo/dto/cafe/CafeSearchReviewResponse.java b/src/main/java/com/example/demo/dto/cafe/CafeSearchReviewResponse.java new file mode 100644 index 00000000..35538abf --- /dev/null +++ b/src/main/java/com/example/demo/dto/cafe/CafeSearchReviewResponse.java @@ -0,0 +1,13 @@ +package com.example.demo.dto.cafe; + +import lombok.Builder; +import lombok.Getter; + +@Getter +@Builder +public class CafeSearchReviewResponse { + private final long reviewId; + private final CafeSearchWriterResponse writer; + private final double rate; + private final String content; +} diff --git a/src/main/java/com/example/demo/dto/cafe/CafeSearchSnsResponse.java b/src/main/java/com/example/demo/dto/cafe/CafeSearchSnsResponse.java new file mode 100644 index 00000000..94214e12 --- /dev/null +++ b/src/main/java/com/example/demo/dto/cafe/CafeSearchSnsResponse.java @@ -0,0 +1,11 @@ +package com.example.demo.dto.cafe; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class CafeSearchSnsResponse { + private final String name; + private final String url; +} diff --git a/src/main/java/com/example/demo/dto/study/StudyOnceForCafeResponse.java b/src/main/java/com/example/demo/dto/cafe/CafeSearchStudyOnceResponse.java similarity index 80% rename from src/main/java/com/example/demo/dto/study/StudyOnceForCafeResponse.java rename to src/main/java/com/example/demo/dto/cafe/CafeSearchStudyOnceResponse.java index c7ceb831..f62e61e1 100644 --- a/src/main/java/com/example/demo/dto/study/StudyOnceForCafeResponse.java +++ b/src/main/java/com/example/demo/dto/cafe/CafeSearchStudyOnceResponse.java @@ -1,4 +1,4 @@ -package com.example.demo.dto.study; +package com.example.demo.dto.cafe; import java.time.LocalDateTime; @@ -7,7 +7,7 @@ @Getter @Builder -public class StudyOnceForCafeResponse { +public class CafeSearchStudyOnceResponse { private long cafeId; private long studyOnceId; private String name; diff --git a/src/main/java/com/example/demo/dto/WriterResponse.java b/src/main/java/com/example/demo/dto/cafe/CafeSearchWriterResponse.java similarity index 71% rename from src/main/java/com/example/demo/dto/WriterResponse.java rename to src/main/java/com/example/demo/dto/cafe/CafeSearchWriterResponse.java index 11aeb543..e4d5f457 100644 --- a/src/main/java/com/example/demo/dto/WriterResponse.java +++ b/src/main/java/com/example/demo/dto/cafe/CafeSearchWriterResponse.java @@ -1,14 +1,12 @@ -package com.example.demo.dto; +package com.example.demo.dto.cafe; import lombok.Getter; import lombok.RequiredArgsConstructor; @Getter @RequiredArgsConstructor -public class WriterResponse { - +public class CafeSearchWriterResponse { private final long memberId; private final String name; private final String thumbnailImg; - } diff --git a/src/main/java/com/example/demo/dto/email/EmailSendCustomTemplateResponse.java b/src/main/java/com/example/demo/dto/email/EmailSendCustomTemplateResponse.java new file mode 100644 index 00000000..86ce351e --- /dev/null +++ b/src/main/java/com/example/demo/dto/email/EmailSendCustomTemplateResponse.java @@ -0,0 +1,11 @@ +package com.example.demo.dto.email; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class EmailSendCustomTemplateResponse { + private final String title; + private final String content; +} diff --git a/src/main/java/com/example/demo/dto/email/EmailTemplateResponse.java b/src/main/java/com/example/demo/dto/email/EmailSendTemplateResponse.java similarity index 82% rename from src/main/java/com/example/demo/dto/email/EmailTemplateResponse.java rename to src/main/java/com/example/demo/dto/email/EmailSendTemplateResponse.java index 7685de54..84651dad 100644 --- a/src/main/java/com/example/demo/dto/email/EmailTemplateResponse.java +++ b/src/main/java/com/example/demo/dto/email/EmailSendTemplateResponse.java @@ -5,8 +5,7 @@ @Getter @RequiredArgsConstructor -public class EmailTemplateResponse { - +public class EmailSendTemplateResponse { private final String title; private final String content; } diff --git a/src/main/java/com/example/demo/dto/profile/ProfileResponse.java b/src/main/java/com/example/demo/dto/profile/ProfileGetResponse.java similarity index 90% rename from src/main/java/com/example/demo/dto/profile/ProfileResponse.java rename to src/main/java/com/example/demo/dto/profile/ProfileGetResponse.java index 14d9be92..03b58ee0 100644 --- a/src/main/java/com/example/demo/dto/profile/ProfileResponse.java +++ b/src/main/java/com/example/demo/dto/profile/ProfileGetResponse.java @@ -9,7 +9,7 @@ @Getter @EqualsAndHashCode @ToString -public class ProfileResponse { +public class ProfileGetResponse { private final String name; private final String thumbnailImg; private final String introduction; diff --git a/src/main/java/com/example/demo/dto/profile/ProfileUpdateResponse.java b/src/main/java/com/example/demo/dto/profile/ProfileUpdateResponse.java new file mode 100644 index 00000000..73169f1e --- /dev/null +++ b/src/main/java/com/example/demo/dto/profile/ProfileUpdateResponse.java @@ -0,0 +1,16 @@ +package com.example.demo.dto.profile; + +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.ToString; + +@RequiredArgsConstructor +@Getter +@EqualsAndHashCode +@ToString +public class ProfileUpdateResponse { + private final String name; + private final String thumbnailImg; + private final String introduction; +} diff --git a/src/main/java/com/example/demo/dto/review/ReviewResponse.java b/src/main/java/com/example/demo/dto/review/ReviewResponse.java index 5b1c6df2..71112245 100644 --- a/src/main/java/com/example/demo/dto/review/ReviewResponse.java +++ b/src/main/java/com/example/demo/dto/review/ReviewResponse.java @@ -1,7 +1,5 @@ package com.example.demo.dto.review; -import com.example.demo.dto.WriterResponse; - import lombok.Builder; import lombok.Getter; @@ -10,7 +8,7 @@ public class ReviewResponse { private final long reviewId; - private final WriterResponse writer; + private final ReviewWriterSearchResponse writer; private final double rate; private final String content; } diff --git a/src/main/java/com/example/demo/dto/review/ReviewSearchRequest.java b/src/main/java/com/example/demo/dto/review/ReviewSearchListRequest.java similarity index 77% rename from src/main/java/com/example/demo/dto/review/ReviewSearchRequest.java rename to src/main/java/com/example/demo/dto/review/ReviewSearchListRequest.java index ecbfc9ed..06a29ff3 100644 --- a/src/main/java/com/example/demo/dto/review/ReviewSearchRequest.java +++ b/src/main/java/com/example/demo/dto/review/ReviewSearchListRequest.java @@ -7,7 +7,6 @@ @Getter @RequiredArgsConstructor -public class ReviewSearchRequest extends PagedRequest { - +public class ReviewSearchListRequest extends PagedRequest { private final Long cafeId; } diff --git a/src/main/java/com/example/demo/dto/review/ReviewSearchResponse.java b/src/main/java/com/example/demo/dto/review/ReviewSearchListResponse.java similarity index 65% rename from src/main/java/com/example/demo/dto/review/ReviewSearchResponse.java rename to src/main/java/com/example/demo/dto/review/ReviewSearchListResponse.java index e2c3d5fb..23b45cf8 100644 --- a/src/main/java/com/example/demo/dto/review/ReviewSearchResponse.java +++ b/src/main/java/com/example/demo/dto/review/ReviewSearchListResponse.java @@ -1,16 +1,13 @@ package com.example.demo.dto.review; -import com.example.demo.dto.WriterResponse; - import lombok.Getter; import lombok.RequiredArgsConstructor; @Getter @RequiredArgsConstructor -public class ReviewSearchResponse { - +public class ReviewSearchListResponse { private final long reviewId; - private final WriterResponse writer; + private final ReviewWriterSearchListResponse writer; private final double rate; private final String content; } diff --git a/src/main/java/com/example/demo/dto/review/ReviewWriterSearchListResponse.java b/src/main/java/com/example/demo/dto/review/ReviewWriterSearchListResponse.java new file mode 100644 index 00000000..81b9929b --- /dev/null +++ b/src/main/java/com/example/demo/dto/review/ReviewWriterSearchListResponse.java @@ -0,0 +1,12 @@ +package com.example.demo.dto.review; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class ReviewWriterSearchListResponse { + private final long memberId; + private final String name; + private final String thumbnailImg; +} diff --git a/src/main/java/com/example/demo/dto/review/ReviewWriterSearchResponse.java b/src/main/java/com/example/demo/dto/review/ReviewWriterSearchResponse.java new file mode 100644 index 00000000..c442926c --- /dev/null +++ b/src/main/java/com/example/demo/dto/review/ReviewWriterSearchResponse.java @@ -0,0 +1,12 @@ +package com.example.demo.dto.review; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class ReviewWriterSearchResponse { + private final long memberId; + private final String name; + private final String thumbnailImg; +} diff --git a/src/main/java/com/example/demo/dto/study/StudyMembersResponse.java b/src/main/java/com/example/demo/dto/study/StudyMemberListResponse.java similarity index 87% rename from src/main/java/com/example/demo/dto/study/StudyMembersResponse.java rename to src/main/java/com/example/demo/dto/study/StudyMemberListResponse.java index e86b3688..a67b2d70 100644 --- a/src/main/java/com/example/demo/dto/study/StudyMembersResponse.java +++ b/src/main/java/com/example/demo/dto/study/StudyMemberListResponse.java @@ -9,7 +9,7 @@ @Getter @RequiredArgsConstructor -public class StudyMembersResponse { +public class StudyMemberListResponse { private final List joinedMembers; diff --git a/src/main/java/com/example/demo/dto/study/StudyOnceCommentResponse.java b/src/main/java/com/example/demo/dto/study/StudyOnceCommentResponse.java index 9e361807..41e98cc2 100644 --- a/src/main/java/com/example/demo/dto/study/StudyOnceCommentResponse.java +++ b/src/main/java/com/example/demo/dto/study/StudyOnceCommentResponse.java @@ -1,7 +1,5 @@ package com.example.demo.dto.study; -import com.example.demo.dto.WriterResponse; - import lombok.Getter; import lombok.RequiredArgsConstructor; @@ -11,5 +9,5 @@ public class StudyOnceCommentResponse { private final Long commentId; private final String content; - private final WriterResponse writer; + private final StudyOnceSearchCommentWriterResponse writer; } diff --git a/src/main/java/com/example/demo/dto/study/StudyOnceCommentSaveRequest.java b/src/main/java/com/example/demo/dto/study/StudyOnceCommentSaveRequest.java new file mode 100644 index 00000000..8eda2c43 --- /dev/null +++ b/src/main/java/com/example/demo/dto/study/StudyOnceCommentSaveRequest.java @@ -0,0 +1,18 @@ +package com.example.demo.dto.study; + +import javax.validation.constraints.NotBlank; + +import lombok.Getter; + +@Getter +public class StudyOnceCommentSaveRequest { + @NotBlank + private String content; + + public StudyOnceCommentSaveRequest() { + } + + public StudyOnceCommentSaveRequest(String content) { + this.content = content; + } +} diff --git a/src/main/java/com/example/demo/dto/study/StudyOnceCommentsSearchResponse.java b/src/main/java/com/example/demo/dto/study/StudyOnceCommentSearchListResponse.java similarity index 59% rename from src/main/java/com/example/demo/dto/study/StudyOnceCommentsSearchResponse.java rename to src/main/java/com/example/demo/dto/study/StudyOnceCommentSearchListResponse.java index ae9b9783..80a89254 100644 --- a/src/main/java/com/example/demo/dto/study/StudyOnceCommentsSearchResponse.java +++ b/src/main/java/com/example/demo/dto/study/StudyOnceCommentSearchListResponse.java @@ -3,18 +3,16 @@ import java.util.ArrayList; import java.util.List; -import com.example.demo.dto.member.MemberResponse; - import lombok.Getter; @Getter -public class StudyOnceCommentsSearchResponse { +public class StudyOnceCommentSearchListResponse { - private MemberResponse replyWriter; + private StudyOnceSearchCommentWriterResponse writerResponse; private List comments = new ArrayList<>(); - public StudyOnceCommentsSearchResponse(MemberResponse replyWriter) { - this.replyWriter = replyWriter; + public StudyOnceCommentSearchListResponse(StudyOnceSearchCommentWriterResponse writerResponse) { + this.writerResponse = writerResponse; } public void addStudyOnceCommentSearchResponse(StudyOnceCommentSearchResponse studyOnceCommentSearchResponse) { diff --git a/src/main/java/com/example/demo/dto/study/StudyOnceCommentSearchResponse.java b/src/main/java/com/example/demo/dto/study/StudyOnceCommentSearchResponse.java index 9d509820..caee9c5a 100644 --- a/src/main/java/com/example/demo/dto/study/StudyOnceCommentSearchResponse.java +++ b/src/main/java/com/example/demo/dto/study/StudyOnceCommentSearchResponse.java @@ -3,8 +3,6 @@ import java.util.ArrayList; import java.util.List; -import com.example.demo.dto.member.MemberResponse; - import lombok.Getter; import lombok.Setter; @@ -12,7 +10,7 @@ @Setter public class StudyOnceCommentSearchResponse { - private MemberResponse questionWriter; + private StudyOnceSearchCommentWriterResponse questionWriter; private StudyOnceCommentInfo questionInfo; private List replies = new ArrayList<>(); diff --git a/src/main/java/com/example/demo/dto/study/StudyOnceQuitResponse.java b/src/main/java/com/example/demo/dto/study/StudyOnceQuitResponse.java new file mode 100644 index 00000000..ec5b9ecc --- /dev/null +++ b/src/main/java/com/example/demo/dto/study/StudyOnceQuitResponse.java @@ -0,0 +1,11 @@ +package com.example.demo.dto.study; + +import java.time.LocalDateTime; + +import lombok.Data; + +@Data +public class StudyOnceQuitResponse { + private final LocalDateTime requestTime; + private final boolean result; +} diff --git a/src/main/java/com/example/demo/dto/study/StudyOnceInfoResponse.java b/src/main/java/com/example/demo/dto/study/StudyOnceResponse.java similarity index 92% rename from src/main/java/com/example/demo/dto/study/StudyOnceInfoResponse.java rename to src/main/java/com/example/demo/dto/study/StudyOnceResponse.java index c3e63e5f..0d88ff6a 100644 --- a/src/main/java/com/example/demo/dto/study/StudyOnceInfoResponse.java +++ b/src/main/java/com/example/demo/dto/study/StudyOnceResponse.java @@ -7,7 +7,7 @@ @Builder @Data -public class StudyOnceInfoResponse { +public class StudyOnceResponse { private long cafeId; private String area; private long studyOnceId; diff --git a/src/main/java/com/example/demo/dto/study/StudyOnceSearchCommentWriterResponse.java b/src/main/java/com/example/demo/dto/study/StudyOnceSearchCommentWriterResponse.java new file mode 100644 index 00000000..1bc2a0e2 --- /dev/null +++ b/src/main/java/com/example/demo/dto/study/StudyOnceSearchCommentWriterResponse.java @@ -0,0 +1,12 @@ +package com.example.demo.dto.study; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class StudyOnceSearchCommentWriterResponse { + private final long memberId; + private final String name; + private final String thumbnailImg; +} diff --git a/src/main/java/com/example/demo/mapper/BusinessHourMapper.java b/src/main/java/com/example/demo/mapper/BusinessHourMapper.java index 5580a23c..262defea 100644 --- a/src/main/java/com/example/demo/mapper/BusinessHourMapper.java +++ b/src/main/java/com/example/demo/mapper/BusinessHourMapper.java @@ -4,13 +4,13 @@ import java.util.stream.Collectors; import com.example.demo.domain.cafe.BusinessHour; -import com.example.demo.dto.cafe.BusinessHourResponse; +import com.example.demo.dto.cafe.CafeSearchBusinessHourResponse; public class BusinessHourMapper { - public List toBusinessHourResponses(List businessHours) { + public List toCafeSearchBusinessHourResponses(List businessHours) { return businessHours.stream() - .map(hour -> new BusinessHourResponse(hour.getDay(), hour.getStartTime().toString(), + .map(hour -> new CafeSearchBusinessHourResponse(hour.getDay(), hour.getStartTime().toString(), hour.getEndTime().toString())) .collect(Collectors.toList()); } diff --git a/src/main/java/com/example/demo/mapper/CafeMapper.java b/src/main/java/com/example/demo/mapper/CafeMapper.java index 4337e26a..75e834a1 100644 --- a/src/main/java/com/example/demo/mapper/CafeMapper.java +++ b/src/main/java/com/example/demo/mapper/CafeMapper.java @@ -9,28 +9,30 @@ import com.example.demo.domain.cafe.CafeSearchCondition; import com.example.demo.domain.cafe.OpenChecker; import com.example.demo.dto.cafe.BusinessHourResponse; -import com.example.demo.dto.cafe.CafeBasicInfoResponse; -import com.example.demo.dto.cafe.CafeResponse; -import com.example.demo.dto.cafe.CafeSearchRequest; +import com.example.demo.dto.cafe.CafeSearchBasicInfoResponse; +import com.example.demo.dto.cafe.CafeSearchBusinessHourResponse; +import com.example.demo.dto.cafe.CafeSearchListRequest; +import com.example.demo.dto.cafe.CafeSearchListResponse; import com.example.demo.dto.cafe.CafeSearchResponse; +import com.example.demo.dto.cafe.CafeSearchReviewResponse; +import com.example.demo.dto.cafe.CafeSearchSnsResponse; +import com.example.demo.dto.cafe.CafeSearchStudyOnceResponse; import com.example.demo.dto.cafe.SnsResponse; -import com.example.demo.dto.review.ReviewResponse; import com.example.demo.dto.study.CanMakeStudyOnceResponse; -import com.example.demo.dto.study.StudyOnceForCafeResponse; public class CafeMapper { - public List toCafeSearchResponses(List cafes, + public List toCafeSearchListResponses(List cafes, OpenChecker openChecker) { return cafes.stream() .map(cafe -> - produceCafeSearchResponse(cafe, openChecker) + produceCafeSearchListResponse(cafe, openChecker) ) .collect(Collectors.toList()); } - private CafeSearchResponse produceCafeSearchResponse(Cafe cafe, OpenChecker openChecker) { - return new CafeSearchResponse( + private CafeSearchListResponse produceCafeSearchListResponse(Cafe cafe, OpenChecker openChecker) { + return new CafeSearchListResponse( cafe.getId(), cafe.getName(), cafe.showFullAddress(), @@ -50,21 +52,21 @@ private CafeSearchResponse produceCafeSearchResponse(Cafe cafe, OpenChecker openChecker) { - return produceCafeSearchResponse(cafe, openChecker); + public CafeSearchListResponse toCafeSearchResponse(Cafe cafe, OpenChecker openChecker) { + return produceCafeSearchListResponse(cafe, openChecker); } - public CafeBasicInfoResponse toCafeBasicInfoResponse(Cafe cafe, - List businessHourResponses, - List snsResponses, + public CafeSearchBasicInfoResponse toCafeSearchBasicInfoResponse(Cafe cafe, + List cafeSearchBusinessHourResponses, + List cafeSearchSnsResponses, OpenChecker openChecker) { - return new CafeBasicInfoResponse( + return new CafeSearchBasicInfoResponse( cafe.getId(), cafe.getName(), cafe.showFullAddress(), - businessHourResponses, + cafeSearchBusinessHourResponses, cafe.isOpen(openChecker), - snsResponses, + cafeSearchSnsResponses, cafe.getPhone(), cafe.getMinBeveragePrice(), cafe.getMaxAllowableStay().getValue(), @@ -72,7 +74,7 @@ public CafeBasicInfoResponse toCafeBasicInfoResponse(Cafe cafe, ); } - public CafeSearchCondition toCafeSearchCondition(CafeSearchRequest request) { + public CafeSearchCondition toCafeSearchCondition(CafeSearchListRequest request) { return new CafeSearchCondition.Builder(request.isCanStudy(), request.getArea()) .maxTime(request.getMaxTime()) @@ -82,26 +84,26 @@ public CafeSearchCondition toCafeSearchCondition(CafeSearchRequest request) { .build(); } - public CafeResponse toCafeResponse( + public CafeSearchResponse toCafeSearchResponse( Cafe findCafe, - List businessHourResponses, - List snsResponses, - List reviewResponses, - List studyOnceForCafeResponses, + List cafeSearchBusinessHourResponses, + List cafeSearchSnsResponses, + List cafeSearchReviewResponses, + List cafeSearchStudyOnceResponses, OpenChecker openChecker) { - return CafeResponse.builder() + return CafeSearchResponse.builder() .basicInfo( - toCafeBasicInfoResponse( + toCafeSearchBasicInfoResponse( findCafe, - businessHourResponses, - snsResponses, + cafeSearchBusinessHourResponses, + cafeSearchSnsResponses, openChecker) ) .review( - reviewResponses + cafeSearchReviewResponses ) .meetings( - studyOnceForCafeResponses + cafeSearchStudyOnceResponses ) .canMakeMeeting( List.of(new CanMakeStudyOnceResponse(), new CanMakeStudyOnceResponse()) @@ -109,16 +111,16 @@ public CafeResponse toCafeResponse( .build(); } - public CafeResponse toCafeResponseWithEmptyInfo( + public CafeSearchResponse toCafeSearchResponseWithEmptyInfo( Cafe findCafe, - List businessHourResponses, - List snsResponses, - List reviewResponses, + List businessHourResponses, + List snsResponses, + List reviewResponses, OpenChecker openChecker ) { - return CafeResponse.builder() + return CafeSearchResponse.builder() .basicInfo( - toCafeBasicInfoResponse( + toCafeSearchBasicInfoResponse( findCafe, businessHourResponses, snsResponses, diff --git a/src/main/java/com/example/demo/mapper/MemberMapper.java b/src/main/java/com/example/demo/mapper/MemberMapper.java index e3dea553..83ed3419 100644 --- a/src/main/java/com/example/demo/mapper/MemberMapper.java +++ b/src/main/java/com/example/demo/mapper/MemberMapper.java @@ -1,16 +1,13 @@ package com.example.demo.mapper; import com.example.demo.domain.member.Member; -import com.example.demo.dto.WriterResponse; -import com.example.demo.dto.member.MemberResponse; +import com.example.demo.dto.study.StudyOnceSearchCommentWriterResponse; public class MemberMapper { - public WriterResponse toWriterResponse(Member member) { - return new WriterResponse(member.getId(), member.getName(), member.getThumbnailImage().getThumbnailImage()); + public StudyOnceSearchCommentWriterResponse toStudyOnceSearchCommentWriterResponse(Member member) { + return new StudyOnceSearchCommentWriterResponse(member.getId(), member.getName(), + member.getThumbnailImage().getThumbnailImage()); } - public MemberResponse toMemberResponse(Member member) { - return new MemberResponse(member.getId(), member.getName(), member.getThumbnailImage().getThumbnailImage()); - } } diff --git a/src/main/java/com/example/demo/mapper/ReviewMapper.java b/src/main/java/com/example/demo/mapper/ReviewMapper.java index b79cb196..f1a3d998 100644 --- a/src/main/java/com/example/demo/mapper/ReviewMapper.java +++ b/src/main/java/com/example/demo/mapper/ReviewMapper.java @@ -5,18 +5,21 @@ import com.example.demo.domain.member.Member; import com.example.demo.domain.review.Review; -import com.example.demo.dto.WriterResponse; +import com.example.demo.dto.cafe.CafeSearchReviewResponse; +import com.example.demo.dto.cafe.CafeSearchWriterResponse; import com.example.demo.dto.review.ReviewResponse; -import com.example.demo.dto.review.ReviewSearchResponse; +import com.example.demo.dto.review.ReviewSearchListResponse; +import com.example.demo.dto.review.ReviewWriterSearchListResponse; +import com.example.demo.dto.review.ReviewWriterSearchResponse; public class ReviewMapper { - public List toReviewSearchResponses(List reviews) { + public List toReviewSearchListResponses(List reviews) { return reviews.stream() .map(review -> - new ReviewSearchResponse( + new ReviewSearchListResponse( review.getId(), - produceWriterResponse( + makeReviewWriterSearchListResponse( review.getMember().getId(), review.getMember().getName(), review.getMember().getThumbnailImage().getThumbnailImage() ), @@ -26,15 +29,20 @@ public List toReviewSearchResponses(List reviews) .collect(Collectors.toList()); } - private WriterResponse produceWriterResponse(Long memberId, String name, String thumbnailImg) { - return new WriterResponse(memberId, name, thumbnailImg); + private ReviewWriterSearchListResponse makeReviewWriterSearchListResponse(Long memberId, String name, + String thumbnailImg) { + return new ReviewWriterSearchListResponse(memberId, name, thumbnailImg); + } + + private ReviewWriterSearchResponse makeReviewWriterSearchResponse(Long memberId, String name, String thumbnailImg) { + return new ReviewWriterSearchResponse(memberId, name, thumbnailImg); } public ReviewResponse toReviewResponse(Review findReview) { return ReviewResponse.builder() .reviewId(findReview.getId()) .writer( - produceWriterResponse( + makeReviewWriterSearchResponse( findReview.getMember().getId(), findReview.getMember().getName(), findReview.getMember().getThumbnailImage().getThumbnailImage() @@ -44,12 +52,12 @@ public ReviewResponse toReviewResponse(Review findReview) { .build(); } - public List toReviewResponses(List reviews) { + public List toCafeSearchReviewResponses(List reviews) { return reviews.stream() .map(review -> - produceReviewResponse( + makeCafeSearchReviewResponse( review.getId(), - productWriterResponse(review.getMember()), + makeCafeSearchWriterResponse(review.getMember()), review.getRate(), review.getContent() ) @@ -57,9 +65,11 @@ public List toReviewResponses(List reviews) { .collect(Collectors.toList()); } - private ReviewResponse produceReviewResponse(Long reviewId, WriterResponse writerResponse, double rate, + private CafeSearchReviewResponse makeCafeSearchReviewResponse(Long reviewId, + CafeSearchWriterResponse writerResponse, + double rate, String content) { - return ReviewResponse.builder() + return CafeSearchReviewResponse.builder() .reviewId(reviewId) .writer(writerResponse) .rate(rate) @@ -67,8 +77,8 @@ private ReviewResponse produceReviewResponse(Long reviewId, WriterResponse write .build(); } - private WriterResponse productWriterResponse(Member member) { - return new WriterResponse(member.getId(), + private CafeSearchWriterResponse makeCafeSearchWriterResponse(Member member) { + return new CafeSearchWriterResponse(member.getId(), member.getName(), member.getThumbnailImage().getThumbnailImage() ); diff --git a/src/main/java/com/example/demo/mapper/SnsDetailMapper.java b/src/main/java/com/example/demo/mapper/SnsDetailMapper.java index 0e2aeeda..a464db09 100644 --- a/src/main/java/com/example/demo/mapper/SnsDetailMapper.java +++ b/src/main/java/com/example/demo/mapper/SnsDetailMapper.java @@ -4,13 +4,13 @@ import java.util.stream.Collectors; import com.example.demo.domain.cafe.SnsDetail; -import com.example.demo.dto.cafe.SnsResponse; +import com.example.demo.dto.cafe.CafeSearchSnsResponse; public class SnsDetailMapper { - public List toSnsResponses(List snsDetails) { + public List toCafeSearchSnsResponses(List snsDetails) { return snsDetails.stream() - .map(snsDetail -> new SnsResponse(snsDetail.getName(), snsDetail.getUrl())) + .map(snsDetail -> new CafeSearchSnsResponse(snsDetail.getName(), snsDetail.getUrl())) .collect(Collectors.toList()); } } diff --git a/src/main/java/com/example/demo/mapper/StudyOnceCommentMapper.java b/src/main/java/com/example/demo/mapper/StudyOnceCommentMapper.java index 5b669fac..44a33944 100644 --- a/src/main/java/com/example/demo/mapper/StudyOnceCommentMapper.java +++ b/src/main/java/com/example/demo/mapper/StudyOnceCommentMapper.java @@ -2,7 +2,9 @@ import com.example.demo.domain.study.StudyOnceComment; import com.example.demo.dto.study.StudyOnceCommentInfo; +import com.example.demo.dto.study.StudyOnceCommentResponse; import com.example.demo.dto.study.StudyOnceReplyResponse; +import com.example.demo.dto.study.StudyOnceSearchCommentWriterResponse; public class StudyOnceCommentMapper { @@ -13,4 +15,9 @@ public StudyOnceCommentInfo toStudyOnceCommentInfo(StudyOnceComment comment) { public StudyOnceReplyResponse toStudyOnceReplyResponse(StudyOnceComment comment) { return new StudyOnceReplyResponse(comment.getId(), comment.getContent()); } + + public StudyOnceCommentResponse toStudyOnceCommentResponse(StudyOnceComment comment, + StudyOnceSearchCommentWriterResponse writerResponse) { + return new StudyOnceCommentResponse(comment.getId(), comment.getContent(), writerResponse); + } } diff --git a/src/main/java/com/example/demo/mapper/StudyOnceMapper.java b/src/main/java/com/example/demo/mapper/StudyOnceMapper.java index c50aa76b..b0c91dd8 100644 --- a/src/main/java/com/example/demo/mapper/StudyOnceMapper.java +++ b/src/main/java/com/example/demo/mapper/StudyOnceMapper.java @@ -6,22 +6,19 @@ import com.example.demo.domain.cafe.Cafe; import com.example.demo.domain.member.Member; import com.example.demo.domain.study.StudyOnce; -import com.example.demo.domain.study.StudyOnceComment; -import com.example.demo.dto.WriterResponse; -import com.example.demo.dto.study.StudyOnceCommentResponse; +import com.example.demo.dto.cafe.CafeSearchStudyOnceResponse; import com.example.demo.dto.study.StudyOnceCreateRequest; import com.example.demo.dto.study.StudyOnceCreateResponse; -import com.example.demo.dto.study.StudyOnceForCafeResponse; -import com.example.demo.dto.study.StudyOnceInfoResponse; +import com.example.demo.dto.study.StudyOnceResponse; import com.example.demo.dto.study.StudyOnceSearchListResponse; import com.example.demo.dto.study.StudyOnceSearchResponse; public class StudyOnceMapper { - public List toStudyOnceForCafeResponse(Cafe findCafe) { + public List toCafeSearchStudyOnceResponse(Cafe findCafe) { return findCafe.getStudyOnceGroup().stream() .map(studyOnce -> - StudyOnceForCafeResponse.builder() + CafeSearchStudyOnceResponse.builder() .cafeId(findCafe.getId()) .studyOnceId(studyOnce.getId()) .name(studyOnce.getName()) @@ -51,8 +48,8 @@ public StudyOnce toNewEntity(StudyOnceCreateRequest studyOnceCreateRequest, Cafe .build(); } - public StudyOnceInfoResponse toStudyOnceInfoResponse(StudyOnce saved, boolean canJoin) { - return StudyOnceInfoResponse.builder() + public StudyOnceResponse toStudyOnceResponse(StudyOnce saved, boolean canJoin) { + return StudyOnceResponse.builder() .cafeId(saved.getCafe().getId()) .area(saved.getCafe().getRegion()) .studyOnceId(saved.getId()) @@ -120,9 +117,4 @@ public StudyOnceCreateResponse toStudyOnceCreateResponse(StudyOnce saved, boolea .build(); } - public StudyOnceCommentResponse toStudyOnceQuestionResponse(StudyOnceComment question, - WriterResponse writerResponse) { - return new StudyOnceCommentResponse(question.getId(), question.getContent(), writerResponse); - } - } diff --git a/src/main/java/com/example/demo/service/cafe/CafeService.java b/src/main/java/com/example/demo/service/cafe/CafeService.java index 61deff5a..dd4f6dc7 100644 --- a/src/main/java/com/example/demo/service/cafe/CafeService.java +++ b/src/main/java/com/example/demo/service/cafe/CafeService.java @@ -1,18 +1,18 @@ package com.example.demo.service.cafe; import com.example.demo.dto.PagedResponse; -import com.example.demo.dto.cafe.CafeResponse; -import com.example.demo.dto.cafe.CafeSearchRequest; +import com.example.demo.dto.cafe.CafeSearchListRequest; +import com.example.demo.dto.cafe.CafeSearchListResponse; import com.example.demo.dto.cafe.CafeSearchResponse; public interface CafeService { - PagedResponse searchWithPagingByDynamicFilter(CafeSearchRequest request); + PagedResponse searchWithPagingByDynamicFilter(CafeSearchListRequest request); - CafeSearchResponse searchCafeBasicInfoById(Long cafeId); + CafeSearchListResponse searchCafeBasicInfoById(Long cafeId); - CafeResponse searchCafeForMemberByCafeId(Long cafeId, Long memberId); + CafeSearchResponse searchCafeForMemberByCafeId(Long cafeId, Long memberId); - CafeResponse searchCafeForNotMemberByCafeId(Long cafeId); + CafeSearchResponse searchCafeForNotMemberByCafeId(Long cafeId); } diff --git a/src/main/java/com/example/demo/service/cafe/CafeServiceImpl.java b/src/main/java/com/example/demo/service/cafe/CafeServiceImpl.java index e0b7910f..d72fba53 100644 --- a/src/main/java/com/example/demo/service/cafe/CafeServiceImpl.java +++ b/src/main/java/com/example/demo/service/cafe/CafeServiceImpl.java @@ -15,8 +15,8 @@ import com.example.demo.domain.cafe.CafeSearchCondition; import com.example.demo.domain.cafe.OpenChecker; import com.example.demo.dto.PagedResponse; -import com.example.demo.dto.cafe.CafeResponse; -import com.example.demo.dto.cafe.CafeSearchRequest; +import com.example.demo.dto.cafe.CafeSearchListRequest; +import com.example.demo.dto.cafe.CafeSearchListResponse; import com.example.demo.dto.cafe.CafeSearchResponse; import com.example.demo.exception.CafegoryException; import com.example.demo.mapper.BusinessHourMapper; @@ -47,18 +47,18 @@ public class CafeServiceImpl implements CafeService { private final StudyOnceMapper studyOnceMapper; @Override - public PagedResponse searchWithPagingByDynamicFilter(CafeSearchRequest request) { + public PagedResponse searchWithPagingByDynamicFilter(CafeSearchListRequest request) { Pageable pageable = PageRequestCustom.of(request.getPage(), request.getSizePerPage()); CafeSearchCondition cafeSearchCondition = cafeMapper.toCafeSearchCondition(request); Page pagedCafes = cafeQueryDslRepository.findWithDynamicFilter(cafeSearchCondition, pageable); return createPagedResponse(pagedCafes, - cafeMapper.toCafeSearchResponses(pagedCafes.getContent(), openChecker)); + cafeMapper.toCafeSearchListResponses(pagedCafes.getContent(), openChecker)); } @Override - public CafeSearchResponse searchCafeBasicInfoById(Long cafeId) { + public CafeSearchListResponse searchCafeBasicInfoById(Long cafeId) { return cafeMapper.toCafeSearchResponse(findCafeById(cafeId), openChecker); } @@ -68,40 +68,40 @@ private Cafe findCafeById(Long cafeId) { } @Override - public CafeResponse searchCafeForMemberByCafeId(Long cafeId, Long memberId) { + public CafeSearchResponse searchCafeForMemberByCafeId(Long cafeId, Long memberId) { Cafe findCafe = findCafeById(cafeId); if (!memberRepository.existsById(memberId)) { throw new CafegoryException(MEMBER_NOT_FOUND); } - return cafeMapper.toCafeResponse( + return cafeMapper.toCafeSearchResponse( findCafe, - businessHourMapper.toBusinessHourResponses(findCafe.getBusinessHours()), - snsDetailMapper.toSnsResponses(findCafe.getSnsDetails()), - reviewMapper.toReviewResponses(findCafe.getReviews()), - studyOnceMapper.toStudyOnceForCafeResponse(findCafe), + businessHourMapper.toCafeSearchBusinessHourResponses(findCafe.getBusinessHours()), + snsDetailMapper.toCafeSearchSnsResponses(findCafe.getSnsDetails()), + reviewMapper.toCafeSearchReviewResponses(findCafe.getReviews()), + studyOnceMapper.toCafeSearchStudyOnceResponse(findCafe), openChecker ); } @Override - public CafeResponse searchCafeForNotMemberByCafeId(Long cafeId) { + public CafeSearchResponse searchCafeForNotMemberByCafeId(Long cafeId) { Cafe findCafe = findCafeById(cafeId); - return cafeMapper.toCafeResponseWithEmptyInfo( + return cafeMapper.toCafeSearchResponseWithEmptyInfo( findCafe, - businessHourMapper.toBusinessHourResponses(findCafe.getBusinessHours()), - snsDetailMapper.toSnsResponses(findCafe.getSnsDetails()), - reviewMapper.toReviewResponses(findCafe.getReviews()), + businessHourMapper.toCafeSearchBusinessHourResponses(findCafe.getBusinessHours()), + snsDetailMapper.toCafeSearchSnsResponses(findCafe.getSnsDetails()), + reviewMapper.toCafeSearchReviewResponses(findCafe.getReviews()), openChecker ); } - private PagedResponse createPagedResponse(Page pagedCafes, - List cafeSearchResponses) { + private PagedResponse createPagedResponse(Page pagedCafes, + List cafeSearchListResponse) { return PagedResponse.createWithFirstPageAsOne( pagedCafes.getNumber(), pagedCafes.getTotalPages(), pagedCafes.getNumberOfElements(), - cafeSearchResponses + cafeSearchListResponse ); } diff --git a/src/main/java/com/example/demo/service/email/MailService.java b/src/main/java/com/example/demo/service/email/MailService.java index adcfbfc1..4af07bb5 100644 --- a/src/main/java/com/example/demo/service/email/MailService.java +++ b/src/main/java/com/example/demo/service/email/MailService.java @@ -1,12 +1,13 @@ package com.example.demo.service.email; import com.example.demo.dto.email.CustomEmailSendRequest; +import com.example.demo.dto.email.EmailSendCustomTemplateResponse; import com.example.demo.dto.email.EmailSendRequest; -import com.example.demo.dto.email.EmailTemplateResponse; +import com.example.demo.dto.email.EmailSendTemplateResponse; public interface MailService { - EmailTemplateResponse sendEmail(EmailSendRequest request); + EmailSendTemplateResponse sendEmail(EmailSendRequest request); - EmailTemplateResponse sendCustomEmail(CustomEmailSendRequest request); + EmailSendCustomTemplateResponse sendCustomEmail(CustomEmailSendRequest request); } diff --git a/src/main/java/com/example/demo/service/email/MailServiceImpl.java b/src/main/java/com/example/demo/service/email/MailServiceImpl.java index b312308a..9d5990d0 100644 --- a/src/main/java/com/example/demo/service/email/MailServiceImpl.java +++ b/src/main/java/com/example/demo/service/email/MailServiceImpl.java @@ -8,8 +8,9 @@ import com.example.demo.domain.email.EmailTemplate; import com.example.demo.domain.member.Member; import com.example.demo.dto.email.CustomEmailSendRequest; +import com.example.demo.dto.email.EmailSendCustomTemplateResponse; import com.example.demo.dto.email.EmailSendRequest; -import com.example.demo.dto.email.EmailTemplateResponse; +import com.example.demo.dto.email.EmailSendTemplateResponse; import com.example.demo.exception.CafegoryException; import com.example.demo.repository.member.MemberRepository; @@ -23,22 +24,22 @@ public class MailServiceImpl implements MailService { private final MemberRepository memberRepository; @Override - public EmailTemplateResponse sendEmail(EmailSendRequest request) { + public EmailSendTemplateResponse sendEmail(EmailSendRequest request) { EmailTemplate template = EmailTemplate.valueOf(request.getMessageType()); for (Long memberId : request.getMemberIds()) { emailSender.sendSimpleMessage(findMemberById(memberId).getEmail(), template.getSubject(), template.getContent()); } - return new EmailTemplateResponse(template.getSubject(), template.getContent()); + return new EmailSendTemplateResponse(template.getSubject(), template.getContent()); } @Override - public EmailTemplateResponse sendCustomEmail(CustomEmailSendRequest request) { + public EmailSendCustomTemplateResponse sendCustomEmail(CustomEmailSendRequest request) { for (Long memberId : request.getMemberIds()) { emailSender.sendSimpleMessage(findMemberById(memberId).getEmail(), request.getTitle(), request.getContent()); } - return new EmailTemplateResponse(request.getTitle(), request.getContent()); + return new EmailSendCustomTemplateResponse(request.getTitle(), request.getContent()); } private Member findMemberById(Long memberId) { diff --git a/src/main/java/com/example/demo/service/profile/ProfileService.java b/src/main/java/com/example/demo/service/profile/ProfileService.java index f9c7e769..cd1d0957 100644 --- a/src/main/java/com/example/demo/service/profile/ProfileService.java +++ b/src/main/java/com/example/demo/service/profile/ProfileService.java @@ -2,15 +2,16 @@ import java.time.LocalDateTime; -import com.example.demo.dto.profile.ProfileResponse; +import com.example.demo.dto.profile.ProfileGetResponse; import com.example.demo.dto.profile.ProfileUpdateRequest; +import com.example.demo.dto.profile.ProfileUpdateResponse; public interface ProfileService { - default ProfileResponse get(Long requestMemberID, Long targetMemberID) { - return get(requestMemberID, targetMemberID, LocalDateTime.now()); + default ProfileGetResponse get(Long requestMemberId, Long targetMemberId) { + return get(requestMemberId, targetMemberId, LocalDateTime.now()); } - ProfileResponse get(Long requestMemberID, Long targetMemberID, LocalDateTime baseDateTime); + ProfileGetResponse get(Long requestMemberId, Long targetMemberId, LocalDateTime baseDateTime); - ProfileResponse update(Long requestMemberId, Long targetMemberId, ProfileUpdateRequest profileUpdateRequest); + ProfileUpdateResponse update(Long requestMemberId, Long targetMemberId, ProfileUpdateRequest profileUpdateRequest); } diff --git a/src/main/java/com/example/demo/service/profile/ProfileServiceImpl.java b/src/main/java/com/example/demo/service/profile/ProfileServiceImpl.java index 1b405f28..83319986 100644 --- a/src/main/java/com/example/demo/service/profile/ProfileServiceImpl.java +++ b/src/main/java/com/example/demo/service/profile/ProfileServiceImpl.java @@ -15,8 +15,9 @@ import com.example.demo.domain.member.Member; import com.example.demo.domain.study.StudyMember; import com.example.demo.domain.study.StudyOnce; -import com.example.demo.dto.profile.ProfileResponse; +import com.example.demo.dto.profile.ProfileGetResponse; import com.example.demo.dto.profile.ProfileUpdateRequest; +import com.example.demo.dto.profile.ProfileUpdateResponse; import com.example.demo.exception.CafegoryException; import com.example.demo.repository.member.MemberRepository; import com.example.demo.repository.study.StudyMemberRepository; @@ -33,28 +34,28 @@ public class ProfileServiceImpl implements ProfileService { private final StudyMemberRepository studyMemberRepository; @Override - public ProfileResponse get(Long requestMemberID, Long targetMemberID, LocalDateTime baseDateTime) { + public ProfileGetResponse get(Long requestMemberID, Long targetMemberID, LocalDateTime baseDateTime) { if (isOwnerOfProfile(requestMemberID, targetMemberID)) { - return makeProfileResponse(targetMemberID); + return makeProfileGetResponse(targetMemberID); } if (isAllowedCauseStudyLeader(requestMemberID, targetMemberID)) { - return makeProfileResponse(targetMemberID); + return makeProfileGetResponse(targetMemberID); } if (isAllowedCauseSameStudyOnceMember(requestMemberID, targetMemberID, baseDateTime)) { - return makeProfileResponse(targetMemberID); + return makeProfileGetResponse(targetMemberID); } throw new CafegoryException(PROFILE_GET_PERMISSION_DENIED); } @Override - public ProfileResponse update(Long requestMemberId, Long targetMemberId, + public ProfileUpdateResponse update(Long requestMemberId, Long targetMemberId, ProfileUpdateRequest profileUpdateRequest) { validateProfileUpdatePermission(requestMemberId, targetMemberId); Member targetMember = findTargetMember(targetMemberId); String name = profileUpdateRequest.getName(); String introduction = profileUpdateRequest.getIntroduction(); targetMember.updateProfile(name, introduction); - return makeProfileResponse(targetMemberId); + return makeProfileUpdateResponse(targetMemberId); } private void validateProfileUpdatePermission(Long requestMemberId, Long targetMemberId) { @@ -71,9 +72,15 @@ private Member findTargetMember(Long targetMemberId) { return targetMember.get(); } - private ProfileResponse makeProfileResponse(Long targetMemberID) { + private ProfileGetResponse makeProfileGetResponse(Long targetMemberID) { Member member = memberRepository.findById(targetMemberID).orElseThrow(); - return new ProfileResponse(member.getName(), member.getThumbnailImage().getThumbnailImage(), + return new ProfileGetResponse(member.getName(), member.getThumbnailImage().getThumbnailImage(), + member.getIntroduction()); + } + + private ProfileUpdateResponse makeProfileUpdateResponse(Long targetMemberID) { + Member member = memberRepository.findById(targetMemberID).orElseThrow(); + return new ProfileUpdateResponse(member.getName(), member.getThumbnailImage().getThumbnailImage(), member.getIntroduction()); } diff --git a/src/main/java/com/example/demo/service/review/ReviewQueryService.java b/src/main/java/com/example/demo/service/review/ReviewQueryService.java index d2383777..3dff240d 100644 --- a/src/main/java/com/example/demo/service/review/ReviewQueryService.java +++ b/src/main/java/com/example/demo/service/review/ReviewQueryService.java @@ -2,12 +2,12 @@ import com.example.demo.dto.PagedResponse; import com.example.demo.dto.review.ReviewResponse; -import com.example.demo.dto.review.ReviewSearchRequest; -import com.example.demo.dto.review.ReviewSearchResponse; +import com.example.demo.dto.review.ReviewSearchListRequest; +import com.example.demo.dto.review.ReviewSearchListResponse; public interface ReviewQueryService { - PagedResponse searchWithPagingByCafeId(ReviewSearchRequest request); + PagedResponse searchWithPagingByCafeId(ReviewSearchListRequest request); ReviewResponse searchOne(Long reviewId); } diff --git a/src/main/java/com/example/demo/service/review/ReviewQueryServiceImpl.java b/src/main/java/com/example/demo/service/review/ReviewQueryServiceImpl.java index 0a56ba1f..dc7fefc8 100644 --- a/src/main/java/com/example/demo/service/review/ReviewQueryServiceImpl.java +++ b/src/main/java/com/example/demo/service/review/ReviewQueryServiceImpl.java @@ -12,8 +12,8 @@ import com.example.demo.domain.review.Review; import com.example.demo.dto.PagedResponse; import com.example.demo.dto.review.ReviewResponse; -import com.example.demo.dto.review.ReviewSearchRequest; -import com.example.demo.dto.review.ReviewSearchResponse; +import com.example.demo.dto.review.ReviewSearchListRequest; +import com.example.demo.dto.review.ReviewSearchListResponse; import com.example.demo.exception.CafegoryException; import com.example.demo.mapper.ReviewMapper; import com.example.demo.repository.cafe.CafeRepository; @@ -32,13 +32,13 @@ public class ReviewQueryServiceImpl implements ReviewQueryService { private final ReviewMapper reviewMapper; @Override - public PagedResponse searchWithPagingByCafeId(ReviewSearchRequest request) { + public PagedResponse searchWithPagingByCafeId(ReviewSearchListRequest request) { validateExistCafe(request.getCafeId()); Pageable pageable = PageRequestCustom.of(request.getPage(), request.getSizePerPage()); Page pagedReviews = reviewRepository.findAllWithPagingByCafeId(request.getCafeId(), pageable); return createPagedResponse(pagedReviews, - reviewMapper.toReviewSearchResponses(pagedReviews.getContent())); + reviewMapper.toReviewSearchListResponses(pagedReviews.getContent())); } @Override @@ -57,13 +57,13 @@ private void validateExistCafe(Long cafeId) { } } - private PagedResponse createPagedResponse(Page pagedReviews, - List reviewSearchResponse) { + private PagedResponse createPagedResponse(Page pagedReviews, + List reviewSearchListResponse) { return PagedResponse.createWithFirstPageAsOne( pagedReviews.getNumber(), pagedReviews.getTotalPages(), pagedReviews.getNumberOfElements(), - reviewSearchResponse + reviewSearchListResponse ); } diff --git a/src/main/java/com/example/demo/service/study/StudyOnceCommentQueryService.java b/src/main/java/com/example/demo/service/study/StudyOnceCommentQueryService.java index 4acc0858..927e3c23 100644 --- a/src/main/java/com/example/demo/service/study/StudyOnceCommentQueryService.java +++ b/src/main/java/com/example/demo/service/study/StudyOnceCommentQueryService.java @@ -1,8 +1,8 @@ package com.example.demo.service.study; -import com.example.demo.dto.study.StudyOnceCommentsSearchResponse; +import com.example.demo.dto.study.StudyOnceCommentSearchListResponse; public interface StudyOnceCommentQueryService { - StudyOnceCommentsSearchResponse searchSortedCommentsByStudyOnceId(Long studyOnceId); + StudyOnceCommentSearchListResponse searchSortedCommentsByStudyOnceId(Long studyOnceId); } diff --git a/src/main/java/com/example/demo/service/study/StudyOnceCommentQueryServiceImpl.java b/src/main/java/com/example/demo/service/study/StudyOnceCommentQueryServiceImpl.java index 312938a9..2204aa10 100644 --- a/src/main/java/com/example/demo/service/study/StudyOnceCommentQueryServiceImpl.java +++ b/src/main/java/com/example/demo/service/study/StudyOnceCommentQueryServiceImpl.java @@ -11,8 +11,8 @@ import com.example.demo.domain.study.StudyOnce; import com.example.demo.domain.study.StudyOnceComment; +import com.example.demo.dto.study.StudyOnceCommentSearchListResponse; import com.example.demo.dto.study.StudyOnceCommentSearchResponse; -import com.example.demo.dto.study.StudyOnceCommentsSearchResponse; import com.example.demo.exception.CafegoryException; import com.example.demo.mapper.MemberMapper; import com.example.demo.mapper.StudyOnceCommentMapper; @@ -32,18 +32,19 @@ public class StudyOnceCommentQueryServiceImpl implements StudyOnceCommentQuerySe private final StudyOnceCommentMapper studyOnceCommentMapper; @Override - public StudyOnceCommentsSearchResponse searchSortedCommentsByStudyOnceId(Long studyOnceId) { + public StudyOnceCommentSearchListResponse searchSortedCommentsByStudyOnceId(Long studyOnceId) { List comments = studyOnceCommentRepository.findAllByStudyOnceId(studyOnceId); Map commentMap = comments.stream() .collect(Collectors.toMap(StudyOnceComment::getId, comment -> comment)); - StudyOnceCommentsSearchResponse response = new StudyOnceCommentsSearchResponse( - memberMapper.toMemberResponse(findStudyOnceById(studyOnceId).getLeader())); + StudyOnceCommentSearchListResponse response = new StudyOnceCommentSearchListResponse( + memberMapper.toStudyOnceSearchCommentWriterResponse(findStudyOnceById(studyOnceId).getLeader())); for (StudyOnceComment comment : comments) { StudyOnceCommentSearchResponse commentSearchResponse = new StudyOnceCommentSearchResponse(); if (!comment.hasParentComment()) { - commentSearchResponse.setQuestionWriter(memberMapper.toMemberResponse(comment.getMember())); + commentSearchResponse.setQuestionWriter( + memberMapper.toStudyOnceSearchCommentWriterResponse(comment.getMember())); commentSearchResponse.setQuestionInfo(studyOnceCommentMapper.toStudyOnceCommentInfo(comment)); for (StudyOnceComment childComment : comment.getChildren()) { commentSearchResponse.addStudyOnceReplyResponse( diff --git a/src/main/java/com/example/demo/service/study/StudyOnceCommentService.java b/src/main/java/com/example/demo/service/study/StudyOnceCommentService.java index dda2e120..e08d6a97 100644 --- a/src/main/java/com/example/demo/service/study/StudyOnceCommentService.java +++ b/src/main/java/com/example/demo/service/study/StudyOnceCommentService.java @@ -1,11 +1,12 @@ package com.example.demo.service.study; import com.example.demo.dto.study.StudyOnceCommentRequest; +import com.example.demo.dto.study.StudyOnceCommentSaveRequest; import com.example.demo.dto.study.StudyOnceCommentUpdateRequest; public interface StudyOnceCommentService { - Long saveQuestion(Long memberId, Long studyOnceId, StudyOnceCommentRequest request); + Long saveQuestion(Long memberId, Long studyOnceId, StudyOnceCommentSaveRequest request); void updateQuestion(Long memberId, Long studyOnceCommentId, StudyOnceCommentUpdateRequest request); diff --git a/src/main/java/com/example/demo/service/study/StudyOnceCommentServiceImpl.java b/src/main/java/com/example/demo/service/study/StudyOnceCommentServiceImpl.java index 5b90bf61..dae91da7 100644 --- a/src/main/java/com/example/demo/service/study/StudyOnceCommentServiceImpl.java +++ b/src/main/java/com/example/demo/service/study/StudyOnceCommentServiceImpl.java @@ -9,6 +9,7 @@ import com.example.demo.domain.study.StudyOnce; import com.example.demo.domain.study.StudyOnceComment; import com.example.demo.dto.study.StudyOnceCommentRequest; +import com.example.demo.dto.study.StudyOnceCommentSaveRequest; import com.example.demo.dto.study.StudyOnceCommentUpdateRequest; import com.example.demo.exception.CafegoryException; import com.example.demo.repository.member.MemberRepository; @@ -27,7 +28,7 @@ public class StudyOnceCommentServiceImpl implements StudyOnceCommentService { private final StudyOnceRepository studyOnceRepository; @Override - public Long saveQuestion(Long memberId, Long studyOnceId, StudyOnceCommentRequest request) { + public Long saveQuestion(Long memberId, Long studyOnceId, StudyOnceCommentSaveRequest request) { StudyOnceComment question = StudyOnceComment.builder() .content(request.getContent()) .member(findMemberById(memberId)) diff --git a/src/main/java/com/example/demo/service/study/StudyOnceQAndAQueryServiceImpl.java b/src/main/java/com/example/demo/service/study/StudyOnceQAndAQueryServiceImpl.java index 15118231..f65c7cb7 100644 --- a/src/main/java/com/example/demo/service/study/StudyOnceQAndAQueryServiceImpl.java +++ b/src/main/java/com/example/demo/service/study/StudyOnceQAndAQueryServiceImpl.java @@ -6,10 +6,11 @@ import org.springframework.transaction.annotation.Transactional; import com.example.demo.domain.study.StudyOnceComment; -import com.example.demo.dto.WriterResponse; import com.example.demo.dto.study.StudyOnceCommentResponse; +import com.example.demo.dto.study.StudyOnceSearchCommentWriterResponse; import com.example.demo.exception.CafegoryException; import com.example.demo.mapper.MemberMapper; +import com.example.demo.mapper.StudyOnceCommentMapper; import com.example.demo.mapper.StudyOnceMapper; import com.example.demo.repository.study.StudyOnceCommentRepository; @@ -23,12 +24,14 @@ public class StudyOnceQAndAQueryServiceImpl implements StudyOnceQAndAQueryServic private final StudyOnceCommentRepository studyOnceCommentRepository; private final MemberMapper memberMapper; private final StudyOnceMapper studyOnceMapper; + private final StudyOnceCommentMapper studyOnceCommentMapper; @Override public StudyOnceCommentResponse searchComment(Long studyOnceCommentId) { StudyOnceComment question = findStudyOnceCommentById(studyOnceCommentId); - WriterResponse writerResponse = memberMapper.toWriterResponse(question.getMember()); - return studyOnceMapper.toStudyOnceQuestionResponse(question, writerResponse); + StudyOnceSearchCommentWriterResponse writerResponse = memberMapper.toStudyOnceSearchCommentWriterResponse( + question.getMember()); + return studyOnceCommentMapper.toStudyOnceCommentResponse(question, writerResponse); } private StudyOnceComment findStudyOnceCommentById(Long studyOnceCommentId) { diff --git a/src/main/java/com/example/demo/service/study/StudyOnceService.java b/src/main/java/com/example/demo/service/study/StudyOnceService.java index a7654320..c530d9bc 100644 --- a/src/main/java/com/example/demo/service/study/StudyOnceService.java +++ b/src/main/java/com/example/demo/service/study/StudyOnceService.java @@ -4,10 +4,10 @@ import com.example.demo.domain.study.Attendance; import com.example.demo.dto.PagedResponse; -import com.example.demo.dto.study.StudyMembersResponse; +import com.example.demo.dto.study.StudyMemberListResponse; import com.example.demo.dto.study.StudyOnceCreateRequest; import com.example.demo.dto.study.StudyOnceCreateResponse; -import com.example.demo.dto.study.StudyOnceInfoResponse; +import com.example.demo.dto.study.StudyOnceResponse; import com.example.demo.dto.study.StudyOnceSearchListResponse; import com.example.demo.dto.study.StudyOnceSearchRequest; import com.example.demo.dto.study.StudyOnceSearchResponse; @@ -35,9 +35,9 @@ UpdateAttendanceResponse updateAttendances(long leaderId, long studyOnceId, Long changeCafe(Long requestMemberId, Long studyOnceId, Long changingCafeId); - StudyMembersResponse findStudyMembersById(Long studyOnceId); + StudyMemberListResponse findStudyMembersById(Long studyOnceId); - StudyOnceInfoResponse findStudyOnce(Long studyOnceId, LocalDateTime now); + StudyOnceResponse findStudyOnce(Long studyOnceId, LocalDateTime now); boolean doesOnlyStudyLeaderExist(Long studyOnceId); diff --git a/src/main/java/com/example/demo/service/study/StudyOnceServiceImpl.java b/src/main/java/com/example/demo/service/study/StudyOnceServiceImpl.java index 2cbb8adb..6a46afeb 100644 --- a/src/main/java/com/example/demo/service/study/StudyOnceServiceImpl.java +++ b/src/main/java/com/example/demo/service/study/StudyOnceServiceImpl.java @@ -18,12 +18,12 @@ import com.example.demo.domain.study.StudyOnce; import com.example.demo.dto.PagedResponse; import com.example.demo.dto.member.MemberResponse; +import com.example.demo.dto.study.StudyMemberListResponse; import com.example.demo.dto.study.StudyMemberStateRequest; import com.example.demo.dto.study.StudyMemberStateResponse; -import com.example.demo.dto.study.StudyMembersResponse; import com.example.demo.dto.study.StudyOnceCreateRequest; import com.example.demo.dto.study.StudyOnceCreateResponse; -import com.example.demo.dto.study.StudyOnceInfoResponse; +import com.example.demo.dto.study.StudyOnceResponse; import com.example.demo.dto.study.StudyOnceSearchListResponse; import com.example.demo.dto.study.StudyOnceSearchRequest; import com.example.demo.dto.study.StudyOnceSearchResponse; @@ -248,16 +248,16 @@ public Long changeCafe(Long requestMemberId, Long studyOnceId, final Long changi } @Override - public StudyMembersResponse findStudyMembersById(Long studyOnceId) { + public StudyMemberListResponse findStudyMembersById(Long studyOnceId) { StudyOnce studyOnce = findStudyOnceById(studyOnceId); List memberResponses = studyMemberMapper.toMemberResponses(studyOnce.getStudyMembers()); - return new StudyMembersResponse(memberResponses); + return new StudyMemberListResponse(memberResponses); } @Override - public StudyOnceInfoResponse findStudyOnce(Long studyOnceId, LocalDateTime now) { + public StudyOnceResponse findStudyOnce(Long studyOnceId, LocalDateTime now) { StudyOnce studyOnce = findStudyOnceById(studyOnceId); - return studyOnceMapper.toStudyOnceInfoResponse(studyOnce, studyOnce.canJoin(now)); + return studyOnceMapper.toStudyOnceResponse(studyOnce, studyOnce.canJoin(now)); } @Override diff --git a/src/test/java/com/example/demo/service/profile/ProfileServiceImplTest.java b/src/test/java/com/example/demo/service/profile/ProfileServiceImplTest.java index 7510b4cb..dcbd572a 100644 --- a/src/test/java/com/example/demo/service/profile/ProfileServiceImplTest.java +++ b/src/test/java/com/example/demo/service/profile/ProfileServiceImplTest.java @@ -15,8 +15,8 @@ import com.example.demo.domain.member.Member; import com.example.demo.domain.study.StudyMember; import com.example.demo.domain.study.StudyOnce; -import com.example.demo.dto.profile.ProfileResponse; import com.example.demo.dto.profile.ProfileUpdateRequest; +import com.example.demo.dto.profile.ProfileUpdateResponse; import com.example.demo.dto.study.StudyOnceCreateRequest; import com.example.demo.dto.study.StudyOnceCreateResponse; import com.example.demo.exception.CafegoryException; @@ -111,8 +111,8 @@ void failWhenOtherCase() { void updateSuccessWhenSelf() { long requestMemberId = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE).getId(); ProfileUpdateRequest profileUpdateRequest = new ProfileUpdateRequest("name", "introduction"); - ProfileResponse update = profileService.update(requestMemberId, requestMemberId, profileUpdateRequest); - Assertions.assertEquals(update, new ProfileResponse("name", "testUrl", "introduction")); + ProfileUpdateResponse update = profileService.update(requestMemberId, requestMemberId, profileUpdateRequest); + Assertions.assertEquals(update, new ProfileUpdateResponse("name", "testUrl", "introduction")); } @Test diff --git a/src/test/java/com/example/demo/service/study/StudyOnceCommentQueryServiceImplTest.java b/src/test/java/com/example/demo/service/study/StudyOnceCommentQueryServiceImplTest.java index 93e7c85f..35132f21 100644 --- a/src/test/java/com/example/demo/service/study/StudyOnceCommentQueryServiceImplTest.java +++ b/src/test/java/com/example/demo/service/study/StudyOnceCommentQueryServiceImplTest.java @@ -12,6 +12,7 @@ import com.example.demo.domain.member.Member; import com.example.demo.domain.study.StudyOnce; import com.example.demo.dto.study.StudyOnceCommentRequest; +import com.example.demo.dto.study.StudyOnceCommentSaveRequest; import com.example.demo.dto.study.StudyOnceCommentSearchResponse; import com.example.demo.dto.study.StudyOnceReplyResponse; import com.example.demo.repository.member.InMemoryMemberRepository; @@ -39,7 +40,7 @@ void searchCommentsSortedByStudyOnceId() { Member leader = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE); Cafe cafe = cafePersistHelper.persistDefaultCafe(); StudyOnce studyOnce = studyOncePersistHelper.persistDefaultStudyOnce(cafe, leader); - StudyOnceCommentRequest questionRequest = new StudyOnceCommentRequest("질문"); + StudyOnceCommentSaveRequest questionRequest = new StudyOnceCommentSaveRequest("질문"); Member member = memberPersistHelper.persistDefaultMember(THUMBNAIL_IMAGE); Long questionId = studyOnceCommentService.saveQuestion(member.getId(), studyOnce.getId(), questionRequest); StudyOnceCommentRequest replyRequest = new StudyOnceCommentRequest("답변"); diff --git a/src/test/java/com/example/demo/service/study/StudyOnceCommentServiceImplTest.java b/src/test/java/com/example/demo/service/study/StudyOnceCommentServiceImplTest.java index 4f42f47e..e387986b 100644 --- a/src/test/java/com/example/demo/service/study/StudyOnceCommentServiceImplTest.java +++ b/src/test/java/com/example/demo/service/study/StudyOnceCommentServiceImplTest.java @@ -13,6 +13,7 @@ import com.example.demo.domain.study.StudyOnce; import com.example.demo.domain.study.StudyOnceComment; import com.example.demo.dto.study.StudyOnceCommentRequest; +import com.example.demo.dto.study.StudyOnceCommentSaveRequest; import com.example.demo.dto.study.StudyOnceCommentUpdateRequest; import com.example.demo.exception.CafegoryException; import com.example.demo.exception.ExceptionType; @@ -41,7 +42,7 @@ void save_question() { StudyOnce studyOnce = studyOncePersistHelper.persistDefaultStudyOnce(cafe, leader); //when studyOnceCommentService.saveQuestion(otherPerson.getId(), studyOnce.getId(), - new StudyOnceCommentRequest("몇시까지 공부하시나요?")); + new StudyOnceCommentSaveRequest("몇시까지 공부하시나요?")); List questions = studyOnceCommentRepository.findAll(); //then assertThat(questions.size()).isEqualTo(1); @@ -56,7 +57,7 @@ void save_question_by_leader() { StudyOnce studyOnce = studyOncePersistHelper.persistDefaultStudyOnce(cafe, leader); //when studyOnceCommentService.saveQuestion(leader.getId(), studyOnce.getId(), - new StudyOnceCommentRequest("카페 끝날때까지 공부합니다.")); + new StudyOnceCommentSaveRequest("카페 끝날때까지 공부합니다.")); List questions = studyOnceCommentRepository.findAll(); //then assertThat(questions.size()).isEqualTo(1); diff --git a/src/test/java/com/example/demo/service/study/StudyOnceQAndAQueryServiceImplTest.java b/src/test/java/com/example/demo/service/study/StudyOnceQAndAQueryServiceImplTest.java index ba68b68a..3ea51a80 100644 --- a/src/test/java/com/example/demo/service/study/StudyOnceQAndAQueryServiceImplTest.java +++ b/src/test/java/com/example/demo/service/study/StudyOnceQAndAQueryServiceImplTest.java @@ -16,7 +16,7 @@ class StudyOnceQAndAQueryServiceImplTest extends ServiceTest { private final InMemoryStudyOnceCommentRepository studyOnceCommentRepository = InMemoryStudyOnceCommentRepository.INSTANCE; private final StudyOnceQAndAQueryService studyOnceQAndAQueryService = new StudyOnceQAndAQueryServiceImpl( - studyOnceCommentRepository, memberMapper, studyOnceMapper); + studyOnceCommentRepository, memberMapper, studyOnceMapper, studyOnceCommentMapper); @Test @DisplayName("카공 질문을 찾는다") diff --git a/src/test/java/com/example/demo/service/study/StudyOnceServiceImplTest.java b/src/test/java/com/example/demo/service/study/StudyOnceServiceImplTest.java index c96208cc..a17445a4 100644 --- a/src/test/java/com/example/demo/service/study/StudyOnceServiceImplTest.java +++ b/src/test/java/com/example/demo/service/study/StudyOnceServiceImplTest.java @@ -24,8 +24,8 @@ import com.example.demo.domain.study.StudyOnce; import com.example.demo.dto.PagedResponse; import com.example.demo.dto.member.MemberResponse; +import com.example.demo.dto.study.StudyMemberListResponse; import com.example.demo.dto.study.StudyMemberStateRequest; -import com.example.demo.dto.study.StudyMembersResponse; import com.example.demo.dto.study.StudyOnceCreateRequest; import com.example.demo.dto.study.StudyOnceCreateResponse; import com.example.demo.dto.study.StudyOnceSearchListResponse; @@ -619,7 +619,7 @@ void findStudyMembers() { studyOnceService.tryJoin(memberId, studyOnceId); syncStudyOnceRepositoryAndStudyMemberRepository(); - StudyMembersResponse studyMembersById = studyOnceService.findStudyMembersById(studyOnceId); + StudyMemberListResponse studyMembersById = studyOnceService.findStudyMembersById(studyOnceId); List actualStudyMemberIds = studyMembersById.getJoinedMembers().stream() .map(MemberResponse::getMemberId) .collect(Collectors.toList());