SSE 아바타 목록 조회 시 전체 엔티티 대신 프로젝션 사용 - #52
Merged
Merged
Conversation
cfcromn
approved these changes
Aug 3, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
✨ 작업 내용
SSE 아바타 목록 변경 이벤트(
avatar-list-changed)를 브로드캐스트할 때마다AvatarRepository.findAllByOrderByIdAsc()가 15개 컬럼을 가진AvatarEntity전체(TEXT 컬럼인promptText포함)를 로딩하고 있었는데, 실제로는 SSE 응답 DTO(AvatarChangeResDto)가 쓰는 8개 필드만 필요했습니다. Spring Data JPA의 interface 기반 projection(AvatarSummaryProjection)을 도입해 필요한 컬럼만 SELECT하도록 변경했습니다.🔍 리뷰 시 참고사항
AvatarChangeResDto(SSE로 클라이언트에 내려가는 응답 스펙)는 변경하지 않았습니다. 내부적으로 로딩하는 데이터만 프로젝션으로 축소한 것이라 API 응답 포맷은 기존과 동일하며 프론트엔드 쪽 변경 사항은 없습니다.DeleteAllAvatarsServiceImpl도 같은 리포지토리 메서드를 사용하고 있어(이미지 URL 수집 목적) 함께 영향을 받는데, 필요한imageUrl필드는 프로젝션에 포함돼 있어 정상 동작합니다.SubscribeAvatarChangesServiceImplTest는 반환 타입이AvatarEntity에서AvatarSummaryProjection으로 바뀐 것에 맞춰 mock 데이터를 인터페이스 구현체로 수정했습니다.✅ 체크리스트
.env.example등) 변경이 필요한 경우 작성 또는 수정했나요?