diff --git a/src/main/java/hanium/englishfairytale/tale/application/TaleCommandService.java b/src/main/java/hanium/englishfairytale/tale/application/TaleCommandService.java index f348e17..8dd86bd 100644 --- a/src/main/java/hanium/englishfairytale/tale/application/TaleCommandService.java +++ b/src/main/java/hanium/englishfairytale/tale/application/TaleCommandService.java @@ -76,7 +76,7 @@ private Tale findTale(Long taleId) { private Tale createTale(TaleCreateCommand taleCreateCommand) { Member member = findMember(taleCreateCommand.getMemberId()); - CreatedTale createdTale = createEnglishTale(taleCreateCommand); + CreatedTale createdTale = createTaleByLLM(taleCreateCommand); return Tale.builder() .title(createdTale.getTitle()) .engTale(createdTale.getEngTale()) @@ -91,7 +91,7 @@ private Member findMember(Long memberId) { .orElseThrow(() -> new NotFoundException(ErrorCode.MEMBER_NOT_FOUND, memberId)); } - private CreatedTale createEnglishTale(TaleCreateCommand taleCreateCommand) { + private CreatedTale createTaleByLLM(TaleCreateCommand taleCreateCommand) { verifyInputKeywords(taleCreateCommand); return taleManageService.post(taleCreateCommand.getModel(), taleCreateCommand.getKeywords()); } @@ -102,7 +102,7 @@ private void verifyInputKeywords(TaleCreateCommand taleCreateCommand) { } private TaleCreateResponse saveTaleAndKeywords(Tale tale, List keywords, MultipartFile image) { - if (!image.isEmpty()) { + if (image != null) { tale.putImage(createAndSaveTaleImage(image)); } saveTaleKeywords(tale, keywords); diff --git a/src/main/java/hanium/englishfairytale/tale/infra/http/TaleController.java b/src/main/java/hanium/englishfairytale/tale/infra/http/TaleController.java index 7f25170..62c49f4 100644 --- a/src/main/java/hanium/englishfairytale/tale/infra/http/TaleController.java +++ b/src/main/java/hanium/englishfairytale/tale/infra/http/TaleController.java @@ -23,7 +23,7 @@ public class TaleController { @PostMapping("create") public TaleCreateResponse create(@Validated @RequestPart TaleCreateDto taleCreateDto, - @RequestPart MultipartFile image) { + @RequestPart(required = false) MultipartFile image) { return taleCommandService.create(toCreateCommand(taleCreateDto, image)); }