-
Notifications
You must be signed in to change notification settings - Fork 0
Feat: 게시판 도메인 생성 #16
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
Open
EunjungOh123
wants to merge
10
commits into
dev
Choose a base branch
from
feat-13
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feat: 게시판 도메인 생성 #16
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e7415a5
feat: 댓글 엔티티 생성
EunjungOh123 53b3f8e
feat: 좋아요 엔티티 생성
EunjungOh123 882550f
feat: 게시글 이미지 엔티티 생성
EunjungOh123 7190262
feat: 회원과 댓글 연관관계 설정
EunjungOh123 b98f431
feat: 회원-댓글 연관관계 영속성 전이 설정 수정
EunjungOh123 e8335a7
feat: 회원-댓글 단뱡향 연관관계로 수정
EunjungOh123 af4a363
feat: 좋아요 엔티티에 set 메서드 추가
EunjungOh123 db43614
feat: category 엔티티 생성
EunjungOh123 cdf456d
feat: PostCategory 엔티티 생성
EunjungOh123 0538625
feat: Post 엔티티 생성 (양방향 매핑)
EunjungOh123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
module-domain/src/main/java/com/gaethering/moduledomain/domain/board/Category.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package com.gaethering.moduledomain.domain.board; | ||
|
|
||
| import lombok.*; | ||
|
|
||
| import javax.persistence.*; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @Builder | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class Category { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "category_id") | ||
| private Long id; | ||
|
|
||
| @Column(nullable = false) | ||
| private String categoryName; | ||
|
|
||
| @OneToMany(mappedBy = "category") | ||
| private List<PostCategory> postCategories = new ArrayList<>(); | ||
| } |
39 changes: 39 additions & 0 deletions
39
module-domain/src/main/java/com/gaethering/moduledomain/domain/board/Comment.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| package com.gaethering.moduledomain.domain.board; | ||
|
|
||
| import com.gaethering.moduledomain.domain.basic.BaseTimeEntity; | ||
| import com.gaethering.moduledomain.domain.member.Member; | ||
| import lombok.*; | ||
|
|
||
| import javax.persistence.*; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @Builder | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class Comment extends BaseTimeEntity { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "comment_id", nullable = false) | ||
| private Long id; | ||
|
|
||
| @Column(nullable = false) | ||
| private String comment; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "post_id", updatable = false) | ||
| private Post post; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "member_id", updatable = false) | ||
| private Member member; | ||
|
|
||
| public void setPost (Post post) { | ||
| this.post = post; | ||
| } | ||
|
|
||
| public void setMember (Member member) { | ||
| this.member = member; | ||
| } | ||
| } |
34 changes: 34 additions & 0 deletions
34
module-domain/src/main/java/com/gaethering/moduledomain/domain/board/Heart.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package com.gaethering.moduledomain.domain.board; | ||
|
|
||
| import com.gaethering.moduledomain.domain.member.Member; | ||
| import lombok.*; | ||
|
|
||
| import javax.persistence.*; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @Builder | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class Heart { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "heart_id") | ||
| private Long id; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "member_id", updatable = false) | ||
| private Member member; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "post_id", updatable = false) | ||
| private Post post; | ||
|
|
||
| public void setPost (Post post) { | ||
| this.post = post; | ||
| } | ||
| public void setMember (Member member) { | ||
| this.member = member; | ||
| } | ||
| } |
55 changes: 55 additions & 0 deletions
55
module-domain/src/main/java/com/gaethering/moduledomain/domain/board/Post.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| package com.gaethering.moduledomain.domain.board; | ||
|
|
||
| import com.gaethering.moduledomain.domain.basic.BaseTimeEntity; | ||
| import com.gaethering.moduledomain.domain.member.Member; | ||
| import lombok.*; | ||
| import org.hibernate.annotations.ColumnDefault; | ||
|
|
||
| import javax.persistence.*; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @Builder | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class Post extends BaseTimeEntity { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "post_id", nullable = false) | ||
| private Long id; | ||
|
|
||
| @Column(nullable = false) | ||
| private String title; | ||
|
|
||
| @Column(columnDefinition = "TEXT", nullable = false) | ||
| private String content; | ||
|
|
||
| @ColumnDefault("0") | ||
| private int viewCnt; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "member_id") | ||
| private Member member; | ||
|
|
||
| @OneToMany(mappedBy = "post") | ||
| private List<Comment> comments = new ArrayList<>(); | ||
|
|
||
| @OneToMany(mappedBy = "post", | ||
| cascade = CascadeType.REMOVE, | ||
| orphanRemoval = true) | ||
| private List<PostImage> postImages = new ArrayList<>(); | ||
|
|
||
| @OneToMany(mappedBy = "post") | ||
| private List<Heart> hearts = new ArrayList<>(); | ||
|
|
||
| @OneToMany(mappedBy = "post") | ||
| private List<PostCategory> postCategories = new ArrayList<>(); | ||
|
|
||
| public void addImage (PostImage image) { | ||
| this.postImages.add(image); | ||
| image.setPost(this); | ||
| } | ||
| } |
26 changes: 26 additions & 0 deletions
26
module-domain/src/main/java/com/gaethering/moduledomain/domain/board/PostCategory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package com.gaethering.moduledomain.domain.board; | ||
|
|
||
| import lombok.*; | ||
|
|
||
| import javax.persistence.*; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @Builder | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class PostCategory { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "post_category_id", nullable = false) | ||
| private Long id; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "post_id", updatable = false) | ||
| private Post post; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "category_id", updatable = false) | ||
| private Category category; | ||
| } |
30 changes: 30 additions & 0 deletions
30
module-domain/src/main/java/com/gaethering/moduledomain/domain/board/PostImage.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package com.gaethering.moduledomain.domain.board; | ||
|
|
||
| import lombok.*; | ||
|
|
||
| import javax.persistence.*; | ||
|
|
||
| @Entity | ||
| @Getter | ||
| @Builder | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class PostImage { | ||
|
|
||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "image_id") | ||
| private Long id; | ||
|
|
||
| private String imageUrl; | ||
|
|
||
| private boolean isRepresentative; | ||
|
|
||
| @ManyToOne(fetch = FetchType.LAZY) | ||
| @JoinColumn(name = "post_id", updatable = false) | ||
| private Post post; | ||
|
|
||
| public void setPost (Post post) { | ||
| this.post = post; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
도메인 이름 때문에 post_image_id는 어떠신가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 수정했습니다~!