Skip to content

Commit e19055f

Browse files
committed
test(community): communityComment 수정 requestDto 생성 및 Entity 메서드 추가
1 parent ed06d86 commit e19055f

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/main/java/com/somemore/community/domain/CommunityComment.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.somemore.community.domain;
22

3+
import com.somemore.community.dto.request.CommunityCommentUpdateRequestDto;
34
import com.somemore.global.common.BaseEntity;
45
import jakarta.persistence.*;
56
import lombok.Builder;
@@ -46,4 +47,8 @@ public CommunityComment(Long communityBoardId, UUID writerId, String content, Lo
4647
public boolean isWriter(UUID writerId) {
4748
return this.writerId.equals(writerId);
4849
}
50+
51+
public void updateWith(CommunityCommentUpdateRequestDto dto) {
52+
this.content = dto.content();
53+
}
4954
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.somemore.community.dto.request;
2+
3+
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
4+
import com.fasterxml.jackson.databind.annotation.JsonNaming;
5+
import io.swagger.v3.oas.annotations.media.Schema;
6+
import jakarta.validation.constraints.NotBlank;
7+
import lombok.Builder;
8+
9+
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
10+
@Builder
11+
public record CommunityCommentUpdateRequestDto (
12+
@Schema(description = "커뮤니티 댓글 내용", example = "저도 함께 하고 싶습니다.")
13+
@NotBlank(message = "댓글 내용은 필수 값입니다.")
14+
String content
15+
) {}

0 commit comments

Comments
 (0)