-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Avatar 엔티티 생성 * feat: Category enum 생성 * feat: Member 엔티티 생성 * feat: Post 엔티티 생성 * feat: Comment 엔티티 생성 * feat: PostLike 엔티티 생성 * feat: PostPhoto 엔티티 생성 * feat: Record 엔티티 생성 * feat: RecordPhoto 엔티티 생성 * feat: Report 엔티티 생성 * feat: Tag 엔티티 생성 * feat: BaseTimeEntity 추상 클래스 생성 * feat: ReportType enum 생성 * chore: category id 추가 * chore: submodule 변경사항
- Loading branch information
1 parent
872c072
commit 173e450
Showing
14 changed files
with
433 additions
and
1 deletion.
There are no files selected for viewing
Submodule config
updated
from 82425a to a53969
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,16 @@ | ||
package com.todaysgym.todaysgym.avatar; | ||
|
||
public enum Avatar { | ||
NONE(0, "none", -1, -1); | ||
private final int level; | ||
private final String imgUrl; | ||
private final int minRecordCount; | ||
private final int maxRecordCount; | ||
|
||
Avatar(int level, String imgUrl, int minRecordCount, int maxRecordCount) { | ||
this.level = level; | ||
this.imgUrl = imgUrl; | ||
this.minRecordCount = minRecordCount; | ||
this.maxRecordCount = maxRecordCount; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/todaysgym/todaysgym/category/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,13 @@ | ||
package com.todaysgym.todaysgym.category; | ||
|
||
public enum Category { | ||
NONE(0L, "none"); | ||
|
||
private final Long id; | ||
private final String name; | ||
|
||
Category(Long id, String name) { | ||
this.id = id; | ||
this.name = name; | ||
} | ||
} |
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,63 @@ | ||
package com.todaysgym.todaysgym.member; | ||
|
||
import com.todaysgym.todaysgym.avatar.Avatar; | ||
import com.todaysgym.todaysgym.category.Category; | ||
import com.todaysgym.todaysgym.post.Post; | ||
import com.todaysgym.todaysgym.post.comment.Comment; | ||
import com.todaysgym.todaysgym.record.Record; | ||
import com.todaysgym.todaysgym.tag.Tag; | ||
import com.todaysgym.todaysgym.utils.BaseTimeEntity; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import javax.persistence.CascadeType; | ||
import javax.persistence.Entity; | ||
import javax.persistence.EnumType; | ||
import javax.persistence.Enumerated; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.OneToMany; | ||
import javax.persistence.Table; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Table(name = "member") | ||
public class Member extends BaseTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long memberId; | ||
|
||
private String nickName; | ||
private String introduce; | ||
private String email; | ||
private String refreshToken; | ||
private String deviceToken; | ||
private boolean locked = false; // false = 공개, true = 비공개 | ||
private int recordCount = 0; | ||
private boolean recordCheck = false; | ||
private int report = 0; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private Category category; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private Avatar avatar; | ||
|
||
@OneToMany(mappedBy = "member", cascade = {CascadeType.ALL}, orphanRemoval = true) | ||
private List<Record> recordList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "member", cascade = {CascadeType.ALL}, orphanRemoval = true) | ||
private List<Post> postList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "member", cascade = {CascadeType.ALL}, orphanRemoval = true) | ||
private List<Comment> commentList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "member", cascade = {CascadeType.ALL}, orphanRemoval = true) | ||
private List<Tag> tagList = new ArrayList<>(); | ||
} |
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,58 @@ | ||
package com.todaysgym.todaysgym.post; | ||
|
||
import com.todaysgym.todaysgym.category.Category; | ||
import com.todaysgym.todaysgym.member.Member; | ||
import com.todaysgym.todaysgym.post.comment.Comment; | ||
import com.todaysgym.todaysgym.post.photo.PostPhoto; | ||
import com.todaysgym.todaysgym.record.Record; | ||
import com.todaysgym.todaysgym.utils.BaseTimeEntity; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import javax.persistence.CascadeType; | ||
import javax.persistence.Entity; | ||
import javax.persistence.EnumType; | ||
import javax.persistence.Enumerated; | ||
import javax.persistence.FetchType; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.ManyToOne; | ||
import javax.persistence.OneToMany; | ||
import javax.persistence.Table; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Table(name = "post") | ||
public class Post extends BaseTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long postId; | ||
|
||
private String title; | ||
private String content; | ||
private int report = 0; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "member_id") | ||
private Member member; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "record_id") | ||
private Record record; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private Category category; | ||
|
||
@OneToMany(mappedBy = "post", cascade = {CascadeType.ALL}, orphanRemoval = true) | ||
private List<Comment> commentList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "post", cascade = {CascadeType.ALL}, orphanRemoval = true) | ||
private List<PostPhoto> photoList = new ArrayList<>(); | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/com/todaysgym/todaysgym/post/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,39 @@ | ||
package com.todaysgym.todaysgym.post.comment; | ||
|
||
import com.todaysgym.todaysgym.member.Member; | ||
import com.todaysgym.todaysgym.post.Post; | ||
import com.todaysgym.todaysgym.utils.BaseTimeEntity; | ||
import javax.persistence.Entity; | ||
import javax.persistence.FetchType; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.ManyToOne; | ||
import javax.persistence.Table; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Table(name = "comment") | ||
public class Comment extends BaseTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long commentId; | ||
|
||
private String content; | ||
private int report = 0; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "member_id") | ||
private Member member; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "post_id") | ||
private Post post; | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/com/todaysgym/todaysgym/post/like/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,25 @@ | ||
package com.todaysgym.todaysgym.post.like; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.Table; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Table(name = "post_like") | ||
public class PostLike { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
private Long memberId; | ||
private Long postId; | ||
private boolean status; // true = 좋아요, false = 취소 | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/com/todaysgym/todaysgym/post/photo/PostPhoto.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,33 @@ | ||
package com.todaysgym.todaysgym.post.photo; | ||
|
||
import com.todaysgym.todaysgym.post.Post; | ||
import javax.persistence.Entity; | ||
import javax.persistence.FetchType; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.ManyToOne; | ||
import javax.persistence.Table; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Table(name = "post_photo") | ||
public class PostPhoto { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String imgUrl; | ||
private String fileName; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "post_id") | ||
private Post post; | ||
} |
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,50 @@ | ||
package com.todaysgym.todaysgym.record; | ||
|
||
import com.todaysgym.todaysgym.member.Member; | ||
import com.todaysgym.todaysgym.post.Post; | ||
import com.todaysgym.todaysgym.record.photo.RecordPhoto; | ||
import com.todaysgym.todaysgym.tag.Tag; | ||
import com.todaysgym.todaysgym.utils.BaseTimeEntity; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import javax.persistence.CascadeType; | ||
import javax.persistence.Entity; | ||
import javax.persistence.FetchType; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.ManyToOne; | ||
import javax.persistence.OneToMany; | ||
import javax.persistence.Table; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Table(name = "record") | ||
public class Record extends BaseTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long recordId; | ||
|
||
private String content; | ||
private int report = 0; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "member_id") | ||
private Member member; | ||
|
||
@OneToMany(mappedBy = "record", cascade = {CascadeType.ALL}, orphanRemoval = true) | ||
private List<Post> postList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "record", cascade = {CascadeType.ALL}, orphanRemoval = true) | ||
private List<RecordPhoto> photoList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "record", cascade = {CascadeType.ALL}, orphanRemoval = true) | ||
private List<Tag> tagList = new ArrayList<>(); | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/com/todaysgym/todaysgym/record/photo/RecordPhoto.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,33 @@ | ||
package com.todaysgym.todaysgym.record.photo; | ||
|
||
import com.todaysgym.todaysgym.record.Record; | ||
import javax.persistence.Entity; | ||
import javax.persistence.FetchType; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.ManyToOne; | ||
import javax.persistence.Table; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Table(name = "record_photo") | ||
public class RecordPhoto { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String imgUrl; | ||
private String fileName; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "record_id") | ||
private Record record; | ||
} |
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,32 @@ | ||
package com.todaysgym.todaysgym.report; | ||
|
||
import com.todaysgym.todaysgym.utils.BaseTimeEntity; | ||
import javax.persistence.Entity; | ||
import javax.persistence.EnumType; | ||
import javax.persistence.Enumerated; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.Table; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Table(name = "report") | ||
public class Report extends BaseTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long reportId; | ||
|
||
private Long reporterId; // 신고하는 유저의 ID | ||
private Long reportedId; // 신고당하는 것의 ID | ||
private String content; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private ReportType type; // 신고 당하는 것이 무엇인지 구별 (MEMBER, POST, COMMENT 중 1개) | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/todaysgym/todaysgym/report/ReportType.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,13 @@ | ||
package com.todaysgym.todaysgym.report; | ||
|
||
public enum ReportType { | ||
MEMBER("member"), | ||
POST("post"), | ||
COMMENT("comment"); | ||
|
||
private final String type; | ||
|
||
ReportType(String type) { | ||
this.type = type; | ||
} | ||
} |
Oops, something went wrong.