-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat : 다른 유저 정보 조회 API 추가 #158
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
abca5bf
feature : 다른 유저 정보 조회 추가 // 한 api로 구현
sh0723 93fdd69
feature : 다른 유저 정보 조회 추가 // api 두개로 쪼갬
sh0723 1ff0da6
feature : 다른 유저 정보 조회 추가 // api 두개로 쪼갬
sh0723 c3ca36f
테스트 코드 추가
sh0723 5cef761
피드백 반영
sh0723 66bec80
build.grade 의존성 중복 주입 삭제
sh0723 50eb5a7
피드백 최종 반영
sh0723 6dfceb3
conflict 해결
sh0723 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 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
4 changes: 2 additions & 2 deletions
4
src/main/java/com/gamzabat/algohub/feature/group/studygroup/dto/CreateGroupRequest.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
4 changes: 2 additions & 2 deletions
4
src/main/java/com/gamzabat/algohub/feature/group/studygroup/dto/EditGroupRequest.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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -432,4 +432,47 @@ public void editStudyGroupVisibility(User user, EditGroupVisibilityRequest reque | |
member.updateVisibility(request.isVisible()); | ||
log.info("success to update group visibility ( userId : {} )", user.getId()); | ||
} | ||
|
||
@Transactional(readOnly = true) | ||
public GetStudyGroupListsResponse getOtherStudyGroupList(Long targetUserId) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이거 뭔가 내 그룹 목록 조회 메소드랑 중복이 많아서 조회 메소드를 하나로 빼서 재사용하는 리팩토링 할 수 있을 것 같은데.. |
||
User targetUser = userRepository.findById(targetUserId) | ||
.orElseThrow(() -> new CannotFoundUserException(HttpStatus.NOT_FOUND.value(), "존재하지 않는 유저입니다.")); | ||
List<StudyGroup> groups = groupRepository.findAllByUser(targetUser); | ||
|
||
List<GetStudyGroupResponse> bookmarked = bookmarkedStudyGroupRepository.findAllByUser(targetUser).stream() | ||
.filter(group -> isVisible(group.getStudyGroup(), targetUser)) | ||
.map(bookmark -> getStudyGroupResponseDTO(targetUser, bookmark.getStudyGroup())) | ||
.toList(); | ||
|
||
LocalDate today = LocalDate.now(); | ||
|
||
List<GetStudyGroupResponse> done = groups.stream() | ||
.filter(group -> group.getEndDate() != null && group.getEndDate().isBefore(today) && isVisible(group, | ||
targetUser)) | ||
.map(group -> getStudyGroupResponseDTO(targetUser, group)) | ||
.toList(); | ||
|
||
List<GetStudyGroupResponse> inProgress = groups.stream() | ||
.filter( | ||
group -> !(group.getStartDate() == null || group.getStartDate().isAfter(today)) | ||
&& !(group.getEndDate() == null || group.getEndDate().isBefore(today)) && isVisible(group, | ||
targetUser)) | ||
.map(group -> getStudyGroupResponseDTO(targetUser, group)) | ||
.toList(); | ||
|
||
List<GetStudyGroupResponse> queued = groups.stream() | ||
.filter(group -> group.getStartDate() != null && group.getStartDate().isAfter(today) && isVisible(group, | ||
targetUser)) | ||
.map(group -> getStudyGroupResponseDTO(targetUser, group)) | ||
.toList(); | ||
|
||
GetStudyGroupListsResponse response = new GetStudyGroupListsResponse(bookmarked, done, inProgress, queued); | ||
|
||
log.info("success to get study group list"); | ||
return response; | ||
} | ||
|
||
private boolean isVisible(StudyGroup group, User user) { | ||
return groupMemberRepository.existsByUserAndStudyGroupAndIsVisible(user, group, true); | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -127,4 +127,11 @@ public ResponseEntity<Void> checkNickname(@RequestParam String nickname) { | |
userService.checkNickname(nickname); | ||
return ResponseEntity.ok().build(); | ||
} | ||
|
||
@GetMapping(value = "otheruser-info") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 얘도 PathVariable 사용하면 더 좋을 것 같아요-! |
||
@Operation(summary = "타회원정보조회 API") | ||
public ResponseEntity<UserInfoResponse> getOtherUserInfo(@AuthedUser User user, @RequestParam Long targetUserId) { | ||
UserInfoResponse userInfo = userService.otherUserInfo(user, targetUserId); | ||
return ResponseEntity.ok().body(userInfo); | ||
} | ||
} |
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
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.
소사하지만 userId가 좋아보입니다!