-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from KTB16Team/feature/24-dispute
Feature/24 dispute
- Loading branch information
Showing
11 changed files
with
253 additions
and
12 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
backend/src/main/java/aiin/backend/common/entity/Like.java
This file contains 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 aiin.backend.common.entity; | ||
|
||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import aiin.backend.member.entity.Member; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.EntityListeners; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.MappedSuperclass; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@MappedSuperclass | ||
@NoArgsConstructor | ||
@EntityListeners(AuditingEntityListener.class) | ||
public abstract class Like extends BaseEntity { | ||
|
||
@Id @GeneratedValue | ||
@Column(nullable = false) | ||
private Long like_id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "member_id", nullable = false) | ||
private Member member; | ||
} |
This file contains 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
This file contains 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
2 changes: 1 addition & 1 deletion
2
backend/src/main/java/aiin/backend/member/dto/DeleteRequest.java
This file contains 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package aiin.backend.member.dto; | ||
|
||
public record DeleteRequest( | ||
String email | ||
String password | ||
) | ||
{ | ||
} |
This file contains 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
This file contains 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
19 changes: 19 additions & 0 deletions
19
backend/src/main/java/aiin/backend/openJury/entity/comment/ChildComment.java
This file contains 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,19 @@ | ||
package aiin.backend.openJury.entity.comment; | ||
|
||
import static lombok.AccessLevel.*; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Table; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@Table(name = "child_comments") | ||
@NoArgsConstructor(access = PROTECTED) | ||
public class ChildComment extends Comment { | ||
|
||
@Column(nullable = false) | ||
private Long parentId; | ||
} |
55 changes: 55 additions & 0 deletions
55
backend/src/main/java/aiin/backend/openJury/entity/comment/Comment.java
This file contains 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 aiin.backend.openJury.entity.comment; | ||
|
||
import static lombok.AccessLevel.*; | ||
|
||
import java.util.List; | ||
|
||
import aiin.backend.common.entity.BaseEntity; | ||
import aiin.backend.member.entity.Member; | ||
import aiin.backend.openJury.entity.post.Post; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.OneToMany; | ||
import jakarta.persistence.Table; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@Table(name = "comments") | ||
@NoArgsConstructor(access = PROTECTED) | ||
public class Comment extends BaseEntity { | ||
|
||
@Id @GeneratedValue | ||
@Column(name = "comment_id") | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "author_id") | ||
private Member author; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "post_id") | ||
private Post post; | ||
|
||
@OneToMany(mappedBy = "parent") | ||
private List<ChildComment> children; | ||
|
||
@Column(nullable = false) | ||
private String content; | ||
|
||
void setAuthor(Member author) { | ||
this.author = author; | ||
author.getComments().add(this); | ||
} | ||
|
||
void setPost(Post post) { | ||
this.post = post; | ||
post.getComments().add(this); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
backend/src/main/java/aiin/backend/openJury/entity/post/Post.java
This file contains 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,59 @@ | ||
package aiin.backend.openJury.entity.post; | ||
|
||
import static lombok.AccessLevel.*; | ||
|
||
import java.util.List; | ||
|
||
import aiin.backend.common.entity.BaseEntity; | ||
import aiin.backend.dispute.entity.Dispute; | ||
import aiin.backend.member.entity.Member; | ||
import aiin.backend.openJury.entity.comment.Comment; | ||
import aiin.backend.openJury.model.Category; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.OneToMany; | ||
import jakarta.persistence.OneToOne; | ||
import jakarta.persistence.Table; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@Table(name = "posts") | ||
@NoArgsConstructor(access = PROTECTED) | ||
public class Post extends BaseEntity { | ||
|
||
@Id @GeneratedValue | ||
@Column(name = "post_id") | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "member_id") | ||
private Member author; | ||
|
||
@OneToMany(mappedBy = "post") | ||
private List<Comment> comments; | ||
|
||
@OneToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "dispute_id") | ||
private Dispute dispute; | ||
|
||
@Column(nullable = false) | ||
private String title; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(nullable = false) | ||
private Category category; | ||
|
||
public void setAuthor(Member author) { | ||
this.author = author; | ||
author.getPosts().add(this); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
backend/src/main/java/aiin/backend/openJury/entity/post/PostLike.java
This file contains 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,29 @@ | ||
package aiin.backend.openJury.entity.post; | ||
|
||
import static lombok.AccessLevel.*; | ||
|
||
import aiin.backend.common.entity.Like; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.Table; | ||
import jakarta.persistence.UniqueConstraint; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@Table( | ||
name = "post_likes", | ||
uniqueConstraints = { | ||
@UniqueConstraint(columnNames = { "post_id", "member_id" }) | ||
}) | ||
@NoArgsConstructor(access = PROTECTED) | ||
public class PostLike extends Like { | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "post_id") | ||
private Post post; | ||
} |
23 changes: 23 additions & 0 deletions
23
backend/src/main/java/aiin/backend/openJury/model/Category.java
This file contains 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,23 @@ | ||
package aiin.backend.openJury.model; | ||
|
||
public enum Category { | ||
|
||
COMMON("일반"), | ||
MBTI("MBTI"), | ||
MARRIAGE("결혼"), | ||
LOVE("연애"), | ||
FOOD("음식"), | ||
DAILY("일상"), | ||
PARENTING("육아"), | ||
SPORTS("스포츠"), | ||
HOBBY("취미"), | ||
INVEST("투자"), | ||
MONEY("돈"), | ||
ART("예술"); | ||
|
||
private final String value; | ||
|
||
Category(String value) { | ||
this.value = value; | ||
} | ||
} |