-
Notifications
You must be signed in to change notification settings - Fork 5
[OPS-401] 유령 스페이스 처리 로직 #172
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
The head ref may contain hidden characters: "OPS-401-BE-\uC720\uB839-\uC2A4\uD398\uC774\uC2A4-\uCC98\uB9AC-\uB85C\uC9C1"
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -93,6 +93,33 @@ public List<Membership> findByMember(Member member, String state) { | |||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| /** | ||||||||||||||||||||
| * 멤버가 ADMIN 권한을 가진 스페이스 목록 조회 | ||||||||||||||||||||
| * @param member 조회할 멤버 | ||||||||||||||||||||
| * @return 멤버가 유일한 ADMIN 권한을 가진 스페이스 목록 | ||||||||||||||||||||
| */ | ||||||||||||||||||||
| public List<Space> findByAdmin(Member member) { | ||||||||||||||||||||
| return membershipRepository.findAllByMemberAndAuthorityOrderById(member, Authority.ADMIN) | ||||||||||||||||||||
| .stream() | ||||||||||||||||||||
| .map(Membership::getSpace) | ||||||||||||||||||||
| .collect(Collectors.toList()); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| /** | ||||||||||||||||||||
| * 멤버가 유일한 ADMIN 권한을 가진 스페이스 목록 조회 | ||||||||||||||||||||
| * @param member 조회할 멤버 | ||||||||||||||||||||
| * @return 멤버가 유일한 ADMIN 권한을 가진 스페이스 목록 | ||||||||||||||||||||
| */ | ||||||||||||||||||||
| public List<Space> findByOnlyAdmin(Member member) { | ||||||||||||||||||||
| // 1. 멤버가 ADMIN 권한을 가진 모든 스페이스 조회 | ||||||||||||||||||||
| List<Space> adminSpaces = findByAdmin(member); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // 2. 각 스페이스에서 ADMIN 멤버 수가 1명인 스페이스만 필터링 | ||||||||||||||||||||
| return adminSpaces.stream() | ||||||||||||||||||||
| .filter(space -> membershipRepository.countBySpaceAndAuthority(space, Authority.ADMIN) == 1) | ||||||||||||||||||||
| .collect(Collectors.toList()); | ||||||||||||||||||||
|
Comment on lines
+114
to
+120
|
||||||||||||||||||||
| // 1. 멤버가 ADMIN 권한을 가진 모든 스페이스 조회 | |
| List<Space> adminSpaces = findByAdmin(member); | |
| // 2. 각 스페이스에서 ADMIN 멤버 수가 1명인 스페이스만 필터링 | |
| return adminSpaces.stream() | |
| .filter(space -> membershipRepository.countBySpaceAndAuthority(space, Authority.ADMIN) == 1) | |
| .collect(Collectors.toList()); | |
| // Use a single query to find spaces where the member is the only ADMIN | |
| return membershipRepository.findSpacesWhereMemberIsOnlyAdmin(member, Authority.ADMIN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Javadoc comment incorrectly describes this method as returning spaces where the member is the 'sole admin', but the implementation returns all spaces where the member has admin authority, regardless of other admins.