-
Notifications
You must be signed in to change notification settings - Fork 0
Feat: 크루원 관리, 검색 기능 #30
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 all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
28928ac
[#28] delete: 사용하지 않는 DTO 삭제
choiseoji 9e71e97
[#28] feat: 크루원 조회, 크루원 역할 변경 API 추가
choiseoji f5e93a1
[#28] feat: CrewMemberResponse로 매핑하는 CrewMapper 코드 추가
choiseoji 9bfdcb3
[#28] feat: crew 검색 API 추가
choiseoji 917f4b0
[#28] feat: query dto에서 response dto로 변환하는 mapper 추가
choiseoji ac397d3
[#28] feat: 검색 repository 코드 추가
choiseoji ba879fa
[#28] feat: 검색 response dto 추가
choiseoji adffd96
[#28] feat: 검색 서비스 코드 추가
choiseoji eec7305
[#28] feat: JoinCrew에서 크루에 속한 모든 멤버 조회하는 repository 코드 추가
choiseoji 67bb8f6
[#28] feat: 필요한 dto들 추가
choiseoji 0e2f315
[#28] feat: 크루 멤버 조회, 역할 변경 서비스 코드 추가
choiseoji 1ab6c76
[#28] test: MemberCrew 테스트 코드 추가
choiseoji 84c5463
[#28] feat: Crew, JoinCrew에 soft delete 설정 추가
choiseoji f80c35e
[#28] fix: crew deleted_at 확인하고 조회하도록 수정
choiseoji 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
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
10 changes: 10 additions & 0 deletions
10
src/main/java/run/backend/domain/crew/dto/query/CrewMemberProfileDto.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,10 @@ | ||
| package run.backend.domain.crew.dto.query; | ||
|
|
||
| import run.backend.domain.member.enums.Role; | ||
|
|
||
| public record CrewMemberProfileDto( | ||
| String image, | ||
| String nickname, | ||
| Role role | ||
| ) { | ||
| } |
8 changes: 8 additions & 0 deletions
8
src/main/java/run/backend/domain/crew/dto/query/CrewProfileDto.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,8 @@ | ||
| package run.backend.domain.crew.dto.query; | ||
|
|
||
| public record CrewProfileDto( | ||
| String image, | ||
| String name, | ||
| String description | ||
| ) { | ||
| } |
8 changes: 8 additions & 0 deletions
8
src/main/java/run/backend/domain/crew/dto/request/MemberRoleChangeRequest.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,8 @@ | ||
| package run.backend.domain.crew.dto.request; | ||
|
|
||
| import run.backend.domain.member.enums.Role; | ||
|
|
||
| public record MemberRoleChangeRequest( | ||
| Role role | ||
| ) { | ||
| } |
4 changes: 0 additions & 4 deletions
4
src/main/java/run/backend/domain/crew/dto/response/CrewMemberProfile.java
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
src/main/java/run/backend/domain/crew/dto/response/CrewMemberProfileResponse.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,10 @@ | ||
| package run.backend.domain.crew.dto.response; | ||
|
|
||
| import run.backend.domain.member.enums.Role; | ||
|
|
||
| public record CrewMemberProfileResponse( | ||
| String image, | ||
| String nickname, | ||
| Role role | ||
| ) { | ||
| } |
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
5 changes: 3 additions & 2 deletions
5
src/main/java/run/backend/domain/crew/dto/response/CrewSearchResponse.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,8 +1,9 @@ | ||
| package run.backend.domain.crew.dto.response; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record CrewSearchResponse( | ||
| List<CrewProfileResponse> crewProfiles | ||
| String image, | ||
| String name, | ||
| String description | ||
| ) { | ||
| } |
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
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
59 changes: 59 additions & 0 deletions
59
src/main/java/run/backend/domain/crew/service/CrewMemberService.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,59 @@ | ||
| package run.backend.domain.crew.service; | ||
|
|
||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
| import run.backend.domain.crew.dto.query.CrewMemberProfileDto; | ||
| import run.backend.domain.crew.dto.request.MemberRoleChangeRequest; | ||
| import run.backend.domain.crew.dto.response.CrewMemberProfileResponse; | ||
| import run.backend.domain.crew.dto.response.CrewMemberResponse; | ||
| import run.backend.domain.crew.entity.Crew; | ||
| import run.backend.domain.crew.enums.JoinStatus; | ||
| import run.backend.domain.crew.mapper.CrewMapper; | ||
| import run.backend.domain.crew.repository.JoinCrewRepository; | ||
| import run.backend.domain.member.entity.Member; | ||
| import run.backend.domain.member.enums.Role; | ||
| import run.backend.domain.member.exception.MemberException; | ||
| import run.backend.domain.member.repository.MemberRepository; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| @Service | ||
| @RequiredArgsConstructor | ||
| @Transactional(readOnly = true) | ||
| public class CrewMemberService { | ||
|
|
||
| private final CrewMapper crewMapper; | ||
| private final MemberRepository memberRepository; | ||
| private final JoinCrewRepository joinCrewRepository; | ||
|
|
||
| public CrewMemberResponse getCrewMembers(Crew crew) { | ||
|
|
||
| List<CrewMemberProfileDto> dtos = joinCrewRepository.findAllCrewMemberByCrewId(crew.getId(), JoinStatus.APPROVED); | ||
|
|
||
| List<CrewMemberProfileResponse> all = crewMapper.toCrewMemberProfileResponseList(dtos); | ||
|
|
||
| List<CrewMemberProfileResponse> managers = new ArrayList<>(); | ||
| List<CrewMemberProfileResponse> members = new ArrayList<>(); | ||
|
|
||
| for (CrewMemberProfileResponse profile : all) { | ||
|
|
||
| if (profile.role() == Role.MEMBER) | ||
| members.add(profile); | ||
| else | ||
| managers.add(profile); | ||
| } | ||
| return new CrewMemberResponse(managers, members); | ||
| } | ||
|
|
||
| @Transactional | ||
| public void updateCrewMemberRole(Long memberId, MemberRoleChangeRequest request) { | ||
|
|
||
| Member member = memberRepository.findById(memberId) | ||
| .orElseThrow(MemberException.MemberNotFound::new); | ||
|
|
||
| member.updateRole(request.role()); | ||
| memberRepository.save(member); | ||
| } | ||
| } |
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
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.
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.
잘한다..
Uh oh!
There was an error while loading. Please reload this page.
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.
엇..동현님 따라했어요 ㅎㅎ.ㅎ