-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Refactor/161] 알림 목록 조회, 친구 목록 조회 API 수정 #164
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c6e8dbb
:recycle: [Refactor] 알림 팝업 목록 조회 API에 type 구분 제거
Eunjin3395 d97af27
:recycle: [Refactor] 알림 전체 목록 조회 API 페이징 개수 수정
Eunjin3395 26c1661
:recycle: [Refactor] 친구 목록 조회 API 이름 오름차순 정렬 추가
Eunjin3395 7a780ef
:recycle: [Refactor] 차단한 회원 목록 조회 페이징 단위 수정
Eunjin3395 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
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 | ||||
---|---|---|---|---|---|---|
|
@@ -29,7 +29,7 @@ public class BlockService { | |||||
private final ChatCommandService chatCommandService; | ||||||
private final FriendService friendService; | ||||||
|
||||||
Integer pageSize = 9; | ||||||
private final static Integer PAGE_SIZE = 10; | ||||||
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. NotificationService.java 처럼
Suggested change
로 통일하셔도 좋을 것 같습니다! |
||||||
|
||||||
/** | ||||||
* memberId에 해당하는 회원이 targetMemberId에 해당하는 회원을 차단 | ||||||
|
@@ -53,15 +53,15 @@ public Member blockMember(Long memberId, Long targetMemberId) { | |||||
|
||||||
// 이미 차단한 회원인지 검증 | ||||||
boolean isblocked = blockRepository.existsByBlockerMemberAndBlockedMember(member, | ||||||
targetMember); | ||||||
targetMember); | ||||||
if (isblocked) { | ||||||
throw new BlockHandler(ErrorStatus.ALREADY_BLOCKED); | ||||||
} | ||||||
|
||||||
// block 엔티티 생성 및 연관관계 매핑 | ||||||
Block block = Block.builder() | ||||||
.blockedMember(targetMember) | ||||||
.build(); | ||||||
.blockedMember(targetMember) | ||||||
.build(); | ||||||
block.setBlockerMember(member); | ||||||
|
||||||
blockRepository.save(block); | ||||||
|
@@ -98,10 +98,10 @@ public Page<Member> getBlockList(Long memberId, Integer pageIdx) { | |||||
// member 엔티티 조회 | ||||||
Member member = profileService.findMember(memberId); | ||||||
|
||||||
PageRequest pageRequest = PageRequest.of(pageIdx, pageSize); | ||||||
PageRequest pageRequest = PageRequest.of(pageIdx, PAGE_SIZE); | ||||||
|
||||||
return memberRepository.findBlockedMembersByBlockerIdAndNotBlind(member.getId(), | ||||||
pageRequest); | ||||||
pageRequest); | ||||||
} | ||||||
|
||||||
/** | ||||||
|
@@ -117,7 +117,7 @@ public void unBlockMember(Long memberId, Long targetMemberId) { | |||||
|
||||||
// targetMember가 차단 실제로 차단 목록에 존재하는지 검증 | ||||||
Block block = blockRepository.findByBlockerMemberAndBlockedMember(member, targetMember) | ||||||
.orElseThrow(() -> new BlockHandler(ErrorStatus.TARGET_MEMBER_NOT_BLOCKED)); | ||||||
.orElseThrow(() -> new BlockHandler(ErrorStatus.TARGET_MEMBER_NOT_BLOCKED)); | ||||||
|
||||||
block.removeBlockerMember(member); // 양방향 연관관계 제거 | ||||||
blockRepository.delete(block); | ||||||
|
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.gamegoo.util; | ||
|
||
import java.util.Comparator; | ||
|
||
public class SortUtil { | ||
|
||
public static Comparator<String> memberNameComparator = (s1, s2) -> { | ||
int length1 = s1.length(); | ||
int length2 = s2.length(); | ||
int minLength = Math.min(length1, length2); | ||
|
||
// 각 문자 비교 | ||
for (int i = 0; i < minLength; i++) { | ||
int result = compareChars(s1.charAt(i), s2.charAt(i)); | ||
if (result != 0) { | ||
return result; | ||
} | ||
} | ||
|
||
// 앞부분이 동일하면, 길이가 짧은 것이 앞으로 오도록 정렬 | ||
return Integer.compare(length1, length2); | ||
}; | ||
|
||
// 문자 비교 메서드: 한글 -> 영문자 -> 숫자 순으로 우선순위 지정 | ||
private static int compareChars(char c1, char c2) { | ||
if (Character.isDigit(c1) && Character.isDigit(c2)) { | ||
return Character.compare(c1, c2); | ||
} else if (Character.isDigit(c1)) { | ||
return 1; // 숫자는 항상 뒤로 | ||
} else if (Character.isDigit(c2)) { | ||
return -1; // 숫자는 항상 뒤로 | ||
} else if (Character.isAlphabetic(c1) && Character.isAlphabetic(c2)) { | ||
return Character.compare(c1, c2); | ||
} else if (Character.isAlphabetic(c1)) { | ||
return 1; // 영문자는 한글보다 뒤 | ||
} else if (Character.isAlphabetic(c2)) { | ||
return -1; // 영문자는 한글보다 뒤 | ||
} else { | ||
return Character.compare(c1, c2); // 기본적으로 유니코드 값 비교 | ||
} | ||
} | ||
} |
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.
주석에도 type 제거해야 될 것 같아요.
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.
헉 그렇네요 다음 브랜치에서 지우겠습니다!