-
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.
Browse files
Browse the repository at this point in the history
…ering [FEAT] 초기 Entity 설계 + 폴더 구조 세팅
- Loading branch information
Showing
15 changed files
with
290 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name: CD | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [ "develop" ] | ||
|
||
jobs: | ||
|
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,6 +1,8 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ "develop" ] | ||
pull_request: | ||
branches: [ "develop" ] | ||
|
||
|
48 changes: 48 additions & 0 deletions
48
src/main/java/org/sopt/lequuServer/domain/postit/model/Postit.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,48 @@ | ||
package org.sopt.lequuServer.domain.postit.model; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.sopt.lequuServer.domain.rollingpaper.model.RollingPaper; | ||
import org.sopt.lequuServer.domain.user.model.User; | ||
import org.sopt.lequuServer.global.common.model.BaseTimeEntity; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Table(name = "postit") | ||
public class Postit extends BaseTimeEntity { | ||
|
||
@Id | ||
@Column(name = "postit_id") | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false) | ||
private String content; | ||
|
||
@Column(nullable = false) | ||
private String background; | ||
|
||
private int textColor; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "rolling_paper_id") | ||
private RollingPaper rollingPaper; | ||
|
||
@Builder | ||
public Postit(String content, String background, int textColor, User user, RollingPaper rollingPaper) { | ||
this.content = content; | ||
this.background = background; | ||
this.textColor = textColor; | ||
this.user = user; | ||
this.rollingPaper = rollingPaper; | ||
} | ||
|
||
public static Postit of(String content, String background, int textColor, User user, RollingPaper rollingPaper) { | ||
return new Postit(content, background, textColor, user, rollingPaper); | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
src/main/java/org/sopt/lequuServer/domain/rollingpaper/model/RollingPaper.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,73 @@ | ||
package org.sopt.lequuServer.domain.rollingpaper.model; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.sopt.lequuServer.domain.postit.model.Postit; | ||
import org.sopt.lequuServer.domain.sticker.model.PostedSticker; | ||
import org.sopt.lequuServer.domain.user.model.User; | ||
import org.sopt.lequuServer.global.common.model.BaseTimeEntity; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Table(name = "rolling_paper") | ||
public class RollingPaper extends BaseTimeEntity { | ||
|
||
@Id | ||
@Column(name = "rolling_paper_id") | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false) | ||
private String uuid; | ||
|
||
@Column(nullable = false) | ||
private String favoriteName; | ||
|
||
@Column(nullable = false) | ||
private String favoriteImage; | ||
|
||
@Column(nullable = false) | ||
private String title; | ||
|
||
@Column(nullable = false) | ||
private String description; | ||
|
||
private int backgroundColor; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
@OneToMany(mappedBy = "rollingPaper") | ||
private List<Postit> postits = new ArrayList<>(); | ||
|
||
public void addPostit(Postit postit) { | ||
postits.add(postit); | ||
} | ||
|
||
@OneToMany(mappedBy = "rollingPaper") | ||
private List<PostedSticker> postedStickers = new ArrayList<>(); | ||
|
||
public void addPostedSticker(PostedSticker postedSticker) { | ||
postedStickers.add(postedSticker); | ||
} | ||
|
||
@Builder | ||
public RollingPaper(String uuid, String favoriteName, String favoriteImage, String title, String description, int backgroundColor, User user) { | ||
this.uuid = uuid; | ||
this.favoriteName = favoriteName; | ||
this.favoriteImage = favoriteImage; | ||
this.title = title; | ||
this.description = description; | ||
this.backgroundColor = backgroundColor; | ||
this.user = user; | ||
} | ||
|
||
public static RollingPaper of(String uuid, String favoriteName, String favoriteImage, String title, String description, int backgroundColor, User user) { | ||
return new RollingPaper(uuid, favoriteName, favoriteImage, title, description, backgroundColor, user); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/org/sopt/lequuServer/domain/sticker/model/PostedSticker.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,47 @@ | ||
package org.sopt.lequuServer.domain.sticker.model; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.sopt.lequuServer.domain.rollingpaper.model.RollingPaper; | ||
import org.sopt.lequuServer.domain.user.model.User; | ||
import org.sopt.lequuServer.global.common.model.BaseTimeEntity; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Table(name = "posted_sticker") | ||
public class PostedSticker extends BaseTimeEntity { | ||
|
||
@Id | ||
@Column(name = "posted_sticker_id") | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private int positionX; | ||
|
||
private int positionY; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "rolling_paper_id") | ||
private RollingPaper rollingPaper; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "sticker_id") | ||
private Sticker sticker; | ||
|
||
@Builder | ||
public PostedSticker(int positionX, int positionY, RollingPaper rollingPaper, Sticker sticker) { | ||
this.positionX = positionX; | ||
this.positionY = positionY; | ||
this.rollingPaper = rollingPaper; | ||
this.sticker = sticker; | ||
} | ||
|
||
public static PostedSticker of(int positionX, int positionY, RollingPaper rollingPaper, Sticker sticker) { | ||
return new PostedSticker(positionX, positionY, rollingPaper, sticker); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/org/sopt/lequuServer/domain/sticker/model/Sticker.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 org.sopt.lequuServer.domain.sticker.model; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.sopt.lequuServer.domain.rollingpaper.model.RollingPaper; | ||
import org.sopt.lequuServer.global.common.model.BaseTimeEntity; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Table(name = "sticker") | ||
public class Sticker extends BaseTimeEntity { | ||
|
||
@Id | ||
@Column(name = "sticker_id") | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false) | ||
private String stickerImage; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(nullable = false) | ||
private StickerCategory category; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "rolling_paper_id") | ||
private RollingPaper rollingPaper; | ||
|
||
public Sticker(String stickerImage, StickerCategory category, RollingPaper rollingPaper) { | ||
this.stickerImage = stickerImage; | ||
this.category = category; | ||
this.rollingPaper = rollingPaper; | ||
} | ||
|
||
public static Sticker of(String stickerImage, StickerCategory category, RollingPaper rollingPaper) { | ||
return new Sticker(stickerImage, category, rollingPaper); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/org/sopt/lequuServer/domain/sticker/model/StickerCategory.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,15 @@ | ||
package org.sopt.lequuServer.domain.sticker.model; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor(access = AccessLevel.PRIVATE) | ||
public enum StickerCategory { | ||
|
||
ALPHABET("알파벳"), | ||
BIRTHDAY("생일"); | ||
|
||
private final String value; | ||
} |
56 changes: 56 additions & 0 deletions
56
src/main/java/org/sopt/lequuServer/domain/user/model/User.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,56 @@ | ||
package org.sopt.lequuServer.domain.user.model; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import org.sopt.lequuServer.domain.postit.model.Postit; | ||
import org.sopt.lequuServer.domain.rollingpaper.model.RollingPaper; | ||
import org.sopt.lequuServer.domain.sticker.model.PostedSticker; | ||
import org.sopt.lequuServer.global.common.model.BaseTimeEntity; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Table(name = "user") | ||
public class User extends BaseTimeEntity { | ||
|
||
@Id | ||
@Column(name = "user_id") | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(nullable = false) | ||
private String nickname; | ||
|
||
@OneToMany(mappedBy = "user") | ||
private List<RollingPaper> rollingPapers = new ArrayList<>(); | ||
|
||
public void addRollingPaper(RollingPaper rollingPaper) { | ||
rollingPapers.add(rollingPaper); | ||
} | ||
|
||
@OneToMany(mappedBy = "user") | ||
private List<Postit> postits = new ArrayList<>(); | ||
|
||
public void addPostit(Postit postit) { | ||
postits.add(postit); | ||
} | ||
|
||
@OneToMany(mappedBy = "user") | ||
private List<PostedSticker> postedStickers = new ArrayList<>(); | ||
|
||
public void addPostedSticker(PostedSticker postedSticker) { | ||
postedStickers.add(postedSticker); | ||
} | ||
|
||
@Builder | ||
public User(String nickname) { | ||
this.nickname = nickname; | ||
} | ||
|
||
public static User of(String nickname) { | ||
return new User(nickname); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...mmon/exception/model/CustomException.java → ...bal/common/exception/CustomException.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
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
.../global/common/domain/BaseTimeEntity.java → ...r/global/common/model/BaseTimeEntity.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
2 changes: 1 addition & 1 deletion
2
...erver/global/common/config/AWSConfig.java → .../lequuServer/global/config/AWSConfig.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
2 changes: 1 addition & 1 deletion
2
...obal/common/config/JpaAuditingConfig.java → ...rver/global/config/JpaAuditingConfig.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
2 changes: 1 addition & 1 deletion
2
...erver/global/common/config/WebConfig.java → .../lequuServer/global/config/WebConfig.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
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