Skip to content

Commit

Permalink
refactor: 몽타주 생성 요청 받을 시 request body 사용
Browse files Browse the repository at this point in the history
  • Loading branch information
xloyeon committed Dec 18, 2023
1 parent abd8182 commit 78af5d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class MontageController {

@PostMapping("/create/{interviewId}")
public MontageResponse createMontage(@PathVariable Long interviewId,
@RequestParam String prompt){
return montageService.createMontage(interviewId, prompt);
@RequestBody @Valid CreateMontageRequest request){
return montageService.createMontage(interviewId, request);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class MontageService {
private final CriminalValidator criminalValidator;
private final MontageApiFeignClient montageApiFeignClient;

public MontageResponse createMontage(Long interviewId, String prompt){
public MontageResponse createMontage(Long interviewId, CreateMontageRequest request){
User currentUser = userHelper.getCurrentUser();

Interview interview = interviewAdaptor.findById(interviewId);
Expand All @@ -49,20 +49,15 @@ public MontageResponse createMontage(Long interviewId, String prompt){
//인터뷰에서 확정된 몽타주가 있는지 확인
interviewValidator.isValidCreateInterviewMontage(interview);

Montage montage = montageAdaptor.save(
Montage.builder()
.interview(interview)
.selected(Status.N)
.build()
);
Montage montage = request.toEntity(interview);

montageAdaptor.save(montage);

//api 호출
montageApiFeignClient.callMontageApi(prompt, montage.getId().toString());
montageApiFeignClient.callMontageApi(request.getPrompt(), montage.getId().toString());
montageAdaptor.save(montage);

return MontageResponse.of(prompt, montage);
return MontageResponse.of(request.getPrompt(), montage);
}

}

0 comments on commit 78af5d2

Please sign in to comment.