From dff6f86ef7599f98c48504f0f44453572d36a1de Mon Sep 17 00:00:00 2001 From: MinchoGreenT Date: Thu, 15 Aug 2024 23:59:41 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20HistoryVeggieDetail=20=EC=9E=84?= =?UTF-8?q?=EB=B2=A0=EB=94=94=EB=93=9C=20=EB=8F=84=ED=81=90=EB=A8=BC?= =?UTF-8?q?=ED=8A=B8=20=EC=83=9D=EC=84=B1=EC=9A=A9=20=EC=8A=A4=ED=83=9C?= =?UTF-8?q?=ED=8B=B1=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EA=B5=AC=ED=98=84=20?= =?UTF-8?q?=EB=B0=8F=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/history/document/HistoryVeggieDetail.java | 8 ++++++++ .../domain/history/service/HistoryService.java | 10 +++++----- .../myveggiegarden/service/MyVeggieGardenService.java | 10 +++++----- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/history/document/HistoryVeggieDetail.java b/src/main/java/com/modernfarmer/farmusspring/domain/history/document/HistoryVeggieDetail.java index de76a64c..b1a23120 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/history/document/HistoryVeggieDetail.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/history/document/HistoryVeggieDetail.java @@ -43,6 +43,14 @@ public static HistoryVeggieDetail createHistoryDetail(List diaryPos .build(); } + public static HistoryPost createHistoryPost(String postImage, String content, String dateTime) { + return HistoryPost.builder() + .postImage(postImage) + .content(content) + .dateTime(dateTime) + .build(); + } + public void updateHistoryDetailResult(HistoryPost farmResult) { this.farmResult = farmResult; } diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/history/service/HistoryService.java b/src/main/java/com/modernfarmer/farmusspring/domain/history/service/HistoryService.java index 7a1be0f8..d9da602a 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/history/service/HistoryService.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/history/service/HistoryService.java @@ -62,11 +62,11 @@ public FarmClubHistoryListResponseDto getFarmClubHistories(Long userId) { public void createVeggieHistoryResult(VeggieHistoryResultPostRequestDto requestDto, MultipartFile image) { String imageUrl = s3Service.uploadImage(image, "farm-result"); - HistoryVeggieDetail.HistoryPost farmResult = HistoryVeggieDetail.HistoryPost.builder() - .postImage(imageUrl) - .content(requestDto.content()) - .dateTime(DateManager.parsingDotDateTime(LocalDateTime.now())) - .build(); + HistoryVeggieDetail.HistoryPost farmResult = HistoryVeggieDetail.createHistoryPost( + imageUrl, + requestDto.content(), + DateManager.parsingDotDateTime(LocalDateTime.now()) + ); historyHelper.createVeggieHistoryResult(farmResult, requestDto.historyDetailId()); } } diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/service/MyVeggieGardenService.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/service/MyVeggieGardenService.java index 68a6ca06..fbea6720 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/service/MyVeggieGardenService.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/service/MyVeggieGardenService.java @@ -97,11 +97,11 @@ public void myVeggieUpdate(MyVeggieUpdate myVeggieUpdate) { @Transactional public void successFarming(SuccessFarmingRequestDto requestDto, MultipartFile image, Long userId) { String imageUrl = s3Service.uploadImage(image, "farm-result"); - HistoryVeggieDetail.HistoryPost farmResult = HistoryVeggieDetail.HistoryPost.builder() - .postImage(imageUrl) - .content(requestDto.content()) - .dateTime(DateManager.parsingDotDateTime(LocalDateTime.now())) - .build(); + HistoryVeggieDetail.HistoryPost farmResult = HistoryVeggieDetail.createHistoryPost( + imageUrl, + requestDto.content(), + DateManager.parsingDotDateTime(LocalDateTime.now()) + ); historyHelper.createVeggieHistoryDetail(userId, requestDto.myVeggieId(), farmResult); myVeggieHelper.deleteMyVeggie(requestDto.myVeggieId()); }