-
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.
Merge pull request #13 from Central-MakeUs/feature/7
Feature/7: ์ํฐํฐ ์ธํ
- Loading branch information
Showing
33 changed files
with
330 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
Empty file.
26 changes: 26 additions & 0 deletions
26
src/main/java/com/cmc/suppin/answer/domain/AnonymousParticipant.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,26 @@ | ||
package com.cmc.suppin.answer.domain; | ||
|
||
import com.cmc.suppin.global.domain.BaseDateTimeEntity; | ||
import com.cmc.suppin.survey.domain.Survey; | ||
|
||
import javax.persistence.*; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
public class AnonymousParticipant extends BaseDateTimeEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "anonymous_participant_id") | ||
private Long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "survey_id") | ||
private Survey survey; | ||
|
||
@Column(columnDefinition = "VARCHAR(255)", nullable = false) | ||
private String sessionId; | ||
|
||
@OneToMany(mappedBy = "anonymousParticipant") | ||
private List<Answer> answerList = 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,33 @@ | ||
package com.cmc.suppin.answer.domain; | ||
|
||
import com.cmc.suppin.global.domain.BaseDateTimeEntity; | ||
import com.cmc.suppin.survey.domain.Question; | ||
|
||
import javax.persistence.*; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
public class Answer extends BaseDateTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "answer_id") | ||
private Long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "question_id") | ||
private Question question; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "anonymous_participant_id") | ||
private AnonymousParticipant anonymousParticipant; | ||
|
||
@OneToMany(mappedBy = "answer") | ||
private List<AnswerOption> answerOptionList = new ArrayList<>(); | ||
|
||
@Column(columnDefinition = "TEXT", nullable = false) | ||
private String answerText; | ||
|
||
} | ||
|
22 changes: 22 additions & 0 deletions
22
src/main/java/com/cmc/suppin/answer/domain/AnswerOption.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,22 @@ | ||
package com.cmc.suppin.answer.domain; | ||
|
||
import com.cmc.suppin.survey.domain.QuestionOption; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
public class AnswerOption { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "answer_option_id") | ||
private Long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "answer_id", nullable = false) | ||
private Answer answer; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "question_option_id", nullable = false) | ||
private QuestionOption questionOption; | ||
} | ||
|
Empty file.
Empty file.
Empty file.
Empty file.
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 com.cmc.suppin.comment.domain; | ||
|
||
import com.cmc.suppin.event.domain.Event; | ||
import com.cmc.suppin.global.domain.BaseDateTimeEntity; | ||
|
||
import javax.persistence.*; | ||
|
||
@Entity | ||
public class Comment extends BaseDateTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "comment_id") | ||
private Long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "event_id") | ||
private Event event; | ||
|
||
@Column(columnDefinition = "TEXT", nullable = false) | ||
private String url; | ||
@Column(columnDefinition = "VARCHAR(30)", nullable = false) | ||
private String nickname; | ||
@Column(columnDefinition = "TEXT", nullable = false) | ||
private String commentText; | ||
|
||
} |
Empty file.
Empty file.
Empty file.
Empty file.
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.cmc.suppin.event.domain; | ||
|
||
import com.cmc.suppin.comment.domain.Comment; | ||
import com.cmc.suppin.global.domain.BaseDateTimeEntity; | ||
import com.cmc.suppin.global.enums.EventType; | ||
import com.cmc.suppin.member.domain.Member; | ||
import com.cmc.suppin.survey.domain.Survey; | ||
|
||
import javax.persistence.*; | ||
import java.time.LocalDateTime; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
public class Event extends BaseDateTimeEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "event_id") | ||
private Long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "member_id") | ||
private Member member; | ||
|
||
@OneToMany(mappedBy = "event") | ||
private List<Survey> surveyList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "event") | ||
private List<Comment> commentList = new ArrayList<>(); | ||
|
||
@Column(columnDefinition = "VARCHAR(100)", nullable = false) | ||
private String title; | ||
|
||
@Column(columnDefinition = "TEXT", nullable = false) | ||
private String description; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(nullable = false) | ||
private EventType type; | ||
|
||
@Column | ||
private LocalDateTime startDate; | ||
@Column | ||
private LocalDateTime endDate; | ||
@Column | ||
private LocalDateTime announcementDate; | ||
|
||
// Getters and Setters | ||
|
||
} |
Empty file.
Empty file.
24 changes: 24 additions & 0 deletions
24
src/main/java/com/cmc/suppin/global/domain/BaseDateTimeEntity.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,24 @@ | ||
package com.cmc.suppin.global.domain; | ||
|
||
import lombok.Getter; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import javax.persistence.Column; | ||
import javax.persistence.EntityListeners; | ||
import javax.persistence.MappedSuperclass; | ||
import java.time.LocalDateTime; | ||
|
||
@EntityListeners(AuditingEntityListener.class) | ||
@MappedSuperclass | ||
@Getter | ||
public abstract class BaseDateTimeEntity { | ||
|
||
@Column(updatable = false) | ||
@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,5 @@ | ||
package com.cmc.suppin.global.enums; | ||
|
||
public enum EventType { | ||
COMMENT, SURVEY | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/com/cmc/suppin/global/enums/QuestionType.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,17 @@ | ||
package com.cmc.suppin.global.enums; | ||
|
||
public enum QuestionType { | ||
SHORT_ANSWER("์ฃผ๊ด์"), | ||
SINGLE_CHOICE("๊ฐ๊ด์(๋จ์ผ ์ ํ)"), | ||
MULTIPLE_CHOICE("๊ฐ๊ด์(๋ณต์ ์ ํ)"); | ||
|
||
private String description; | ||
|
||
QuestionType(String description) { | ||
this.description = description; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
} |
Empty file.
Empty file.
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,36 @@ | ||
package com.cmc.suppin.member.domain; | ||
|
||
import com.cmc.suppin.event.domain.Event; | ||
import com.cmc.suppin.global.domain.BaseDateTimeEntity; | ||
|
||
import javax.persistence.*; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
public class Member extends BaseDateTimeEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "member_id") | ||
private Long id; | ||
|
||
@OneToMany(mappedBy = "member") | ||
private List<Event> eventList = new ArrayList<>(); | ||
|
||
@Column(columnDefinition = "VARCHAR(20)", nullable = false) | ||
private String name; | ||
|
||
@Column(columnDefinition = "VARCHAR(30)", nullable = false) | ||
private String nickname; | ||
|
||
@Column(columnDefinition = "VARCHAR(30)", nullable = false) | ||
private String email; | ||
|
||
@Column(columnDefinition = "VARCHAR(20)", nullable = false) | ||
private String password; | ||
|
||
@Column(columnDefinition = "VARCHAR(13)", nullable = false) | ||
private String phoneNumber; | ||
|
||
} | ||
|
Empty file.
Empty file.
Empty file.
Empty file.
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.cmc.suppin.survey.domain; | ||
|
||
import com.cmc.suppin.answer.domain.Answer; | ||
import com.cmc.suppin.global.enums.QuestionType; | ||
|
||
import javax.persistence.*; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
public class Question { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long questionId; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "survey_id") | ||
private Survey survey; | ||
|
||
@OneToMany(mappedBy = "question") | ||
private List<QuestionOption> questionOptionList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "question") | ||
private List<Answer> answerList = new ArrayList<>(); | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(nullable = false) | ||
private QuestionType questionType; | ||
|
||
@Column(columnDefinition = "VARCHAR(100)", nullable = false) | ||
private String questionText; | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/cmc/suppin/survey/domain/QuestionOption.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 com.cmc.suppin.survey.domain; | ||
|
||
import com.cmc.suppin.answer.domain.AnswerOption; | ||
|
||
import javax.persistence.*; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
public class QuestionOption { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "question_option_id") | ||
private Long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "question_id") | ||
private Question question; | ||
|
||
@Column(columnDefinition = "VARCHAR(50)", nullable = false) | ||
private String optionText; | ||
|
||
@OneToMany(mappedBy = "questionOption") | ||
private List<AnswerOption> answerOptionList = 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,29 @@ | ||
package com.cmc.suppin.survey.domain; | ||
|
||
import com.cmc.suppin.answer.domain.AnonymousParticipant; | ||
import com.cmc.suppin.event.domain.Event; | ||
import com.cmc.suppin.global.domain.BaseDateTimeEntity; | ||
|
||
import javax.persistence.*; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
public class Survey extends BaseDateTimeEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "survey_id") | ||
private Long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "event_id") | ||
private Event event; | ||
|
||
@OneToMany(mappedBy = "survey") | ||
private List<Question> questionList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "survey") | ||
private List<AnonymousParticipant> anonymousParticipantList = new ArrayList<>(); | ||
|
||
} | ||
|
Empty file.
Empty file.
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