-
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
[Feat] 차단한 유저에 대한 요청 필터링 #287
Conversation
테스트통과 🤖 |
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.
일단 현 상황 코드대로 리뷰는했는데요!
ThreadLocal의 필요성을 잘 모르겠어요ㅎㅎ
캐싱? ThreadLocal을 쓰더라도 어차피 요청 1개당 차단 목록 조회하는건 필수적이지 않나 싶어서요~
생각을 들어보고 시퍼요~
public BlockFilterAspect(ProfileQueryDomainService profileQueryDomainService, InsightQueryDomainService insightQueryDomainService) { | ||
this.profileQueryDomainService = profileQueryDomainService; | ||
this.insightQueryDomainService = insightQueryDomainService; | ||
} | ||
|
||
private final ProfileQueryDomainService profileQueryDomainService; | ||
private final InsightQueryDomainService insightQueryDomainService; | ||
private final ThreadLocal<Set<Long>> blockedUserIdsStore = new ThreadLocal<>(); |
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.
public BlockFilterAspect(ProfileQueryDomainService profileQueryDomainService, InsightQueryDomainService insightQueryDomainService) { | |
this.profileQueryDomainService = profileQueryDomainService; | |
this.insightQueryDomainService = insightQueryDomainService; | |
} | |
private final ProfileQueryDomainService profileQueryDomainService; | |
private final InsightQueryDomainService insightQueryDomainService; | |
private final ThreadLocal<Set<Long>> blockedUserIdsStore = new ThreadLocal<>(); | |
private final ProfileQueryDomainService profileQueryDomainService; | |
private final InsightQueryDomainService insightQueryDomainService; | |
private final ThreadLocal<Set<Long>> blockedUserIdsStore = new ThreadLocal<>(); | |
public BlockFilterAspect(ProfileQueryDomainService profileQueryDomainService, InsightQueryDomainService insightQueryDomainService) { | |
this.profileQueryDomainService = profileQueryDomainService; | |
this.insightQueryDomainService = insightQueryDomainService; | |
} | |
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.
blockedUserIdRegistry는 어때요?
if (blockedUserIds.contains(response)) { | ||
throw new KeeweException(KeeweRtnConsts.ERR453); | ||
} |
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.
if (blockedUserIds.contains(response)) { | |
throw new KeeweException(KeeweRtnConsts.ERR453); | |
} | |
if (blockedUserIds.contains(response)) { | |
blockedUserIdsStore.remove(); | |
throw new KeeweException(KeeweRtnConsts.ERR453); | |
} |
Set<Long> blockedUserIds = getBlockedUserIds(); | ||
responses.removeIf(response -> blockedUserIds.contains(response.getUserId())); |
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.
Set<Long> blockedUserIds = getBlockedUserIds(); | |
responses.removeIf(response -> blockedUserIds.contains(response.getUserId())); | |
Set<Long> blockedUserIds = getBlockedUserIds(); | |
responses.removeIf(response -> blockedUserIds.contains(response.getUserId())); | |
blockedUserIdsStore.remove(); |
private void validateInsightId(Long request) { | ||
Long writerId = insightQueryDomainService.getByIdWithWriter(request).getWriter().getId(); | ||
validateUserId(writerId); | ||
} |
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.
저는 이거 실제로 insightId를 validation한다고 생각하진 않는데 어떠세요?
또 파라미터 이름 request를 좀 더 구체적으로 바꾸면 좋을거같네요
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.
네. extract method 써서 만들었는데 코드 자체가 좀 이상하네요;;
고생하셨어요 👍 케이스가 되게 많네요 |
다시 보니 여러 번 조회할 일이 없겠네요 ㅎㅎ |
테스트통과 🤖 |
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.
LGTM 👍🏽
관련 Issue
작업 내용
InsightId 작성자 관련
GET /api/v1/insight{insightId}
GET /api/v1/insight/author/{insightId}
GET /api/v1/comments/insights/{insightId}/count
GET /api/v1/comments/insights/{insightId}/preview
POST /api/v1/reaction
GET /api/v1/insight/{insightId}/challenge-record
GET /api/v1/insight/my-page/{userId}
요청 대상 userId 관련
GET /api/v1/drawer/{userId}
POST /api/v1/user/profile/follow/{userId}
GET /api/v1/user/priflie/achieved-title/{userId}
GET /api/v1/user/priflie/all-achieved-title/{userId}
GET /api/v1/user/profile/followee/{userId}
GET /api/v1/user/profile/follower/{userId}