|
1 | | -package com.back.domain.myhistory.dto; |
| 1 | +package com.back.domain.myhistory.dto; |
2 | 2 |
|
3 | 3 | import com.back.domain.post.post.entity.Post; |
4 | 4 | import com.back.domain.post.post.entity.PostImage; |
| 5 | +import com.back.domain.post.post.enums.PostStatus; |
5 | 6 | import lombok.Builder; |
6 | 7 | import lombok.Getter; |
7 | 8 |
|
|
12 | 13 | @Builder |
13 | 14 | public class MyHistoryPostItemDto { |
14 | 15 | private Long id; |
| 16 | + private Long postId; |
| 17 | + private String categoryName; |
| 18 | + private String userNickName; |
15 | 19 | private String title; |
| 20 | + private String content; |
16 | 21 | private List<String> imageUrls; |
17 | 22 | private LocalDateTime createdAt; |
| 23 | + private LocalDateTime updatedAt; |
| 24 | + private PostStatus status; |
18 | 25 | private Integer likeCount; |
19 | 26 | private Integer commentCount; |
| 27 | + private Integer viewCount; |
20 | 28 |
|
21 | 29 | public static MyHistoryPostItemDto from(Post p) { |
| 30 | + String categoryName = p.getCategory() != null ? p.getCategory().getName() : null; |
| 31 | + String userNickName = p.getUser() != null ? p.getUser().getNickname() : null; |
22 | 32 | return MyHistoryPostItemDto.builder() |
23 | 33 | .id(p.getId()) |
| 34 | + .postId(p.getId()) |
| 35 | + .categoryName(categoryName) |
| 36 | + .userNickName(userNickName) |
24 | 37 | .title(p.getTitle()) |
| 38 | + .content(p.getContent()) |
25 | 39 | .imageUrls(p.getImages().stream() |
26 | | - .map(PostImage::getUrl) |
27 | | - .toList()) |
| 40 | + .map(PostImage::getUrl) |
| 41 | + .toList()) |
28 | 42 | .createdAt(p.getCreatedAt()) |
| 43 | + .updatedAt(p.getUpdatedAt()) |
| 44 | + .status(p.getStatus()) |
29 | 45 | .likeCount(p.getLikeCount()) |
30 | 46 | .commentCount(p.getCommentCount()) |
| 47 | + .viewCount(p.getViewCount()) |
31 | 48 | .build(); |
32 | 49 | } |
33 | 50 | } |
34 | | - |
|
0 commit comments