diff --git a/src/main/java/notai/comment/application/CommentQueryService.java b/src/main/java/notai/comment/application/CommentQueryService.java new file mode 100644 index 0000000..ad2ab1b --- /dev/null +++ b/src/main/java/notai/comment/application/CommentQueryService.java @@ -0,0 +1,4 @@ +package notai.comment.application; + +public class CommentQueryService { +} diff --git a/src/main/java/notai/comment/application/CommentService.java b/src/main/java/notai/comment/application/CommentService.java new file mode 100644 index 0000000..b46762e --- /dev/null +++ b/src/main/java/notai/comment/application/CommentService.java @@ -0,0 +1,4 @@ +package notai.comment.application; + +public class CommentService { +} diff --git a/src/main/java/notai/comment/domain/Comment.java b/src/main/java/notai/comment/domain/Comment.java new file mode 100644 index 0000000..2287a46 --- /dev/null +++ b/src/main/java/notai/comment/domain/Comment.java @@ -0,0 +1,52 @@ +package notai.comment.domain; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import notai.common.domain.RootEntity; +import notai.member.domain.Member; + +import static jakarta.persistence.GenerationType.IDENTITY; +import static lombok.AccessLevel.PROTECTED; + +@Entity +@Table(name = "comment") +@Getter +@NoArgsConstructor(access = PROTECTED) +@AllArgsConstructor +public class Comment extends RootEntity { + @Id + @GeneratedValue(strategy = IDENTITY) + private Long id; + @ManyToOne + @NotNull + @JoinColumn(name = "member_id") + private Member member; + @NotNull + @Column + private Long postId; + @NotNull + @Column + private Long parentCommentId; + @NotNull + @Column(length = 255) + private String content; + public Comment( + Member member, + Long postId, + String content + ) { + this.member = member; + this.postId = postId; + this.content = content; + } + +} diff --git a/src/main/java/notai/comment/domain/CommentRepository.java b/src/main/java/notai/comment/domain/CommentRepository.java new file mode 100644 index 0000000..c29be90 --- /dev/null +++ b/src/main/java/notai/comment/domain/CommentRepository.java @@ -0,0 +1,9 @@ +package notai.comment.domain; + +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface CommentRepository extends JpaRepository { + +} diff --git a/src/main/java/notai/comment/presentation/CommentController.java b/src/main/java/notai/comment/presentation/CommentController.java new file mode 100644 index 0000000..4f7287a --- /dev/null +++ b/src/main/java/notai/comment/presentation/CommentController.java @@ -0,0 +1,4 @@ +package notai.comment.presentation; + +public class CommentController { +}