Skip to content

Commit

Permalink
[fix] HistoryVeggieDetail 임베디드 도큐먼트 생성용 스태틱 메서드 구현 및 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
MinchoGreenT committed Aug 15, 2024
1 parent 8175e5f commit dff6f86
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ public static HistoryVeggieDetail createHistoryDetail(List<HistoryPost> 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit dff6f86

Please sign in to comment.