-
Notifications
You must be signed in to change notification settings - Fork 1
[Feat] #624 솝탬프 박수 친 유저 목록 조회 구현 #629
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
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.
고생하셨습니당 👍
| default ClapResponse.ClapUserList of(Page<Clap> page, Map<Long, SoptampUserInfo> profileMap, Map<Long, String> imageMap) { | ||
| List<ClapResponse.ClapUserProfile> users = page.getContent().stream() | ||
| .map(clap -> { | ||
| var p = profileMap.get(clap.getUserId()); | ||
|
|
||
| return new ClapResponse.ClapUserProfile( | ||
| p.getNickname(), | ||
| imageMap.getOrDefault(clap.getUserId(), ""), | ||
| p.getProfileMessage(), | ||
| clap.getClapCount() | ||
| ); | ||
| }) | ||
| .toList(); |
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.
변수명이 조금 더 명확하면 좋을 것 같아요 ~ 이렇게 타입 추론을 쓸 때는 더더욱이요
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.
원래 프로필 이미지는 플랫폼에서 profileImage 가져오는 게 맞습니다!
소소한 리뷰 남겼으니 추후 반영 부탁드려요 고생하셨습니다👍
| @Transactional(readOnly = true) | ||
| public void checkOwnedStamp(Long stampId, Long userId) { | ||
| stampRepository.findByIdAndUserId(stampId, userId) | ||
| .orElseThrow(() -> new ForbiddenException(ErrorCode.CLAP_LIST_FORBIDDEN)); | ||
| } |
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.
@Transactional(readOnly = true)
public void checkOwnedStamp(Long stampId, Long userId) {
var stamp = stampRepository.findById(stampId)
.orElseThrow(() -> new NotFoundException(ErrorCode.STAMP_NOT_FOUND));
if (!Objects.equals(stamp.getUserId(), userId)) {
throw new ForbiddenException(ErrorCode.CLAP_LIST_FORBIDDEN);
}
}
이런식으로 권한/존재 분리 체크하면 좋을 것 같아요!
|
|
||
| Optional<Clap> findByUserIdAndStampId(Long userId, Long stampId); | ||
|
|
||
| Page<Clap> findAllByStampIdOrderByClapCountDescUpdatedAtDesc(Long stampId, Pageable pageable); |
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.
CREATE INDEX IF NOT EXISTS idx_clap_stamp_sort
ON clap (stamp_id, clap_count DESC, updated_at DESC);
정렬 자체는 좋지만 인덱스가 없으면 성능 이슈가 생길 수 있을 것 같아요! 리뷰처럼 db 인덱스 추가 하면 좋을 듯합니다~
# Conflicts: # src/main/java/org/sopt/app/facade/SoptampFacade.java
Related issue 🛠
Work Description ✏️
SoptampUserFinder내부에 존재하고 있지않아서,트래킹 해보니
SoptampUser내부에 관련한 정보중에profileImage가 없어 필드를 새로 추가를 해줘야하나 고민이 많았습니다….하지만 데드라인이 얼마 남지않았고, 기존에 저장 되어있는 값들이 많은
SoptampUser엔티티에 변경사항이 생기면 조금 일이 커질거같아 일단은 보류하고, 다른 파사드들을 확인해보니 이미getPlatformUserInfoResponse를 호출해서 유저 정보를 받아오고 있었어서,SoptampFacade에서도 동일하게 적용하여 설계하였습니다checkOwnedStamp라는 본인 미션 뷰에서만 박수친 사람 리스트를 조회할 수 있는 예외처리를 서버단에 추가해주어서,403을 던지도록 설계했는데 다른 예외처리들이 또 있을지 의견 주시면 좋을거같습니다
To Reviewers 📢
Response내부에서 중첩Record로 선언 해주기보다는,static class로 선언한 다음Lombok어노테이션을 활용하고 있던 내용들이 컨벤션처럼 정해져있는거로 이해했습니다Record를 활용해주기 보다는, 기존에static class로 선언해줬던 이유가 궁금했습니다(아래 사진은 예시입니다)
