From b6197e186d95c72be39f0228a5190cdd746b6c05 Mon Sep 17 00:00:00 2001 From: Cho Sangwook <82208159+Sangwook02@users.noreply.github.com> Date: Sun, 11 Feb 2024 19:52:48 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20requirement=20=EB=8F=84=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=20=EA=B5=AC=ED=98=84=20(#43)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: requirement 도메인 구현 * refactor: requirement를 embeddable로 변경 --- .../gdsc/domain/member/domain/Member.java | 11 ++++- .../requirement/domain/Requirement.java | 42 +++++++++++++++++++ .../requirement/domain/RequirementStatus.java | 13 ++++++ 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/gdschongik/gdsc/domain/requirement/domain/Requirement.java create mode 100644 src/main/java/com/gdschongik/gdsc/domain/requirement/domain/RequirementStatus.java diff --git a/src/main/java/com/gdschongik/gdsc/domain/member/domain/Member.java b/src/main/java/com/gdschongik/gdsc/domain/member/domain/Member.java index 5c41d7947..ff7bd86ab 100644 --- a/src/main/java/com/gdschongik/gdsc/domain/member/domain/Member.java +++ b/src/main/java/com/gdschongik/gdsc/domain/member/domain/Member.java @@ -3,8 +3,10 @@ import static com.gdschongik.gdsc.global.exception.ErrorCode.*; import com.gdschongik.gdsc.domain.common.model.BaseTimeEntity; +import com.gdschongik.gdsc.domain.requirement.domain.Requirement; import com.gdschongik.gdsc.global.exception.CustomException; import jakarta.persistence.Column; +import jakarta.persistence.Embedded; import jakarta.persistence.Entity; import jakarta.persistence.EnumType; import jakarta.persistence.Enumerated; @@ -54,6 +56,9 @@ public class Member extends BaseTimeEntity { private String univEmail; + @Embedded + private Requirement requirement; + @Builder(access = AccessLevel.PRIVATE) private Member( MemberRole role, @@ -67,7 +72,8 @@ private Member( String nickname, String oauthId, LocalDateTime lastLoginAt, - String univEmail) { + String univEmail, + Requirement requirement) { this.role = role; this.status = status; this.name = name; @@ -80,13 +86,16 @@ private Member( this.oauthId = oauthId; this.lastLoginAt = lastLoginAt; this.univEmail = univEmail; + this.requirement = requirement; } public static Member createGuestMember(String oauthId) { + Requirement requirement = Requirement.createRequirement(); return Member.builder() .oauthId(oauthId) .role(MemberRole.GUEST) .status(MemberStatus.NORMAL) + .requirement(requirement) .build(); } diff --git a/src/main/java/com/gdschongik/gdsc/domain/requirement/domain/Requirement.java b/src/main/java/com/gdschongik/gdsc/domain/requirement/domain/Requirement.java new file mode 100644 index 000000000..865293a35 --- /dev/null +++ b/src/main/java/com/gdschongik/gdsc/domain/requirement/domain/Requirement.java @@ -0,0 +1,42 @@ +package com.gdschongik.gdsc.domain.requirement.domain; + +import static com.gdschongik.gdsc.domain.requirement.domain.RequirementStatus.*; + +import jakarta.persistence.Embeddable; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import lombok.AccessLevel; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Embeddable +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class Requirement { + + @Enumerated(EnumType.STRING) + private RequirementStatus univStatus; + + @Enumerated(EnumType.STRING) + private RequirementStatus discordStatus; + + @Enumerated(EnumType.STRING) + private RequirementStatus paymentStatus; + + @Builder(access = AccessLevel.PRIVATE) + private Requirement( + RequirementStatus univStatus, RequirementStatus discordStatus, RequirementStatus paymentStatus) { + this.univStatus = univStatus; + this.discordStatus = discordStatus; + this.paymentStatus = paymentStatus; + } + + public static Requirement createRequirement() { + return Requirement.builder() + .univStatus(PENDING) + .discordStatus(PENDING) + .paymentStatus(PENDING) + .build(); + } +} diff --git a/src/main/java/com/gdschongik/gdsc/domain/requirement/domain/RequirementStatus.java b/src/main/java/com/gdschongik/gdsc/domain/requirement/domain/RequirementStatus.java new file mode 100644 index 000000000..902298e4f --- /dev/null +++ b/src/main/java/com/gdschongik/gdsc/domain/requirement/domain/RequirementStatus.java @@ -0,0 +1,13 @@ +package com.gdschongik.gdsc.domain.requirement.domain; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum RequirementStatus { + PENDING("PENDING"), + VERIFIED("VERIFIED"); + + private final String value; +}