-
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.
[Feat] 초기 엔티티/클래스 추가
- Loading branch information
Showing
15 changed files
with
380 additions
and
0 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
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.join.core.address.domain; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Entity | ||
public class Address { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Schema(description = "시/도 주소(1차)", example = "서울특별시") | ||
@NotBlank | ||
@NotNull | ||
private String province; | ||
|
||
@Schema(description = "시/군/구 주소(2차)", example = "동작구") | ||
@NotBlank | ||
@NotNull | ||
private String city; | ||
|
||
} |
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 com.join.core.avatar.domain; | ||
|
||
import com.join.core.common.domain.BaseTimeEntity; | ||
import com.join.core.user.domain.User; | ||
import jakarta.persistence.*; | ||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.Size; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Entity | ||
public class Avatar extends BaseTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(unique = true) | ||
@NotNull | ||
@Size(min = 2, max = 7) | ||
private String nickname; | ||
|
||
private String preferenceId; | ||
|
||
@NotNull | ||
private int totalRating; | ||
|
||
@NotNull | ||
private int ratingCnt; | ||
|
||
@NotNull | ||
@JoinColumn(name = "user_id") | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
private User user; | ||
|
||
} |
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.join.core.category.domain; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Entity | ||
public class Category { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@NotNull | ||
private String categoryName; | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/join/core/common/domain/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.join.core.common.domain; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.EntityListeners; | ||
import jakarta.persistence.MappedSuperclass; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@EntityListeners(value = {AuditingEntityListener.class}) | ||
@MappedSuperclass | ||
public abstract class BaseTimeEntity { | ||
|
||
@CreatedDate | ||
@Column(updatable = false) | ||
private LocalDateTime createdDate; | ||
|
||
@LastModifiedDate | ||
private LocalDateTime updatedDate; | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/com/join/core/enrollment/constant/EnrollmentEndReason.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,6 @@ | ||
package com.join.core.enrollment.constant; | ||
|
||
public enum EnrollmentEndReason { | ||
ATTENDANCE, AUTHENTICATION, RATING, STUDY_COUNT, OTHER | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/com/join/core/enrollment/constant/EnrollmentStatus.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,6 @@ | ||
package com.join.core.enrollment.constant; | ||
|
||
public enum EnrollmentStatus { | ||
APPROVED, DENIED | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/com/join/core/enrollment/constant/StudyRole.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,6 @@ | ||
package com.join.core.enrollment.constant; | ||
|
||
public enum StudyRole { | ||
LEADER, MEMBER | ||
|
||
} |
54 changes: 54 additions & 0 deletions
54
src/main/java/com/join/core/enrollment/domain/Enrollment.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,54 @@ | ||
package com.join.core.enrollment.domain; | ||
|
||
import com.join.core.avatar.domain.Avatar; | ||
import com.join.core.enrollment.constant.EnrollmentEndReason; | ||
import com.join.core.enrollment.constant.EnrollmentStatus; | ||
import com.join.core.enrollment.constant.StudyRole; | ||
import com.join.core.study.domain.Study; | ||
import com.join.core.common.domain.BaseTimeEntity; | ||
import jakarta.persistence.*; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Entity | ||
public class Enrollment extends BaseTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@NotNull | ||
@Enumerated(EnumType.STRING) | ||
private EnrollmentStatus status; | ||
|
||
@NotNull | ||
@Enumerated(EnumType.STRING) | ||
private StudyRole role; | ||
|
||
@NotNull | ||
private LocalDateTime enrolledDate; | ||
|
||
@NotNull | ||
private LocalDateTime endDate; | ||
|
||
@NotNull | ||
@Enumerated(EnumType.STRING) | ||
private EnrollmentEndReason endReason; | ||
|
||
@NotNull | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "study_id") | ||
private Study study; | ||
|
||
@NotNull | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "avatar_id") | ||
private Avatar avatar; | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/com/join/core/evaluation/domain/Evaluation.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,45 @@ | ||
package com.join.core.evaluation.domain; | ||
|
||
import com.join.core.common.domain.BaseTimeEntity; | ||
import com.join.core.study.domain.Study; | ||
import com.join.core.avatar.domain.Avatar; | ||
import jakarta.persistence.*; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Entity | ||
public class Evaluation extends BaseTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@NotNull | ||
private int sincerity; | ||
|
||
@NotNull | ||
private int familiarity; | ||
|
||
@NotNull | ||
private int effect; | ||
|
||
@NotNull | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "ratee_id") | ||
private Avatar ratee; | ||
|
||
@NotNull | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "rater_id") | ||
private Avatar rater; | ||
|
||
@NotNull | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "study_id") | ||
private Study study; | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
src/main/java/com/join/core/study/constant/StudyEndReason.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,6 @@ | ||
package com.join.core.study.constant; | ||
|
||
public enum StudyEndReason { | ||
REPORT, FORCED, COMPLETED, OTHER // 신고종료, 강제종료, 정상종료, 기타 | ||
|
||
} |
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,6 @@ | ||
package com.join.core.study.constant; | ||
|
||
public enum StudyStatus { | ||
RECRUITING, READY, ACTIVE, COMPLETED // 모집중, 모집완료, 활동중, 활동완료 | ||
|
||
} |
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,79 @@ | ||
package com.join.core.study.domain; | ||
|
||
import com.join.core.enrollment.domain.Enrollment; | ||
import com.join.core.address.domain.Address; | ||
import com.join.core.category.domain.Category; | ||
import com.join.core.study.constant.StudyEndReason; | ||
import com.join.core.study.constant.StudyStatus; | ||
import jakarta.persistence.*; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
@Getter | ||
@Entity | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Study { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@NotNull | ||
private String studyName; | ||
|
||
@NotNull | ||
private String introduction; | ||
|
||
@NotNull | ||
private String content; | ||
|
||
@NotNull | ||
private int capacity; | ||
|
||
@NotNull | ||
private String ruleExp; | ||
|
||
@NotNull | ||
private String qualificationExp; | ||
|
||
@NotNull | ||
private boolean isRegular; | ||
|
||
@NotNull | ||
private LocalDate stDate; | ||
|
||
@NotNull | ||
private LocalDate endDate; | ||
|
||
@NotNull | ||
private LocalDate actualEndDate; | ||
|
||
@NotNull | ||
@Enumerated(EnumType.STRING) | ||
private StudyStatus status; | ||
|
||
@NotNull | ||
private int viewCnt; | ||
|
||
@Enumerated(EnumType.STRING) | ||
private StudyEndReason endReason; | ||
|
||
@NotNull | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "address_id", nullable = false) | ||
private Address address; | ||
|
||
@NotNull | ||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "category_id", nullable = false) | ||
private Category category; | ||
|
||
@OneToMany(mappedBy = "study", fetch = FetchType.LAZY) | ||
private List<Enrollment> enrollments; | ||
|
||
} |
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,6 @@ | ||
package com.join.core.user.constant; | ||
|
||
public enum UserStatus { | ||
ACTIVE, INACTIVE, DELETED | ||
|
||
} |
Oops, something went wrong.