-
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 #13 from a-romantic-cat/feat/10
✨ entity 생성
- Loading branch information
Showing
11 changed files
with
289 additions
and
5 deletions.
There are no files selected for viewing
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
21 changes: 21 additions & 0 deletions
21
src/main/java/aromanticcat/umcproject/entity/BaseEntity.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,21 @@ | ||
package aromanticcat.umcproject.entity; | ||
|
||
import java.time.LocalDateTime; | ||
import javax.persistence.EntityListeners; | ||
import javax.persistence.MappedSuperclass; | ||
import lombok.Getter; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
@MappedSuperclass | ||
@EntityListeners(AuditingEntityListener.class) | ||
@Getter | ||
public abstract class BaseEntity { | ||
|
||
@CreatedDate | ||
private LocalDateTime createdAt; | ||
|
||
@LastModifiedDate | ||
private LocalDateTime updatedAt; | ||
} |
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 aromanticcat.umcproject.entity; | ||
|
||
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 lombok.Getter; | ||
|
||
@Entity | ||
@Getter | ||
public class Friend extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@JoinColumn(name = "to_user_id") | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
private Member member; | ||
|
||
private Long from_user_id; | ||
|
||
private boolean are_we_friend; | ||
|
||
private int times; | ||
} |
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,24 @@ | ||
package aromanticcat.umcproject.entity; | ||
|
||
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.OneToOne; | ||
import lombok.Getter; | ||
|
||
@Entity | ||
@Getter | ||
public class ItemBox extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@JoinColumn(name = "member_id") | ||
@OneToOne(fetch = FetchType.LAZY) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package aromanticcat.umcproject.entity; | ||
|
||
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.OneToMany; | ||
import lombok.Getter; | ||
|
||
@Entity | ||
@Getter | ||
public class Member extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String nickname; | ||
|
||
private String email; | ||
|
||
private int coin; | ||
|
||
@OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.ALL) | ||
private List<MemberMission> memberMissions = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.ALL) | ||
private List<Friend> friends = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.ALL) | ||
private List<NangmanLetter> nangmanLetters = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "member", fetch = FetchType.LAZY, cascade = CascadeType.ALL) | ||
private List<NangmanReply> nangmanReplies = new ArrayList<>(); | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/aromanticcat/umcproject/entity/MemberMission.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,32 @@ | ||
package aromanticcat.umcproject.entity; | ||
|
||
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 lombok.Getter; | ||
|
||
@Entity | ||
@Getter | ||
public class MemberMission extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private int count; | ||
|
||
private boolean status; | ||
|
||
@JoinColumn(name = "member_id") | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
private Member member; | ||
|
||
@JoinColumn(name = "mission_id") | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
private Mission mission; | ||
|
||
} |
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 aromanticcat.umcproject.entity; | ||
|
||
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.OneToMany; | ||
import lombok.Getter; | ||
|
||
@Entity | ||
@Getter | ||
public class Mission extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String name; | ||
|
||
private String content; | ||
|
||
private String reward; | ||
|
||
@OneToMany(mappedBy = "mission", fetch = FetchType.LAZY, cascade = CascadeType.ALL) | ||
private List<MemberMission> memberMissions = new ArrayList<>(); | ||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/aromanticcat/umcproject/entity/NangmanLetter.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,43 @@ | ||
package aromanticcat.umcproject.entity; | ||
|
||
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 lombok.Getter; | ||
|
||
@Entity | ||
@Getter | ||
public class NangmanLetter extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String sender_nickname; | ||
|
||
private boolean is_public; | ||
|
||
private String content; | ||
|
||
private boolean has_response; | ||
|
||
private int thumbs_up_cnt; | ||
|
||
private int heart_cnt; | ||
|
||
private int crying_cnt; | ||
|
||
private int clover_cnt; | ||
|
||
private int clap_cnt; | ||
|
||
private int star_cnt; | ||
|
||
@JoinColumn(name = "member_id") | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
private Member member; | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/aromanticcat/umcproject/entity/NangmanReply.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,32 @@ | ||
package aromanticcat.umcproject.entity; | ||
|
||
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.OneToOne; | ||
import lombok.Getter; | ||
|
||
@Entity | ||
@Getter | ||
public class NangmanReply extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String response_sender_nickname; | ||
|
||
private String content; | ||
|
||
@JoinColumn(name = "letter_id") | ||
@OneToOne(fetch = FetchType.LAZY) | ||
private NangmanLetter nangmanLetter; | ||
|
||
@JoinColumn(name = "member_id") | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package aromanticcat.umcproject.entity; | ||
|
||
import javax.persistence.Column; | ||
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.OneToOne; | ||
import lombok.Getter; | ||
|
||
@Entity | ||
@Getter | ||
public class Reward extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private int type; | ||
|
||
@Column(columnDefinition = "TEXT") | ||
private String image_url; | ||
|
||
private String name; | ||
|
||
@JoinColumn(name = "mission_id") | ||
@OneToOne(fetch = FetchType.LAZY) | ||
private Mission mission; | ||
|
||
} |
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