Skip to content

Commit

Permalink
Merge pull request #151 from shared-solutions/feat#150
Browse files Browse the repository at this point in the history
#150 Refactor : 저장된 글, 공지사항 시간반환 수정
  • Loading branch information
ls-rain authored Feb 17, 2024
2 parents 16eeeef + bf87be4 commit cfb6528
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/main/java/friend/spring/converter/MyPageConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ public static MyPageResponseDTO.SavedCategoryResDTO toSavedCategoryResDTO(List<C
}

public static MyPageResponseDTO.SavedPostResDTO toSavedPostResDTO(Post post){
long diffTime = post.getCreatedAt().until(LocalDateTime.now(), ChronoUnit.SECONDS); // now보다 이후면 +, 전이면 -
diffTime = diffTime / SECOND;
diffTime = diffTime / MINUTE;
diffTime = diffTime / HOUR;
long diffTime = post.getCreatedAt().until(LocalDateTime.now(), ChronoUnit.DAYS); // now보다 이후면 +, 전이면 -

return MyPageResponseDTO.SavedPostResDTO.builder()
.ago(diffTime)
.title(post.getTitle())
Expand Down Expand Up @@ -113,10 +111,8 @@ public static MyPageResponseDTO.MyInquiryRes toMyInquiryRes(Inquiry inquiry){
}

public static MyPageResponseDTO.SavedPostCategoryDetailRes toSavedPostCategoryDetailRes(Post post){
long diffTime = post.getCreatedAt().until(LocalDateTime.now(), ChronoUnit.SECONDS); // now보다 이후면 +, 전이면 -
diffTime = diffTime / SECOND;
diffTime = diffTime / MINUTE;
diffTime = diffTime / HOUR;
long diffTime = post.getCreatedAt().until(LocalDateTime.now(), ChronoUnit.DAYS); // now보다 이후면 +, 전이면 -

return MyPageResponseDTO.SavedPostCategoryDetailRes.builder()
.ago(diffTime)
.title(post.getTitle())
Expand All @@ -135,10 +131,8 @@ public static MyPageResponseDTO.SavedPostCategoryDetailListRes toSavedPostCatego
}

public static MyPageResponseDTO.NoticeRes toNoticeRes(Notice notice){
long diffTime = notice.getCreatedAt().until(LocalDateTime.now(), ChronoUnit.SECONDS); // now보다 이후면 +, 전이면 -
diffTime = diffTime / SECOND;
diffTime = diffTime / MINUTE;
diffTime = diffTime / HOUR;
long diffTime = notice.getCreatedAt().until(LocalDateTime.now(), ChronoUnit.DAYS); // now보다 이후면 +, 전이면 -

String adminImage = null;
if (notice.getUser().getFile() != null){
adminImage = notice.getUser().getFile().getUrl();
Expand Down

0 comments on commit cfb6528

Please sign in to comment.