Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: comment 엔티티 구현 #19

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package notai.comment.application;

public class CommentQueryService {
}
4 changes: 4 additions & 0 deletions src/main/java/notai/comment/application/CommentService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package notai.comment.application;

public class CommentService {
}
54 changes: 54 additions & 0 deletions src/main/java/notai/comment/domain/Comment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package notai.comment.domain;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import notai.common.domain.RootEntity;

import java.math.BigInteger;
import java.time.LocalDateTime;

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<Long> {
@Id
@GeneratedValue(strategy = IDENTITY)
private Long id;
@Column(nullable = false)
private Long member_id;
@Column(nullable = false)
private Long post_id;
@Column(nullable = false)
private Long parent_comment_id;
@Column(nullable = false)
private String content;
@Column(nullable = false)
private LocalDateTime created_at;
@Column(nullable = false)
private LocalDateTime updated_at;

public Comment(
@Auth memberId,
Long post_id,
String content
) {
this.member_id = memberId;
this.post_id = post_id;
this.content = content;
}

}
11 changes: 11 additions & 0 deletions src/main/java/notai/comment/domain/CommentRepository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package notai.comment.domain;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.math.BigInteger;

@Repository
public interface CommentRepository extends JpaRepository<Comment, BigInteger> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package notai.comment.presentation;

public class CommentController {
}
4 changes: 4 additions & 0 deletions src/main/java/notai/post/application/PostQueryService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package notai.post.application;

public class PostQueryService {
}
4 changes: 4 additions & 0 deletions src/main/java/notai/post/application/PostService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package notai.post.application;

public class PostService {
}
44 changes: 44 additions & 0 deletions src/main/java/notai/post/domain/Post.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package notai.post.domain;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

import static jakarta.persistence.GenerationType.IDENTITY;
import static lombok.AccessLevel.PROTECTED;

@Getter
@NoArgsConstructor(access = PROTECTED)
@AllArgsConstructor
@Entity
public class Post {
@Id
@GeneratedValue(strategy = IDENTITY)
private Long id;
@Column(nullable = false)
private Long member_id;
@Column(nullable = false)
private String title;
@Column(nullable = false)
private String contents;
@Column(nullable = false)
private LocalDateTime created_at;
@Column(nullable = false)
private LocalDateTime updated_at;

public Post(
@Auth memberId,
String title,
String contents
) {
this.member_id = memberId;
this.title = title;
this.contents = contents;
}
}
11 changes: 11 additions & 0 deletions src/main/java/notai/post/domain/PostRepository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package notai.post.domain;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.math.BigInteger;

@Repository
public interface PostRepository extends JpaRepository<Post, BigInteger> {

}
4 changes: 4 additions & 0 deletions src/main/java/notai/post/presentation/PostController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package notai.post.presentation;

public class PostController {
}