Skip to content

Commit 9b15a18

Browse files
committed
fix(community): CommunityComment 엔티티 및 Dto에 communityBoardId 추가
1 parent d4d2790 commit 9b15a18

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public class CommunityComment extends BaseEntity {
2222
@Column(name = "id", nullable = false)
2323
private Long id;
2424

25+
@Column(name = "community_board_id", nullable = false)
26+
private Long communityBoardId;
27+
2528
@Column(name = "writer_id", nullable = false, length = 16)
2629
private UUID writerId;
2730

@@ -33,7 +36,8 @@ public class CommunityComment extends BaseEntity {
3336
private Long parentCommentId;
3437

3538
@Builder
36-
public CommunityComment(UUID writerId, String content, Long parentCommentId) {
39+
public CommunityComment(Long communityBoardId, UUID writerId, String content, Long parentCommentId) {
40+
this.communityBoardId = communityBoardId;
3741
this.writerId = writerId;
3842
this.content = content;
3943
this.parentCommentId = parentCommentId;

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,27 @@
66
import io.swagger.v3.oas.annotations.media.Schema;
77
import jakarta.annotation.Nullable;
88
import jakarta.validation.constraints.NotBlank;
9+
import jakarta.validation.constraints.NotNull;
910
import lombok.Builder;
1011

1112
import java.util.UUID;
1213

1314
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
1415
@Builder
1516
public record CommunityCommentCreateRequestDto(
17+
@Schema(description = "커뮤니티 게시글 ID", example = "33")
18+
@NotNull(message = "게시글 ID는 필수 값입니다.")
19+
Long communityBoardId,
1620
@Schema(description = "커뮤니티 댓글 내용", example = "저도 함께 하고 싶습니다.")
1721
@NotBlank(message = "댓글 내용은 필수 값입니다.")
1822
String content,
19-
@Schema(description = "부모 댓글의 ID", example = "1234", nullable = true)
23+
@Schema(description = "부모 댓글 ID", example = "1234", nullable = true)
2024
@Nullable
2125
Long parentCommentId
2226
) {
2327
public CommunityComment toEntity(UUID writerId) {
2428
return CommunityComment.builder()
29+
.communityBoardId(communityBoardId)
2530
.writerId(writerId)
2631
.content(content)
2732
.parentCommentId(parentCommentId)

0 commit comments

Comments
 (0)