Skip to content

Commit

Permalink
Merge pull request #28 from a-romantic-cat/feat/17
Browse files Browse the repository at this point in the history
Feat/17
  • Loading branch information
euunrud authored Jan 21, 2024
2 parents 8a8e66f + 2876961 commit efbe8a5
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/main/java/aromanticcat/umcproject/entity/Letter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package aromanticcat.umcproject.entity;

import lombok.Getter;

import javax.persistence.*;
import java.time.LocalDateTime;

@Entity
@Getter
@Table(name = "letter")
public class Letter extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long letter_id;

@Column(name = "nickname", length = 60)
private String nickname;

@Column(length = 255)
private String content;

private Boolean open;

@Column(name = "login_status")
private Boolean loginStatus;

@Column(name = "sender_ID")
private Long senderId;

@ManyToOne
@JoinColumn(name = "letter_paper_id",insertable = false, updatable = false)
private LetterPaper letterPaper;

@ManyToOne
@JoinColumn(name = "stamp_id", insertable = false, updatable = false)
private Stamp stamp;

@ManyToOne
@JoinColumn(name = "id", insertable = false, updatable = false)
private Letterbox letterbox;
}
26 changes: 26 additions & 0 deletions src/main/java/aromanticcat/umcproject/entity/LetterPaper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package aromanticcat.umcproject.entity;

import lombok.Getter;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.List;

@Entity
@Getter
@Table(name = "letter_paper")
public class LetterPaper extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long letter_paper_id;

@NotNull
private String image_url;

@NotNull
private String name;

@OneToMany(mappedBy = "letterPaper")
private List<Letter> letters;
}
38 changes: 38 additions & 0 deletions src/main/java/aromanticcat/umcproject/entity/Letterbox.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package aromanticcat.umcproject.entity;

import lombok.Getter;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;

@Entity
@Getter
@Table(name = "letterbox")
public class Letterbox extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long letterbox_id;

@Column(name = "user_id", nullable = false)
private Long userId;

@NotNull
private String name;
@NotNull
private String color;

@NotNull
@Column(name = "end_dt")
private LocalDateTime endDt;

@NotNull
private Boolean activate;

@NotNull
private Boolean sender;

@OneToMany(mappedBy = "letterbox")
private List<Letter> letters;
}
26 changes: 26 additions & 0 deletions src/main/java/aromanticcat/umcproject/entity/Stamp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package aromanticcat.umcproject.entity;

import lombok.Getter;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.List;

@Entity
@Getter
@Table(name = "stamp")
public class Stamp extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long stamp_id;

@NotNull
private String image_url;

@NotNull
private String name;

@OneToMany(mappedBy = "stamp")
private List<Letter> letters;
}

0 comments on commit efbe8a5

Please sign in to comment.