-
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.
Refactor: Enum 그룹화를 통해 Member 역할 구체화 (#160)
* refactor: Enum 그룹화를 통한 MemberRole 분리 - Active Members: Member, Admin, Education Team - Clients: Member, Admin - Managers: Education, Admin * style: 코드 공백 조정 * refactor: enum을 부연 설명하는 description 필드 추가
- Loading branch information
Showing
7 changed files
with
61 additions
and
40 deletions.
There are no files selected for viewing
11 changes: 8 additions & 3 deletions
11
src/main/java/cotato/csquiz/domain/enums/ChoiceCorrect.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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
package cotato.csquiz.domain.enums; | ||
|
||
import lombok.AllArgsConstructor; | ||
|
||
@AllArgsConstructor | ||
public enum ChoiceCorrect { | ||
ANSWER, | ||
NO_ANSWER, | ||
SECRET | ||
ANSWER("퀴즈 정답"), | ||
NO_ANSWER("퀴즈 오답"), | ||
SECRET("정답 여부를 알려주지 않음"); | ||
|
||
private final String description; | ||
} |
11 changes: 8 additions & 3 deletions
11
src/main/java/cotato/csquiz/domain/enums/EducationStatus.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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
package cotato.csquiz.domain.enums; | ||
|
||
import lombok.AllArgsConstructor; | ||
|
||
@AllArgsConstructor | ||
public enum EducationStatus { | ||
BEFORE, | ||
ONGOING, | ||
FINISHED | ||
BEFORE("교육 시작 전"), | ||
ONGOING("교육 진행"), | ||
FINISHED("교육 종료"); | ||
|
||
private final String description; | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/cotato/csquiz/domain/enums/MemberRoleGroup.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,21 @@ | ||
package cotato.csquiz.domain.enums; | ||
|
||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public enum MemberRoleGroup { | ||
|
||
ACTIVE_MEMBERS("현재 활동 중인 멤버", List.of(MemberRole.MEMBER, MemberRole.ADMIN, MemberRole.EDUCATION)), | ||
CLIENTS("교육 중 문제 풀이가 가능한 멤버", List.of(MemberRole.MEMBER, MemberRole.ADMIN)), | ||
MANAGERS("교육 진행 관리자", List.of(MemberRole.EDUCATION, MemberRole.ADMIN)); | ||
|
||
private final String description; | ||
private final List<MemberRole> roles; | ||
|
||
public static boolean hasRole(MemberRoleGroup group, MemberRole role) { | ||
return group.getRoles().contains(role); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
package cotato.csquiz.domain.enums; | ||
|
||
import lombok.AllArgsConstructor; | ||
|
||
@AllArgsConstructor | ||
public enum QuizType { | ||
MULTIPLE_QUIZ, | ||
SHORT_QUIZ | ||
MULTIPLE_QUIZ("객관식 문제"), | ||
SHORT_QUIZ("주관식 문제"); | ||
|
||
private final String description; | ||
} |
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
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