Skip to content

Commit

Permalink
feat: requirement 도메인 구현 (#43)
Browse files Browse the repository at this point in the history
* feat: requirement 도메인 구현

* refactor: requirement를 embeddable로 변경
  • Loading branch information
Sangwook02 authored Feb 11, 2024
1 parent 9ee3af9 commit b6197e1
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -54,6 +56,9 @@ public class Member extends BaseTimeEntity {

private String univEmail;

@Embedded
private Requirement requirement;

@Builder(access = AccessLevel.PRIVATE)
private Member(
MemberRole role,
Expand All @@ -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;
Expand All @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit b6197e1

Please sign in to comment.