File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
src/main/java/com/back/domain/notification/dto Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 22
33import com .back .domain .notification .entity .Notification ;
44import com .back .domain .notification .enums .NotificationType ;
5+ import com .back .domain .post .post .entity .PostImage ;
56import java .time .LocalDateTime ;
67import lombok .Builder ;
78import lombok .Getter ;
@@ -13,18 +14,29 @@ public class NotificationItemDto {
1314 private NotificationType type ;
1415 private Long postId ;
1516 private String postTitle ;
17+ private String postCategoryName ;
18+ private String postThumbnailUrl ;
19+ private String message ;
1620 private boolean read ;
1721 private LocalDateTime createdAt ;
1822
1923 public static NotificationItemDto from (Notification n ) {
24+ String categoryName = n .getPost ().getCategory () != null ? n .getPost ().getCategory ().getName () : null ;
25+ String thumbnailUrl = n .getPost ().getImages ().stream ()
26+ .map (PostImage ::getUrl )
27+ .findFirst ()
28+ .orElse (null );
29+
2030 return NotificationItemDto .builder ()
2131 .id (n .getId ())
2232 .type (n .getType ())
2333 .postId (n .getPost ().getId ())
2434 .postTitle (n .getPost ().getTitle ())
35+ .postCategoryName (categoryName )
36+ .postThumbnailUrl (thumbnailUrl )
37+ .message (n .getMessage ())
2538 .read (n .isRead ())
2639 .createdAt (n .getCreatedAt ())
2740 .build ();
2841 }
2942}
30-
You can’t perform that action at this time.
0 commit comments