Skip to content

Commit 7d0e75c

Browse files
committed
refactor(community): DTO 이름 및 변수명 변경
- 게시글 조회 ResponseDto 'Get' 삭제 - toEntity -> to / fromEntity -> from
1 parent 7a5c027 commit 7d0e75c

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

src/main/java/com/somemore/community/dto/request/CommunityBoardCreateRequestDto.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public record CommunityBoardCreateRequestDto(
1919
@NotBlank(message = "게시글 내용은 필수 값입니다.")
2020
String content
2121
) {
22-
public CommunityBoard toEntity(UUID writerId, String imgUrl) {
22+
public CommunityBoard to(UUID writerId, String imgUrl) {
2323
return CommunityBoard.builder()
2424
.writerId(writerId)
2525
.title(title)

src/main/java/com/somemore/community/dto/request/CommunityCommentCreateRequestDto.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public record CommunityCommentCreateRequestDto(
2424
@Nullable
2525
Long parentCommentId
2626
) {
27-
public CommunityComment toEntity(UUID writerId) {
27+
public CommunityComment to(UUID writerId) {
2828
return CommunityComment.builder()
2929
.communityBoardId(communityBoardId)
3030
.writerId(writerId)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import java.util.UUID;
99

1010
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
11-
public record CommunityBoardGetDetailResponseDto(
11+
public record CommunityBoardDetailResponseDto(
1212
Long id,
1313
UUID writerId,
1414
String title,
@@ -17,8 +17,8 @@ public record CommunityBoardGetDetailResponseDto(
1717
LocalDateTime createdAt,
1818
LocalDateTime updatedAt
1919
) {
20-
public static CommunityBoardGetDetailResponseDto fromEntity(CommunityBoard board) {
21-
return new CommunityBoardGetDetailResponseDto(
20+
public static CommunityBoardDetailResponseDto from(CommunityBoard board) {
21+
return new CommunityBoardDetailResponseDto(
2222
board.getId(),
2323
board.getWriterId(),
2424
board.getTitle(),

src/main/java/com/somemore/community/dto/response/CommunityBoardGetResponseDto.java renamed to src/main/java/com/somemore/community/dto/response/CommunityBoardResponseDto.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
import java.time.LocalDateTime;
88

99
@JsonNaming(SnakeCaseStrategy.class)
10-
public record CommunityBoardGetResponseDto(
10+
public record CommunityBoardResponseDto(
1111
Long id,
1212
String title,
1313
String writerNickname,
1414
LocalDateTime createdAt
1515
) {
16-
public static CommunityBoardGetResponseDto fromEntity(CommunityBoardView board) {
17-
return new CommunityBoardGetResponseDto(
16+
public static CommunityBoardResponseDto from(CommunityBoardView board) {
17+
return new CommunityBoardResponseDto(
1818
board.communityBoard().getId(),
1919
board.communityBoard().getTitle(),
2020
board.writerNickname(),

src/main/java/com/somemore/community/dto/response/CommunityCommentResponseDto.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public record CommunityCommentResponseDto(
2020
replies = replies == null ? new ArrayList<>() : replies;
2121
}
2222

23-
public static CommunityCommentResponseDto fromView(CommunityCommentView comment) {
23+
public static CommunityCommentResponseDto from(CommunityCommentView comment) {
2424
return new CommunityCommentResponseDto(
2525
comment.communityComment().getId(),
2626
comment.writerNickname(),

src/main/java/com/somemore/community/service/board/CreateCommunityBoardService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class CreateCommunityBoardService implements CreateCommunityBoardUseCase
2020
@Override
2121
public Long createCommunityBoard(CommunityBoardCreateRequestDto requestDto, UUID writerId, String imgUrl) {
2222

23-
CommunityBoard communityBoard = requestDto.toEntity(writerId, imgUrl == null ? "" : imgUrl);
23+
CommunityBoard communityBoard = requestDto.to(writerId, imgUrl == null ? "" : imgUrl);
2424

2525
communityBoardRepository.save(communityBoard);
2626

src/main/java/com/somemore/community/service/comment/CreateCommunityCommentService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class CreateCommunityCommentService implements CreateCommunityCommentUseC
2525

2626
@Override
2727
public Long createCommunityComment(CommunityCommentCreateRequestDto requestDto, UUID writerId) {
28-
CommunityComment communityComment = requestDto.toEntity(writerId);
28+
CommunityComment communityComment = requestDto.to(writerId);
2929

3030
validateCommunityBoardExists(communityComment.getCommunityBoardId());
3131

0 commit comments

Comments
 (0)