Skip to content

Commit

Permalink
refactor: 회원 리뷰 작성을 비회원과 통합
Browse files Browse the repository at this point in the history
  • Loading branch information
skylar1220 committed Jan 5, 2025
1 parent de17b00 commit 201363b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ public class ReviewController {

@PostMapping("/v2/reviews")
public ResponseEntity<Void> createReview(@Valid @RequestBody ReviewRegisterRequest request) {
long savedReviewId = reviewRegisterService.registerReview(request);
return ResponseEntity.created(URI.create("/reviews/" + savedReviewId)).build();
}

@PostMapping("/v2/reviews/member")
public ResponseEntity<Void> createReviewByMember(@Valid @RequestBody ReviewRegisterRequest request) {
// 회원 세션 추후 추가해야 함
long savedReviewId = reviewRegisterService.registerReview(request);
return ResponseEntity.created(URI.create("/reviews/" + savedReviewId)).build();
Expand Down
8 changes: 7 additions & 1 deletion backend/src/test/java/reviewme/api/ReviewApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ class ReviewApiTest extends ApiTest {
BDDMockito.given(reviewRegisterService.registerReview(any(ReviewRegisterRequest.class)))
.willReturn(1L);

CookieDescriptor[] cookieDescriptors = {
cookieWithName("JSESSIONID").description("세션 ID")
};

FieldDescriptor[] requestFieldDescriptors = {
fieldWithPath("reviewRequestCode").description("리뷰 요청 코드"),

Expand All @@ -99,12 +103,14 @@ class ReviewApiTest extends ApiTest {

RestDocumentationResultHandler handler = document(
"create-review-by-member",
requestCookies(cookieDescriptors),
requestFields(requestFieldDescriptors)
);

givenWithSpec().log().all()
.cookie("JSESSIONID", "ASVNE1VAKDNV4")
.body(request)
.when().post("/v2/reviews/member")
.when().post("/v2/reviews")
.then().log().all()
.apply(handler)
.statusCode(201);
Expand Down

0 comments on commit 201363b

Please sign in to comment.