Skip to content

Commit

Permalink
Merge pull request #66 from Team-Puzzling/refactor/#65-review-post-ap…
Browse files Browse the repository at this point in the history
…i-response-body

#65 [REFACTOR] 리뷰 작성 시, 프로젝트 이름 response body로 내려주기
  • Loading branch information
yeseul106 authored Jul 20, 2023
2 parents ae67bcc + 5605463 commit aa40e8c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,18 @@ public ApiResponse<ReviewTemplateGetResponseDto> getReviewTemplateAll() {
}

@PostMapping("member/{memberId}/project/{projectId}/review/TIL")
public ApiResponse createReviewTIL(@PathVariable("memberId") Long memberId,@PathVariable("projectId") Long projectId, @Valid @RequestBody ReviewTILRequestDto reviewTILRequestDto){
reviewService.createReviewTIL(memberId, projectId, reviewTILRequestDto);
return ApiResponse.success(SuccessStatus.POST_REVIEW_SUCCESS.getStatusCode(), SuccessStatus.POST_REVIEW_SUCCESS.getMessage());
public ApiResponse<ReviewPostResponseDto> createReviewTIL(@PathVariable("memberId") Long memberId,@PathVariable("projectId") Long projectId, @Valid @RequestBody ReviewTILRequestDto reviewTILRequestDto){
return ApiResponse.success(SuccessStatus.POST_REVIEW_SUCCESS, reviewService.createReviewTIL(memberId, projectId, reviewTILRequestDto));
}

@PostMapping("member/{memberId}/project/{projectId}/review/5F")
public ApiResponse createReview5F(@PathVariable("memberId") Long memberId,@PathVariable("projectId") Long projectId, @Valid @RequestBody Review5FRequestDto review5FRequestDto){
reviewService.createReview5F(memberId, projectId, review5FRequestDto);
return ApiResponse.success(SuccessStatus.POST_REVIEW_SUCCESS.getStatusCode(), SuccessStatus.POST_REVIEW_SUCCESS.getMessage());
public ApiResponse<ReviewPostResponseDto> createReview5F(@PathVariable("memberId") Long memberId,@PathVariable("projectId") Long projectId, @Valid @RequestBody Review5FRequestDto review5FRequestDto){
return ApiResponse.success(SuccessStatus.POST_REVIEW_SUCCESS, reviewService.createReview5F(memberId, projectId, review5FRequestDto));
}

@PostMapping("member/{memberId}/project/{projectId}/review/AAR")
public ApiResponse createReviewAAR(@PathVariable("memberId") Long memberId,@PathVariable("projectId") Long projectId, @Valid @RequestBody ReviewAARRequestDto reviewAARRequestDto){
reviewService.createReviewAAR(memberId, projectId, reviewAARRequestDto);
return ApiResponse.success(SuccessStatus.POST_REVIEW_SUCCESS.getStatusCode(), SuccessStatus.POST_REVIEW_SUCCESS.getMessage());
public ApiResponse<ReviewPostResponseDto> createReviewAAR(@PathVariable("memberId") Long memberId,@PathVariable("projectId") Long projectId, @Valid @RequestBody ReviewAARRequestDto reviewAARRequestDto){
return ApiResponse.success(SuccessStatus.POST_REVIEW_SUCCESS, reviewService.createReviewAAR(memberId, projectId, reviewAARRequestDto));
}

@GetMapping("member/{memberId}/project/{projectId}/review/previous-template")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.puzzling.puzzlingServer.api.review.dto.response;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import static lombok.AccessLevel.PRIVATE;

@Getter
@NoArgsConstructor(access = PRIVATE)
@AllArgsConstructor
public class ReviewPostResponseDto {
private String projectName;

public static ReviewPostResponseDto of (String projectName) {
return new ReviewPostResponseDto(projectName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public List<ReviewTemplateGetResponseDto> getReviewTemplateAll() {

@Override
@Transactional
public void createReviewTIL(Long memberId, Long projectId, ReviewTILRequestDto reviewTILRequestDto) {
public ReviewPostResponseDto createReviewTIL(Long memberId, Long projectId, ReviewTILRequestDto reviewTILRequestDto) {
UserProject userProject = findUserProjectByMemberIdAndProjectId(memberId, projectId);

if ( reviewTILRequestDto.getReviewTemplateId() == null ) {
Expand All @@ -103,11 +103,12 @@ public void createReviewTIL(Long memberId, Long projectId, ReviewTILRequestDto r
.actionPlan(reviewTILRequestDto.getActionPlan())
.build();
reviewTILRepository.save(reviewTIL);
return ReviewPostResponseDto.of(findProjectById(projectId).getName());
}

@Override
@Transactional
public void createReview5F(Long memberId, Long projectId, Review5FRequestDto review5FRequestDto) {
public ReviewPostResponseDto createReview5F(Long memberId, Long projectId, Review5FRequestDto review5FRequestDto) {
UserProject userProject = findUserProjectByMemberIdAndProjectId(memberId, projectId);

if ( review5FRequestDto.getReviewTemplateId() == null ) {
Expand Down Expand Up @@ -136,11 +137,12 @@ public void createReview5F(Long memberId, Long projectId, Review5FRequestDto rev
.actionPlan(review5FRequestDto.getActionPlan())
.build();
review5FRepository.save(review5F);
return ReviewPostResponseDto.of(findProjectById(projectId).getName());
}

@Override
@Transactional
public void createReviewAAR(Long memberId, Long projectId, ReviewAARRequestDto reviewAARRequestDto) {
public ReviewPostResponseDto createReviewAAR(Long memberId, Long projectId, ReviewAARRequestDto reviewAARRequestDto) {
UserProject userProject = findUserProjectByMemberIdAndProjectId(memberId, projectId);

if ( reviewAARRequestDto.getReviewTemplateId() == null ) {
Expand Down Expand Up @@ -169,6 +171,7 @@ public void createReviewAAR(Long memberId, Long projectId, ReviewAARRequestDto r
.actionPlan(reviewAARRequestDto.getActionPlan())
.build();
reviewARRRepository.save(reviewAAR);
return ReviewPostResponseDto.of(findProjectById(projectId).getName());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
public interface ReviewService {
List<ReviewTemplateGetResponseDto> getReviewTemplateAll();

void createReviewTIL(Long memberId, Long projectId, ReviewTILRequestDto reviewTILRequestDto);
ReviewPostResponseDto createReviewTIL(Long memberId, Long projectId, ReviewTILRequestDto reviewTILRequestDto);

void createReviewAAR(Long memberId, Long projectId, ReviewAARRequestDto reviewARRRequestDto);
ReviewPostResponseDto createReviewAAR(Long memberId, Long projectId, ReviewAARRequestDto reviewARRRequestDto);

void createReview5F(Long memberId, Long projectId, Review5FRequestDto review5FRequestDto);
ReviewPostResponseDto createReview5F(Long memberId, Long projectId, Review5FRequestDto review5FRequestDto);

ReviewPreviousTemplateResponseDto getPreviousReviewTemplate(Long memberId, Long projectId);

Expand Down

0 comments on commit aa40e8c

Please sign in to comment.