-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BE] refactor: 리뷰 작성을 위한 정보 요청 기능 리팩터링 (#162)
* refactor: 불필요한 update 방지 * feat: controller에 리뷰 생성 요청에 대한 응답 기능 구현 * feat: controller에 리뷰 작성을 위해 필요한 정보를 응답 기능 구현 * feat: service에 리뷰 작성을 위해 필요한 정보 조회 기능 구현 * chore: 사용하지 않는 dto 삭제 * test: 리뷰 리뷰 작성을 위해 필요한 정보 조회 기능 테스트 작성 * refactor: swagger 설정 일부 수정 및 에러 응답코드 노출되도록 변경 * refactor: service에서 원시타입 long을 반환하도록 변경 * docs: api 문서 dto 항목설명 변경 * test: 사용하지 않는 변수 선언하지 않도록 변경 * docs: api 문서 검증 내용에 대한 어체 변경 * refactor: 트랜잭션 조회 명시 추가 * refactor: dto 이름 변경
- Loading branch information
Showing
12 changed files
with
158 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
backend/src/main/java/reviewme/review/controller/ReviewController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package reviewme.review.controller; | ||
|
||
import jakarta.validation.Valid; | ||
import java.net.URI; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import reviewme.review.dto.request.CreateReviewRequest; | ||
import reviewme.review.dto.response.ReviewSetupResponse; | ||
import reviewme.review.service.ReviewService; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
public class ReviewController implements ReviewApi{ | ||
|
||
private final ReviewService reviewService; | ||
|
||
@PostMapping("/reviews") | ||
public ResponseEntity<Void> createReview(@Valid @RequestBody CreateReviewRequest request) { | ||
long savedReviewId = reviewService.createReview(request); | ||
return ResponseEntity.created(URI.create("/reviews/" + savedReviewId)).build(); | ||
} | ||
|
||
@GetMapping("/reviews/write") | ||
public ResponseEntity<ReviewSetupResponse> findReviewCreationSetup(@RequestParam String reviewRequestCode) { | ||
ReviewSetupResponse response = reviewService.findReviewCreationSetup(reviewRequestCode); | ||
return ResponseEntity.ok(response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 8 additions & 3 deletions
11
backend/src/main/java/reviewme/review/dto/request/CreateReviewRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
package reviewme.review.dto.request; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import java.util.List; | ||
|
||
@Schema(name = "리뷰 작성 요청") | ||
public record CreateReviewRequest( | ||
|
||
@NotBlank | ||
@Schema(description = "리뷰 요청 코드") | ||
@NotBlank(message = "리뷰 요청 코드가 필요해요.") | ||
String reviewRequestCode, | ||
|
||
@NotNull | ||
@Schema(description = "리뷰 답변 목록") | ||
@NotNull(message = "리뷰 답변이 없어요.") | ||
List<CreateReviewContentRequest> reviewContents, | ||
|
||
@NotNull | ||
@Schema(description = "선택 키워드 ID 목록") | ||
@NotNull(message = "선택된 키워드가 없어요.") | ||
List<Long> keywords | ||
) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
backend/src/main/java/reviewme/review/dto/response/ReviewDetailResponse.java
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
backend/src/main/java/reviewme/review/dto/response/ReviewDetailReviewerGroupResponse.java
This file was deleted.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
...keyword/dto/response/KeywordResponse.java → ...view/dto/response/ReviewSetUpKeyword.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
backend/src/main/java/reviewme/review/dto/response/ReviewSetupResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package reviewme.review.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.List; | ||
|
||
@Schema(name = "리뷰 작성 폼 응답") | ||
public record ReviewSetupResponse( | ||
|
||
@Schema(description = "리뷰이 이름") | ||
String revieweeName, | ||
|
||
@Schema(description = "프로젝트명") | ||
String projectName, | ||
|
||
@Schema(description = "리뷰 문항 목록") | ||
List<QuestionSetupResponse> questions, | ||
|
||
@Schema(description = "키워드 목록") | ||
List<ReviewSetUpKeyword> keywords | ||
) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters