Skip to content

Commit 6b147e1

Browse files
committed
feat: dto -> record 클래스로 변경
1 parent a28e980 commit 6b147e1

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

src/main/java/com/threestar/trainus/domain/comment/dto/CommentCreateRequestDto.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
import jakarta.validation.constraints.NotBlank;
44
import jakarta.validation.constraints.Size;
5-
import lombok.Getter;
65

7-
@Getter
8-
public class CommentCreateRequestDto {
6+
public record CommentCreateRequestDto(
97
@NotBlank(message = "댓글 내용은 필수입니다")
108
@Size(max = 255, message = "댓글은 255자 이내여야 합니다.")
11-
private String content;
12-
private Long parentCommentId;
9+
String content,
10+
Long parentCommentId
11+
) {
1312
}

src/main/java/com/threestar/trainus/domain/comment/dto/CommentPageResponseDto.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
import java.util.List;
44

55
import lombok.Builder;
6-
import lombok.Getter;
76

8-
@Getter
97
@Builder
10-
public class CommentPageResponseDto {
11-
12-
private List<CommentResponseDto> comments;
13-
private Integer count;
8+
public record CommentPageResponseDto(
9+
List<CommentResponseDto> comments,
10+
Integer count
11+
) {
1412
}

src/main/java/com/threestar/trainus/domain/comment/dto/CommentResponseDto.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
import java.time.LocalDateTime;
44

55
import lombok.Builder;
6-
import lombok.Getter;
76

8-
@Getter
97
@Builder
10-
public class CommentResponseDto {
11-
private Long commentId;
12-
private Long userId;
13-
private String content;
14-
private Long parentCommentId;
15-
private Boolean deleted;
16-
private LocalDateTime createdAt;
8+
public record CommentResponseDto(
9+
Long commentId,
10+
Long userId,
11+
String content,
12+
Long parentCommentId,
13+
Boolean deleted,
14+
LocalDateTime createdAt
15+
) {
1716
}

0 commit comments

Comments
 (0)