-
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
[feat/#1] Entity 생성
- Loading branch information
Showing
13 changed files
with
295 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...ate-backend-main/classmate/src/main/java/devteamOne/classmate/channel/domain/Channel.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,37 @@ | ||
package devteamOne.classmate.channel.domain; | ||
|
||
import devteamOne.classmate.participant.domain.Participant; | ||
import devteamOne.classmate.question.domain.Question; | ||
import devteamOne.classmate.survey.domain.Survey; | ||
import devteamOne.classmate.user.domain.User; | ||
import jakarta.persistence.*; | ||
import java.time.LocalDateTime; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
public class Channel { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String name; | ||
|
||
private String code; | ||
|
||
private LocalDateTime createdAt; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
@OneToMany(mappedBy = "channel") | ||
private List<Question> questionList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "channel") | ||
private List<Survey> surveyList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "channel") | ||
private List<Participant> participantList = new ArrayList<>(); | ||
} |
25 changes: 25 additions & 0 deletions
25
classmate-backend-main/classmate/src/main/java/devteamOne/classmate/likes/domain/Likes.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 devteamOne.classmate.likes.domain; | ||
|
||
import devteamOne.classmate.question.domain.Question; | ||
import devteamOne.classmate.user.domain.User; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.IdClass; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
|
||
@Entity | ||
@IdClass(LikesId.class) | ||
public class Likes { | ||
|
||
@Id | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
@Id | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "question_id") | ||
private Question question; | ||
} |
10 changes: 10 additions & 0 deletions
10
...smate-backend-main/classmate/src/main/java/devteamOne/classmate/likes/domain/LikesId.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,10 @@ | ||
package devteamOne.classmate.likes.domain; | ||
|
||
import devteamOne.classmate.question.domain.Question; | ||
import devteamOne.classmate.user.domain.User; | ||
import java.io.Serializable; | ||
|
||
public class LikesId implements Serializable { | ||
private User user; | ||
private Question question; | ||
} |
27 changes: 27 additions & 0 deletions
27
...end-main/classmate/src/main/java/devteamOne/classmate/participant/domain/Participant.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,27 @@ | ||
package devteamOne.classmate.participant.domain; | ||
|
||
import devteamOne.classmate.channel.domain.Channel; | ||
import devteamOne.classmate.user.domain.User; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.IdClass; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
|
||
@Entity | ||
@IdClass(ParticipantId.class) | ||
public class Participant { | ||
|
||
@Id | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "channel_id") | ||
private Channel channel; | ||
|
||
@Id | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
private String nickname; | ||
} |
10 changes: 10 additions & 0 deletions
10
...d-main/classmate/src/main/java/devteamOne/classmate/participant/domain/ParticipantId.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,10 @@ | ||
package devteamOne.classmate.participant.domain; | ||
|
||
import devteamOne.classmate.channel.domain.Channel; | ||
import devteamOne.classmate.user.domain.User; | ||
import java.io.Serializable; | ||
|
||
public class ParticipantId implements Serializable { | ||
private Channel channel; | ||
private User user; | ||
} |
25 changes: 25 additions & 0 deletions
25
...smate-backend-main/classmate/src/main/java/devteamOne/classmate/pinned/domain/Pinned.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 devteamOne.classmate.pinned.domain; | ||
|
||
import devteamOne.classmate.channel.domain.Channel; | ||
import devteamOne.classmate.question.domain.Question; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.IdClass; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.OneToOne; | ||
|
||
@Entity | ||
@IdClass(PinnedId.class) | ||
public class Pinned { | ||
|
||
@Id | ||
@OneToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "channel_id") | ||
private Channel channel; | ||
|
||
@Id | ||
@OneToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "question_id") | ||
private Question question; | ||
} |
10 changes: 10 additions & 0 deletions
10
...ate-backend-main/classmate/src/main/java/devteamOne/classmate/pinned/domain/PinnedId.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,10 @@ | ||
package devteamOne.classmate.pinned.domain; | ||
|
||
import devteamOne.classmate.channel.domain.Channel; | ||
import devteamOne.classmate.question.domain.Question; | ||
import java.io.Serializable; | ||
|
||
public class PinnedId implements Serializable { | ||
private Channel channel; | ||
private Question question; | ||
} |
28 changes: 28 additions & 0 deletions
28
...e-backend-main/classmate/src/main/java/devteamOne/classmate/question/domain/Question.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,28 @@ | ||
package devteamOne.classmate.question.domain; | ||
|
||
import devteamOne.classmate.channel.domain.Channel; | ||
import devteamOne.classmate.user.domain.User; | ||
import jakarta.persistence.*; | ||
import java.time.LocalDateTime; | ||
|
||
@Entity | ||
public class Question { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String context; | ||
|
||
private Boolean answered; | ||
|
||
private LocalDateTime createdAt; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "channel_id") | ||
private Channel channel; | ||
} |
31 changes: 31 additions & 0 deletions
31
...smate-backend-main/classmate/src/main/java/devteamOne/classmate/survey/domain/Survey.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,31 @@ | ||
package devteamOne.classmate.survey.domain; | ||
|
||
import devteamOne.classmate.channel.domain.Channel; | ||
import devteamOne.classmate.surveyOption.domain.SurveyOption; | ||
import jakarta.persistence.*; | ||
import java.time.LocalDateTime; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
public class Survey { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String question; | ||
|
||
private Boolean multipleCheck; | ||
|
||
private Boolean opened; | ||
|
||
private LocalDateTime createdAt; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "channel_id") | ||
private Channel channel; | ||
|
||
@OneToMany(mappedBy = "survey") | ||
private List<SurveyOption> surveyOptionList = new ArrayList<>(); | ||
} |
31 changes: 31 additions & 0 deletions
31
...d-main/classmate/src/main/java/devteamOne/classmate/surveyAnswer/domain/SurveyAnswer.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,31 @@ | ||
package devteamOne.classmate.surveyAnswer.domain; | ||
|
||
import devteamOne.classmate.survey.domain.Survey; | ||
import devteamOne.classmate.surveyOption.domain.SurveyOption; | ||
import devteamOne.classmate.user.domain.User; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.IdClass; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
|
||
@Entity | ||
@IdClass(SurveyAnswerId.class) | ||
public class SurveyAnswer { | ||
|
||
@Id | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_id") | ||
private User user; | ||
|
||
@Id | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "survey_id") | ||
private Survey survey; | ||
|
||
@Id | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "survey_option_id") | ||
private SurveyOption surveyOption; | ||
} |
12 changes: 12 additions & 0 deletions
12
...main/classmate/src/main/java/devteamOne/classmate/surveyAnswer/domain/SurveyAnswerId.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,12 @@ | ||
package devteamOne.classmate.surveyAnswer.domain; | ||
|
||
import devteamOne.classmate.survey.domain.Survey; | ||
import devteamOne.classmate.surveyOption.domain.SurveyOption; | ||
import devteamOne.classmate.user.domain.User; | ||
import java.io.Serializable; | ||
|
||
public class SurveyAnswerId implements Serializable { | ||
private User user; | ||
private Survey survey; | ||
private SurveyOption surveyOption; | ||
} |
18 changes: 18 additions & 0 deletions
18
...d-main/classmate/src/main/java/devteamOne/classmate/surveyOption/domain/SurveyOption.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,18 @@ | ||
package devteamOne.classmate.surveyOption.domain; | ||
|
||
import devteamOne.classmate.survey.domain.Survey; | ||
import jakarta.persistence.*; | ||
|
||
@Entity | ||
public class SurveyOption { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String answer; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "survey_id") | ||
private Survey survey; | ||
} |
31 changes: 31 additions & 0 deletions
31
classmate-backend-main/classmate/src/main/java/devteamOne/classmate/user/domain/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,31 @@ | ||
package devteamOne.classmate.user.domain; | ||
|
||
import devteamOne.classmate.channel.domain.Channel; | ||
import devteamOne.classmate.question.domain.Question; | ||
import jakarta.persistence.*; | ||
import java.time.LocalDateTime; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnJava; | ||
|
||
@Entity | ||
public class User { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private String nickname; | ||
|
||
private String socialId; | ||
|
||
private String provider; | ||
|
||
private LocalDateTime createdAt; | ||
|
||
@OneToMany(mappedBy = "user") | ||
private List<Channel> channelList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "user") | ||
private List<Question> questionList = new ArrayList<>(); | ||
} |