-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPostDTO.java
More file actions
91 lines (77 loc) · 2.14 KB
/
PostDTO.java
File metadata and controls
91 lines (77 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package com.example.be.web.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
public class PostDTO {
@Builder
@Getter
@NoArgsConstructor
@AllArgsConstructor
public static class postRequestDTO{
String title;
String content;
}
@Builder
@Getter
@NoArgsConstructor
@AllArgsConstructor
public static class postResponseDTO {
Long id;
String title;
String content;
String userName;
@JsonFormat(pattern = "yyyy-MM-dd")
LocalDate createDate;
int commentCount;
boolean isDone;
}
@Builder
@Getter
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "게시글 페이지네이션 응답 DTO")
public static class PageResponseDTO {
private List<postResponseDTO> posts;
private int currentPage;
private int totalPages;
private long totalElements;
private boolean first;
private boolean last;
}
@Builder
@Getter
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "댓글 응답 DTO")
public static class CommentResponseDTO {
private Long id;
private String comment;
private String userName;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createDate;
private Long topParentId;
}
@Builder
@Getter
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "게시글 상세 조회 응답 DTO")
public static class PostDetailResponseDTO {
private Long id;
private String title;
private String content;
private String userName;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createDate;
private boolean isDone;
private int commentCount;
private List<CommentResponseDTO> comments;
}
}