|
1 | 1 | package kr.warmlink.application.article.dto; |
2 | 2 |
|
3 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | +import kr.warmlink.domain.article.entity.Article; |
4 | 5 | import kr.warmlink.domain.auth.entity.User; |
5 | 6 | import lombok.AllArgsConstructor; |
6 | 7 | import lombok.Builder; |
7 | 8 | import lombok.Getter; |
8 | 9 | import lombok.NoArgsConstructor; |
9 | 10 |
|
| 11 | +import java.time.LocalDateTime; |
10 | 12 | import java.util.List; |
11 | 13 | import java.util.stream.Collectors; |
12 | 14 |
|
@@ -60,4 +62,31 @@ public static List<Overview> from(User user) { |
60 | 62 | .collect(Collectors.toUnmodifiableList()); |
61 | 63 | } |
62 | 64 | } |
| 65 | + |
| 66 | + @Getter |
| 67 | + @Builder |
| 68 | + @AllArgsConstructor |
| 69 | + @Schema(name = "ArticleDto.DetailResponse", description = "게시글 세부 조회 응답 DTO") |
| 70 | + public static class DetailResponse { |
| 71 | + @Schema(description = "게시글 제목", example = "초상화 그려드립니다.") |
| 72 | + private String title; |
| 73 | + |
| 74 | + @Schema(description = "게시글 내용", example = "1장에 8천원 이상, 택배비 별도 부담하셔야 합니다.") |
| 75 | + private String content; |
| 76 | + |
| 77 | + @Schema(description = "작성자", example = "홍길동") |
| 78 | + private String name; |
| 79 | + |
| 80 | + @Schema(description = "작성일", example = "2025-06-26") |
| 81 | + private LocalDateTime createdAt; |
| 82 | + |
| 83 | + public static DetailResponse from(Article article, User user) { |
| 84 | + return DetailResponse.builder() |
| 85 | + .title(article.getTitle()) |
| 86 | + .content(article.getContent()) |
| 87 | + .name(user.getName()) |
| 88 | + .createdAt(article.getCreatedAt()) |
| 89 | + .build(); |
| 90 | + } |
| 91 | + } |
63 | 92 | } |
0 commit comments