Skip to content
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

[REFACTOR] 몽타주 생성 요청시 RequestBody 사용하도록 재변경 #65

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}

}
Loading