-
Notifications
You must be signed in to change notification settings - Fork 1
[FEAT] 회원 부서 관리 기능을 추가합니다. #279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 36 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
88d9aa0
feat: Authority 변경 API 추가
rlajm1203 a61cef2
feat: findRole 메소드 추가
rlajm1203 a9fe88a
feat: findByIdAndRole 메소드 추가
rlajm1203 ceb4af5
feat: 사용자의 권한을 변경하는 로직 추가
rlajm1203 d724fec
feat: 사용자의 권한을 찾을 수 없을 경우의 예외 정의
rlajm1203 7b97540
feat: isExist 메소드 추가
rlajm1203 20cbf12
feat: AuthorityUpdateRequest 정의
rlajm1203 85060c2
feat: authority 수정 api 구현
rlajm1203 51b4b2a
refactor: RoleType 추가
rlajm1203 39b067b
refactor: 회원가입 시에 생성하는, 기본 Authority 생성 추가
rlajm1203 7816361
refactor: 잘못된 Type 수정
rlajm1203 9fcb02c
feat: Authority 리스트 조회 API 추가
rlajm1203 a2831ce
feat: 어노테이션 제거, 생성자 추가
rlajm1203 e68879c
delete: Authority 삭제
rlajm1203 498ac05
refactor: Authority 삭제
rlajm1203 4064b26
feat: Department Enum 정의
rlajm1203 3c82782
feat: Department 수정 Request, Response 정의
rlajm1203 2b519ba
feat: DepartmentUsecase, DepartmentService 구현
rlajm1203 846efdc
faet: MemberModel에 Department 추가
rlajm1203 fb52fd6
feat: Department 수정 API 구현 및 시큐리티 설정 추가
rlajm1203 abe3989
feat: koName 추가
rlajm1203 f4087e1
feat: enName 으로 필드명 수정
rlajm1203 d4b516f
refactor: DepartmentResponse에 koName, enName 추가
rlajm1203 753d37e
feat: NotFoundDepartmentException 정의
rlajm1203 0dba966
refactor: NotFoundDepartmentException 을 던지도록 수정
rlajm1203 30a9cc3
refactor: Department 조회 메소드 수정
rlajm1203 52514e4
refactor: save 호출
rlajm1203 75495fd
refactor: 활동 상태 조회 응답에 department 추가
rlajm1203 850b9c4
style: spotlessApply
rlajm1203 6fbc5da
feat: swagger 명세 추가
rlajm1203 be1efc1
refactor: 부서 리스트 조회는, USER 권한으로도 가능하게 수정
rlajm1203 d875f34
delete: 필요 없는 dto 삭제
rlajm1203 2e5c68d
refactor: 회원 부서 수정 API QueryString 으로 수정
rlajm1203 975f973
style: spotlessApply
rlajm1203 606abd3
refactor: 대소문자 구분하지 않도록 수정
rlajm1203 965e95b
style: spotlessApply
rlajm1203 243f476
refactor: securityFilterChain 수정
rlajm1203 1e1b6b7
refactor: 메소드 이름 변경
rlajm1203 36d72dd
refactor: 트랜잭션 추가
rlajm1203 0833a8b
refactor: find 메소드 유효성 검증 로직 추가
rlajm1203 6791573
refactor: getMemberId() 메소드 호출로 변경
rlajm1203 cac1d13
refactor: 테이블 유니크 제약조건 추가
rlajm1203 e6f91ea
refactor: 부서 응답 lowercase 로 수정
rlajm1203 388cec3
style: spotlessApply
rlajm1203 c084229
refactor: equalsIgnoreCase 로 변경
rlajm1203 ad1e714
style: spotlessApply
rlajm1203 d21e24c
[FEAT] 캘린더 기능을 추가합니다. (#281)
rlajm1203 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
...ain/java/com/blackcompany/eeos/auth/application/exception/NotFoundAuthorityException.java
This file contains hidden or 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,18 @@ | ||
| package com.blackcompany.eeos.auth.application.exception; | ||
|
|
||
| import com.blackcompany.eeos.common.exception.BusinessException; | ||
| import org.springframework.http.HttpStatus; | ||
|
|
||
| public class NotFoundAuthorityException extends BusinessException { | ||
|
|
||
| private static final String FAIL_CODE = "4013"; | ||
|
|
||
| public NotFoundAuthorityException() { | ||
| super(FAIL_CODE, HttpStatus.NOT_FOUND); | ||
| } | ||
|
|
||
| @Override | ||
| public String getMessage() { | ||
| return "회원의 권한을 찾을 수 없습니다."; | ||
| } | ||
| } |
This file contains hidden or 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
34 changes: 30 additions & 4 deletions
34
eeos/src/main/java/com/blackcompany/eeos/auth/application/model/Role.java
This file contains hidden or 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,15 +1,41 @@ | ||
| package com.blackcompany.eeos.auth.application.model; | ||
|
|
||
| import java.util.Arrays; | ||
| import java.util.List; | ||
| import lombok.Getter; | ||
|
|
||
| @Getter | ||
| public enum Role { | ||
| ROLE_ADMIN("ADMIN"), | ||
| ROLE_USER("USER"); | ||
| ROLE_ADMIN(1L, "ADMIN"), | ||
| ROLE_USER(2L, "USER"); | ||
|
|
||
| private String role; | ||
| private final Long id; | ||
| private final String role; // 시스템 내에 존재하는 role을 찾을 때, 이 문자열을 기준으로 찾습니다. | ||
|
|
||
| Role(String role) { | ||
| Role(Long id, String role) { | ||
| this.id = id; | ||
| this.role = role; | ||
| } | ||
|
|
||
| public static boolean isExist(String role) { | ||
| return Arrays.stream(Role.values()).anyMatch(obj -> obj.getRole().equals(role.toUpperCase())); | ||
| } | ||
|
|
||
| public static Role findRole(String role) { | ||
| return Arrays.stream(Role.values()) | ||
| .filter(obj -> obj.getRole().equals(role.toUpperCase())) | ||
| .findFirst() | ||
| .orElseThrow(IllegalArgumentException::new); | ||
| } | ||
rlajm1203 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| public static Role findById(Long id) { | ||
| return Arrays.stream(Role.values()) | ||
| .filter(obj -> obj.getId().equals(id)) | ||
| .findFirst() | ||
| .orElseThrow(IllegalArgumentException::new); | ||
| } | ||
rlajm1203 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| public static List<Role> getAllRoles() { | ||
| return Arrays.asList(Role.values()); | ||
| } | ||
| } | ||
3 changes: 3 additions & 0 deletions
3
.../src/main/java/com/blackcompany/eeos/auth/application/repository/AuthorityRepository.java
This file contains hidden or 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,11 +1,14 @@ | ||
| package com.blackcompany.eeos.auth.application.repository; | ||
|
|
||
| import com.blackcompany.eeos.auth.application.model.AuthorityModel; | ||
| import com.blackcompany.eeos.auth.application.model.Role; | ||
| import java.util.Set; | ||
|
|
||
| public interface AuthorityRepository { | ||
|
|
||
| Set<AuthorityModel> findByMemberId(Long memberId); | ||
|
|
||
| AuthorityModel findByIdAndRole(Long memberId, Role role); | ||
|
|
||
| Long save(AuthorityModel authorityModel); | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
13 changes: 13 additions & 0 deletions
13
eeos/src/main/java/com/blackcompany/eeos/member/application/dto/DepartmentResponse.java
This file contains hidden or 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,13 @@ | ||
| package com.blackcompany.eeos.member.application.dto; | ||
|
|
||
| import com.blackcompany.eeos.common.support.dto.AbstractResponseDto; | ||
| import com.blackcompany.eeos.member.application.model.Department; | ||
|
|
||
| public record DepartmentResponse(Long departmentId, String enName, String koName) | ||
| implements AbstractResponseDto { | ||
|
|
||
| public static DepartmentResponse from(Department department) { | ||
| return new DepartmentResponse( | ||
| department.getId(), department.getEnName(), department.getKoName()); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
18 changes: 18 additions & 0 deletions
18
.../java/com/blackcompany/eeos/member/application/exception/NotFoundDepartmentException.java
This file contains hidden or 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,18 @@ | ||
| package com.blackcompany.eeos.member.application.exception; | ||
|
|
||
| import com.blackcompany.eeos.common.exception.BusinessException; | ||
| import org.springframework.http.HttpStatus; | ||
|
|
||
| public class NotFoundDepartmentException extends BusinessException { | ||
|
|
||
| private static final String FAIL_CODE = "3003"; | ||
|
|
||
| public NotFoundDepartmentException() { | ||
| super(FAIL_CODE, HttpStatus.NOT_FOUND); | ||
| } | ||
|
|
||
| @Override | ||
| public String getMessage() { | ||
| return "해당 부서를 찾을 수 없습니다."; | ||
| } | ||
| } |
52 changes: 52 additions & 0 deletions
52
eeos/src/main/java/com/blackcompany/eeos/member/application/model/Department.java
This file contains hidden or 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,52 @@ | ||
| package com.blackcompany.eeos.member.application.model; | ||
|
|
||
| import com.blackcompany.eeos.member.application.exception.NotFoundDepartmentException; | ||
| import java.util.Arrays; | ||
| import java.util.List; | ||
| import lombok.Getter; | ||
|
|
||
| @Getter | ||
| public enum Department { | ||
| PRESIDENT(101L, "PRESIDENT", "회장단"), | ||
| MARKETING(102L, "MARKETING", "홍보부"), | ||
| MANAGEMENT(103L, "MANAGEMENT", "관리부"), | ||
| EVENT(104L, "EVENT", "행사부"), | ||
| NONE(105L, "NONE", "해당없음"); | ||
|
|
||
| private final Long id; | ||
| private final String enName; | ||
| private final String koName; | ||
|
|
||
| Department(Long id, String enName, String koName) { | ||
| this.id = id; | ||
| this.enName = enName; | ||
| this.koName = koName; | ||
| } | ||
|
|
||
| public static boolean isExistById(Long id) { | ||
| return Arrays.stream(Department.values()).anyMatch(obj -> obj.getId().equals(id)); | ||
| } | ||
|
|
||
| public static boolean isExistByEnName(String enName) { | ||
| return Arrays.stream(Department.values()) | ||
| .anyMatch(obj -> obj.getEnName().equals(enName.toUpperCase())); | ||
| } | ||
|
|
||
| public static Department findDepartmentByEnName(String enName) { | ||
| return Arrays.stream(Department.values()) | ||
| .filter(obj -> obj.getEnName().equals(enName.toUpperCase())) | ||
| .findFirst() | ||
| .orElseThrow(NotFoundDepartmentException::new); | ||
| } | ||
rlajm1203 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| public static Department findById(Long id) { | ||
| return Arrays.stream(Department.values()) | ||
| .filter(obj -> obj.getId().equals(id)) | ||
| .findFirst() | ||
| .orElseThrow(NotFoundDepartmentException::new); | ||
| } | ||
|
|
||
| public static List<Department> getAllDepartments() { | ||
| return Arrays.asList(Department.values()); | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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
36 changes: 36 additions & 0 deletions
36
eeos/src/main/java/com/blackcompany/eeos/member/application/service/DepartmentService.java
This file contains hidden or 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.blackcompany.eeos.member.application.service; | ||
|
|
||
| import com.blackcompany.eeos.member.application.model.Department; | ||
| import com.blackcompany.eeos.member.application.model.MemberModel; | ||
| import com.blackcompany.eeos.member.application.repository.MemberRepository; | ||
| import com.blackcompany.eeos.member.application.usecase.DepartmentUsecase; | ||
| import java.util.List; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Service; | ||
|
|
||
| @Service | ||
| @RequiredArgsConstructor | ||
| public class DepartmentService implements DepartmentUsecase { | ||
|
|
||
| private final MemberRepository memberRepository; | ||
|
|
||
| @Override | ||
| public void changeDepartment(Long memberId, String to) { | ||
| MemberModel member = memberRepository.findById(memberId); | ||
| Department depart = Department.findDepartmentByEnName(to); | ||
| member.updateDepartment(depart); | ||
| memberRepository.save(member); | ||
| } | ||
rlajm1203 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| public List<Department> getAllDepartments() { | ||
| return Department.getAllDepartments(); | ||
| } | ||
|
|
||
| public Department getDepartment(String name) { | ||
| return Department.findDepartmentByEnName(name); | ||
| } | ||
|
|
||
| public Department getDepartmentById(Long id) { | ||
| return Department.findById(id); | ||
| } | ||
| } | ||
11 changes: 11 additions & 0 deletions
11
eeos/src/main/java/com/blackcompany/eeos/member/application/usecase/DepartmentUsecase.java
This file contains hidden or 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,11 @@ | ||
| package com.blackcompany.eeos.member.application.usecase; | ||
|
|
||
| import com.blackcompany.eeos.member.application.model.Department; | ||
| import java.util.List; | ||
|
|
||
| public interface DepartmentUsecase { | ||
|
|
||
| void changeDepartment(Long memberId, String to); | ||
|
|
||
| List<Department> getAllDepartments(); | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.