-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BE] docs: 작성한 리뷰 목록 조회, 회원용 리뷰 그룹 생성, 리뷰 그룹 정보, 리뷰 등록 API 문서를 작성한다. #1017
base: develop
Are you sure you want to change the base?
Changes from all commits
490780f
1585e94
3eff679
5dd5322
b1c5cb4
4e3f3df
bd2d97a
1d05f2a
8751114
13c10ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
==== 자신이 받은 리뷰 목록 조회 | ||
|
||
operation::received-review-list-with-pagination[snippets="curl-request,request-cookies,query-parameters,http-response,response-fields"] | ||
|
||
==== 자신이 작성한 리뷰 목록 조회 | ||
|
||
operation::written-review-list-with-pagination[snippets="curl-request,query-parameters,http-response,response-fields"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
import reviewme.review.service.dto.response.gathered.ReviewsGatheredBySectionResponse; | ||
import reviewme.review.service.dto.response.list.ReceivedReviewsResponse; | ||
import reviewme.review.service.dto.response.list.ReceivedReviewsSummaryResponse; | ||
import reviewme.review.service.dto.response.list.WrittenReviewsResponse; | ||
import reviewme.reviewgroup.controller.ReviewGroupSession; | ||
import reviewme.reviewgroup.domain.ReviewGroup; | ||
|
||
|
@@ -39,6 +40,13 @@ public ResponseEntity<Void> createReview(@Valid @RequestBody ReviewRegisterReque | |
return ResponseEntity.created(URI.create("/reviews/" + savedReviewId)).build(); | ||
} | ||
|
||
@PostMapping("/v2/reviews/member") | ||
public ResponseEntity<Void> createReviewByMember(@Valid @RequestBody ReviewRegisterRequest request) { | ||
// 회원 세션 추후 추가해야 함 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 다시 보니, 이 api는 /v2/reviews api 하나로 처리해도 상관없어 보여요.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
회원이 리뷰를 작성할 땐, '내가 작성한 리뷰'에 추가해줘야 하니깐요! |
||
long savedReviewId = reviewRegisterService.registerReview(request); | ||
return ResponseEntity.created(URI.create("/reviews/" + savedReviewId)).build(); | ||
} | ||
|
||
@GetMapping("/v2/reviews") | ||
public ResponseEntity<ReceivedReviewsResponse> findReceivedReviews( | ||
@RequestParam(required = false) Long lastReviewId, | ||
|
@@ -75,4 +83,15 @@ public ResponseEntity<ReviewsGatheredBySectionResponse> getReceivedReviewsBySect | |
reviewGatheredLookupService.getReceivedReviewsBySectionId(reviewGroup, sectionId); | ||
return ResponseEntity.ok(response); | ||
} | ||
|
||
@GetMapping("/v2/written") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 api의 url에서 "written"만 있는 것은 어떤 자원을 찾는지 명확하지 않아보여서 변경이 필요해 보이네요.
|
||
public ResponseEntity<WrittenReviewsResponse> findWrittenReviews( | ||
@RequestParam(required = false) Long lastReviewId, | ||
nayonsoso marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@RequestParam(required = false) Integer size | ||
// @MemberSession Member member | ||
// TODO: 세션을 활용한 권한 체계에 따른 추가 조치 필요 | ||
nayonsoso marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) { | ||
WrittenReviewsResponse response = reviewListLookupService.getWrittenReviews(lastReviewId, size); | ||
return ResponseEntity.ok(response); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package reviewme.review.service.dto.response.list; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
public record WrittenReviewElementResponse( | ||
long reviewId, | ||
String revieweeName, | ||
String projectName, | ||
LocalDate createdAt, | ||
String contentPreview, | ||
List<ReviewCategoryResponse> categories | ||
) { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package reviewme.review.service.dto.response.list; | ||
|
||
import java.util.List; | ||
|
||
public record WrittenReviewsResponse( | ||
long memberId, | ||
List<WrittenReviewElementResponse> reviews, | ||
long lastReviewId, | ||
boolean isLastPage | ||
) { | ||
} | ||
Comment on lines
+5
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 dto 는 내가 작성한 리뷰들을 보여준다 생각하는데, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. memberId를 내려줌으로써 좋은 점들이 있다고 생각했어요. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 납득했습니다👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 납득 취소합니다.. (죄송 ㅠㅠ)
이 전제는 프론트가 로그인한 사용자의 memberId 가 뭔지를 기억하고 있어야 한다는건데..
이건 프론트에서 확인해야할게 아니라는 생각이 드네요! |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,8 @@ | |
import reviewme.reviewgroup.service.ReviewGroupLookupService; | ||
import reviewme.reviewgroup.service.ReviewGroupService; | ||
import reviewme.reviewgroup.service.dto.CheckValidAccessRequest; | ||
import reviewme.reviewgroup.service.dto.ReviewGroupCreationRequest; | ||
import reviewme.reviewgroup.service.dto.GuestReviewGroupCreationRequest; | ||
import reviewme.reviewgroup.service.dto.MemberReviewGroupCreationRequest; | ||
import reviewme.reviewgroup.service.dto.ReviewGroupCreationResponse; | ||
import reviewme.reviewgroup.service.dto.ReviewGroupResponse; | ||
|
||
|
@@ -32,9 +33,17 @@ public ResponseEntity<ReviewGroupResponse> getReviewGroupSummary(@RequestParam S | |
|
||
@PostMapping("/v2/groups") | ||
public ResponseEntity<ReviewGroupCreationResponse> createReviewGroup( | ||
@Valid @RequestBody ReviewGroupCreationRequest request | ||
@Valid @RequestBody GuestReviewGroupCreationRequest request | ||
) { | ||
ReviewGroupCreationResponse response = reviewGroupService.createReviewGroup(request); | ||
ReviewGroupCreationResponse response = reviewGroupService.createGuestReviewGroup(request); | ||
return ResponseEntity.ok(response); | ||
} | ||
|
||
@PostMapping("/v2/groups/member") | ||
public ResponseEntity<ReviewGroupCreationResponse> createReviewGroup( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 요것도 마찬가지로 groups랑 합칠 수 있을 것 같습니다
|
||
@Valid @RequestBody MemberReviewGroupCreationRequest request | ||
) { | ||
ReviewGroupCreationResponse response = reviewGroupService.createMemberReviewGroup(request); | ||
return ResponseEntity.ok(response); | ||
} | ||
nayonsoso marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package reviewme.reviewgroup.service.dto; | ||
|
||
import jakarta.validation.constraints.NotEmpty; | ||
|
||
public record MemberReviewGroupCreationRequest( | ||
|
||
@NotEmpty(message = "리뷰이 이름을 입력해주세요.") | ||
String revieweeName, | ||
|
||
@NotEmpty(message = "프로젝트 이름을 입력해주세요.") | ||
String projectName | ||
) { | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
하나의 api 를 사용하되, 세션에 따라서 회원과 비회원을 구분한다는 선택지도 있었을 것 같아요.
그것을 선택하지 않고 이렇게 api 를 분리한 이유가 있나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
회원/비회원 리뷰 생성 API를 하나로 했을때를 생각해보았는데요.
이때, 비회원일 경우 세션이 없지만, resolver에서 예외를 터뜨리거나 하지 않고 컨트롤러까지 다시 member 객체를 null로 반환하는 형식으로 처리를 해줘야합니다. 그리고 서비스에서 이를 확인해서 비회원용 로직으로 처리하게 되겠죠. 이렇게, 하나의 API에서 세션이 null인 것을 예외가 아닌 비회원임으로 인식하고 처리하기 위해서 예외를 터뜨려야하는데 다르게 처리하는 등으로 로직이 복잡해진다고 생각했어요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
지난 회의에서 이야기 나온 것처럼, 하나의 api를 여러곳에서 쓰고, 권한에 맞게 별도의 로직을 제공하려는 우리의 취지를 생각해봤어요. 그럼 하나의 api에서 처리하는게 맞는 것 같아요.
그리고 저도 확실하지 않아서 지피티 & 클로드에게 물어보니, 회원/비회원 기능을 하나의 api에서 제공하고 내부적으로 분기하는 것은 일반적인 패턴이라고 합니다. 아래의 예시 코드처럼요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.