-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat/crew member remove] - 크루 멤버 조회 및 추방 #79
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 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
db2dc3a
✨ Feat : Implement DomainIdResolver classes
hughesgoon df1066a
♻️ Refactor : Fix currentUser security annotation
hughesgoon 7c68845
♻️ Refactor : Apply changed currentUser annotation & IdResolvers
hughesgoon 8ab087e
♻️ Refactor : Align UseCase return types with team convention
hughesgoon 0850b6f
✨ Feat : Implement KickMember logics
hughesgoon 504c7e0
✨ Feat : Implement FetchCrewMembers logic
hughesgoon 38b073b
♻️ Refactor : Optimize fetchMember logic
hughesgoon c154226
♻️ Refactor : Split domainPrincipalCache by specific types
hughesgoon 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
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
33 changes: 0 additions & 33 deletions
33
...run_us/server/domains/crew/controller/model/response/CrewJoinRequestInternalResponse.java
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
...in/java/com/run_us/server/domains/crew/controller/model/response/FetchMemberResponse.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,26 @@ | ||
| package com.run_us.server.domains.crew.controller.model.response; | ||
|
|
||
| import com.run_us.server.domains.crew.domain.CrewMembership; | ||
| import com.run_us.server.domains.user.domain.User; | ||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
|
|
||
| @Getter | ||
| @AllArgsConstructor | ||
| public class FetchMemberResponse { | ||
| private String nickname; | ||
| private String publicId; | ||
| private String profileImg; | ||
| private String role; | ||
| private int runningDistance; | ||
|
|
||
| public static FetchMemberResponse from(User user, CrewMembership crewMembership, int runningDistance) { | ||
| return new FetchMemberResponse( | ||
| user.getProfile().getNickname(), | ||
| user.getPublicId(), | ||
| user.getProfile().getImgUrl(), | ||
| crewMembership.getRole().name(), | ||
| runningDistance | ||
| ); | ||
| } | ||
| } |
10 changes: 10 additions & 0 deletions
10
...ain/java/com/run_us/server/domains/crew/controller/model/response/KickMemberResponse.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 com.run_us.server.domains.crew.controller.model.response; | ||
|
|
||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
|
|
||
| @Getter | ||
| @Builder | ||
| public class KickMemberResponse { | ||
| private String userPublicId; | ||
| } |
4 changes: 2 additions & 2 deletions
4
...a/com/run_us/server/domains/crew/controller/model/response/ReviewJoinRequestResponse.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,10 +1,10 @@ | ||
| package com.run_us.server.domains.crew.controller.model.response; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
|
|
||
| @Getter | ||
| @AllArgsConstructor | ||
| @Builder | ||
| public class ReviewJoinRequestResponse { | ||
| private Integer requestId; | ||
| } |
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
9 changes: 9 additions & 0 deletions
9
src/main/java/com/run_us/server/domains/crew/domain/CrewPrincipal.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,9 @@ | ||
| package com.run_us.server.domains.crew.domain; | ||
|
|
||
| import com.run_us.server.global.common.resolver.DomainPrincipal; | ||
|
|
||
| public class CrewPrincipal extends DomainPrincipal { | ||
| public CrewPrincipal(String publicId, Integer internalId) { | ||
| super(publicId, internalId); | ||
| } | ||
| } |
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
44 changes: 44 additions & 0 deletions
44
src/main/java/com/run_us/server/domains/crew/service/resolver/CrewIdResolver.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,44 @@ | ||
| package com.run_us.server.domains.crew.service.resolver; | ||
|
|
||
| import com.run_us.server.domains.crew.controller.model.enums.CrewErrorCode; | ||
| import com.run_us.server.domains.crew.controller.model.enums.CrewException; | ||
| import com.run_us.server.domains.crew.domain.Crew; | ||
| import com.run_us.server.domains.crew.domain.CrewPrincipal; | ||
| import com.run_us.server.domains.crew.repository.CrewRepository; | ||
| import com.run_us.server.global.common.cache.InMemoryCache; | ||
| import com.run_us.server.global.common.resolver.DomainIdResolver; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.stereotype.Service; | ||
|
|
||
| import java.time.Duration; | ||
|
|
||
| @Service | ||
| @RequiredArgsConstructor | ||
| public class CrewIdResolver implements DomainIdResolver<CrewPrincipal> { | ||
| private final CrewRepository crewRepository; | ||
| private final InMemoryCache<String, CrewPrincipal> principalCache; | ||
|
|
||
| private static final Duration CACHE_TTL = Duration.ofMinutes(30); | ||
|
|
||
| @Override | ||
| public CrewPrincipal resolve(String publicId) { | ||
| return principalCache.get(publicId) | ||
| .orElseGet(() -> loadAndCacheCrewPrincipal(publicId)); | ||
| } | ||
|
|
||
| @Override | ||
| public CrewPrincipal resolve(Integer internalId) { | ||
| Crew crew = crewRepository.findById(internalId) | ||
| .orElseThrow(() -> new CrewException(CrewErrorCode.CREW_NOT_FOUND)); | ||
| return new CrewPrincipal(crew.getPublicId(), internalId); | ||
| } | ||
|
|
||
| private CrewPrincipal loadAndCacheCrewPrincipal(String publicId) { | ||
| Crew crew = crewRepository.findByPublicId(publicId) | ||
| .orElseThrow(() -> new CrewException(CrewErrorCode.CREW_NOT_FOUND)); | ||
|
|
||
| CrewPrincipal principal = new CrewPrincipal(publicId, crew.getId()); | ||
| principalCache.put(publicId, principal, CACHE_TTL); | ||
| return principal; | ||
| } | ||
| } | ||
Oops, something went wrong.
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.