From 0e9e6a5a15d64a50a9bf2cc001509746d1a6c18a Mon Sep 17 00:00:00 2001 From: kimdozzi Date: Tue, 9 Jul 2024 07:44:46 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20else=20=EC=98=88=EC=95=BD=EC=96=B4?= =?UTF-8?q?=20=EC=A0=9C=EA=B1=B0=20=EB=B0=8F=20=EB=B3=80=EC=88=98=EB=AA=85?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../topic/serviceFacade/TopicFacadeImpl.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/genius/gitget/topic/serviceFacade/TopicFacadeImpl.java b/src/main/java/com/genius/gitget/topic/serviceFacade/TopicFacadeImpl.java index 600290d0..00d7f363 100644 --- a/src/main/java/com/genius/gitget/topic/serviceFacade/TopicFacadeImpl.java +++ b/src/main/java/com/genius/gitget/topic/serviceFacade/TopicFacadeImpl.java @@ -24,34 +24,34 @@ public class TopicFacadeImpl implements TopicFacade { @Override public Page findTopics(Pageable pageable) { - Page allTopicById = topicService.findTopics(pageable); - return allTopicById.map(this::convertToTopicPagingResponseDto); + Page findTopics = topicService.findTopics(pageable); + return findTopics.map(this::convertToTopicPagingResponseDto); } @Override public TopicDetailResponse findOne(Long id) { - Topic topic = topicService.findOne(id); - FileResponse fileResponse = filesService.convertToFileResponse(topic.getFiles()); - return TopicDetailResponse.of(topic, fileResponse); + Topic findTopic = topicService.findOne(id); + FileResponse fileResponse = filesService.convertToFileResponse(findTopic.getFiles()); + return TopicDetailResponse.of(findTopic, fileResponse); } @Override public Long create(TopicCreateRequest topicCreateRequest) { - Topic byTopicCreateDto = topicService.createTopicByTopicCreateRequest(topicCreateRequest); - return topicService.create(byTopicCreateDto); + Topic topic = topicService.createTopicByTopicCreateRequest(topicCreateRequest); + return topicService.create(topic); } @Override public Long update(Long id, TopicUpdateRequest topicUpdateRequest) { Topic topic = topicService.findOne(id); - boolean hasInstance = !topic.getInstanceList().isEmpty(); - if (hasInstance) { + if (!topic.getInstanceList().isEmpty()) { topic.updateExistInstance(topicUpdateRequest.description()); - } else { - topic.updateNotExistInstance(topicUpdateRequest.title(), topicUpdateRequest.description(), - topicUpdateRequest.tags(), topicUpdateRequest.notice(), topicUpdateRequest.pointPerPerson()); + return topicService.create(topic); } + + topic.updateNotExistInstance(topicUpdateRequest.title(), topicUpdateRequest.description(), + topicUpdateRequest.tags(), topicUpdateRequest.notice(), topicUpdateRequest.pointPerPerson()); return topicService.create(topic); }