-
Notifications
You must be signed in to change notification settings - Fork 0
[chore] main 브랜치에 바로 적용한 hotfix 변경사항 develop 브랜치 에도 적용 #271
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
[chore] 운영서버로 배포 - 25/08/21
- 내가 나간 방은 조회되지 않는 것 확인
Walkthrough사용자 참가 상태 필터(participant.status = ACTIVE)를 추가하여 참가자 기반 룸 조회 쿼리들이 활성 참여자만 반환하도록 변경했고, 관련 테스트를 추가·수정하여 탈퇴(INACTIVE)한 참여자가 /rooms/my 응답에서 제외되는지 검증합니다. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as 사용자
participant API as RoomController (/rooms/my)
participant SVC as RoomService
participant REPO as RoomQueryRepositoryImpl
participant DB as Database
U->>API: GET /rooms/my
API->>SVC: findMyRooms(userId)
SVC->>REPO: findPlayingAndRecruitingRoomsUserParticipated(userId)
REPO->>DB: SELECT ... WHERE participant.userId=? AND participant.status=ACTIVE
DB-->>REPO: rows (활성 참여자만)
REPO-->>SVC: 룸 목록
SVC-->>API: DTO 반환
API-->>U: 200 OK (탈퇴 방 제외)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/java/konkuk/thip/room/adapter/out/persistence/repository/RoomQueryRepositoryImpl.java (1)
201-213: Home용 참여 방 조회(searchHomeJoinedRooms)도 ACTIVE 참여자만 조회하도록 정렬동일한 도메인 규칙이라면 Home 섹션의 참여 방 목록도 INACTIVE 참여자를 제외해야 합니다. 현재 where 절에 참여자 상태 조건이 없습니다. 다음과 같이 보강하는 것을 권장합니다.
BooleanBuilder where = new BooleanBuilder(); where.and(participant.userJpaEntity.userId.eq(userId)); +where.and(participant.status.eq(StatusType.ACTIVE)); where.and(room.startDate.loe(date)); where.and(room.endDate.goe(date));
🧹 Nitpick comments (7)
src/main/java/konkuk/thip/room/adapter/out/persistence/repository/RoomQueryRepositoryImpl.java (4)
431-438: 서브쿼리 userJoinedRoom에 ACTIVE 조건 누락 — 재참여/추천 노출에 영향 가능현재는 유저가 과거에 참여했다가 탈퇴(INACTIVE)한 방도 “참여한 방”으로 간주되어 추천/미참여 필터에 걸릴 수 있습니다. 의도적으로 “한 번이라도 참여했으면 제외”라면 OK이지만, 보통은 ACTIVE 참여만 인정하는 것이 자연스럽습니다. 확인 부탁드립니다. ACTIVE만 인정한다면 아래처럼 수정 제안드립니다.
private BooleanExpression userJoinedRoom(Long userId) { return JPAExpressions .selectOne() .from(participant) - .where(participant.userJpaEntity.userId.eq(userId) - .and(participant.roomJpaEntity.roomId.eq(room.roomId))) + .where(participant.userJpaEntity.userId.eq(userId) + .and(participant.roomJpaEntity.roomId.eq(room.roomId)) + .and(participant.status.eq(StatusType.ACTIVE))) .exists(); }
173-187: 추천(‘다른 모집중인 방’)에도 방 상태 ACTIVE 필터 일관 적용 제안다른 쿼리들처럼
room.status.eq(StatusType.ACTIVE)조건을 넣어 비활성화된 방이 추천에 노출되지 않도록 일관성 유지가 필요해 보입니다..where( room.category.eq(category) .and(room.startDate.after(LocalDate.now())) .and(room.roomId.ne(roomId)) .and(room.isPublic.isTrue()) + .and(room.status.eq(StatusType.ACTIVE)) )
264-351: 중복 조건 캡슐화: ACTIVE 참여자 조건 헬퍼로 중복 제거네 곳에서 동일한
participant.status.eq(StatusType.ACTIVE)를 반복합니다. 헬퍼로 추출 시 가독성과 변경 용이성이 좋아집니다.-BooleanExpression base = participant.userJpaEntity.userId.eq(userId) - .and(participant.status.eq(StatusType.ACTIVE)) +BooleanExpression base = participant.userJpaEntity.userId.eq(userId) + .and(activeParticipant()) .and(room.startDate.after(today)) .and(room.status.eq(StatusType.ACTIVE));-BooleanExpression base = participant.userJpaEntity.userId.eq(userId) - .and(participant.status.eq(StatusType.ACTIVE)) +BooleanExpression base = participant.userJpaEntity.userId.eq(userId) + .and(activeParticipant()) .and(room.startDate.loe(today)) .and(room.endDate.goe(today)) .and(room.status.eq(StatusType.ACTIVE));-BooleanExpression base = participant.userJpaEntity.userId.eq(userId) - .and(participant.status.eq(StatusType.ACTIVE)) +BooleanExpression base = participant.userJpaEntity.userId.eq(userId) + .and(activeParticipant()) .and(playing.or(recruiting)) .and(room.status.eq(StatusType.ACTIVE));-BooleanExpression base = participant.userJpaEntity.userId.eq(userId) - .and(participant.status.eq(StatusType.ACTIVE)) +BooleanExpression base = participant.userJpaEntity.userId.eq(userId) + .and(activeParticipant()) .and(room.endDate.before(today)) .and(room.status.eq(StatusType.ACTIVE));헬퍼 추가(파일 내 임의 위치, 예: 필드들 아래):
private BooleanExpression activeParticipant() { return participant.status.eq(StatusType.ACTIVE); }
271-271: 쿼리 성능 가드: 인덱스 점검(특히 userId+status 결합 인덱스)
FROM participant … WHERE participant.user_id = ? AND participant.status = 'ACTIVE'형태가 핵심 선택 조건입니다. 다음 인덱스가 없다면 스캔 비용이 커질 수 있습니다.
- room_participants(user_id, status) —
/rooms/my용- room_participants(room_id, status) — 방 단위 집계/검증 시
- 필요 시 JPA 엔티티에
@Index(name = "...", columnList = "user_id,status")추가 검토
인덱스 유무와 선택도는 실행계획으로 한 번 확인 부탁드립니다.src/test/java/konkuk/thip/room/adapter/in/web/RoomShowMineApiTest.java (3)
476-482: 직접 SQL 업데이트는 헬퍼로 감싸 중복·스키마 결합 최소화테스트 내에서 동일 SQL이 반복됩니다. 헬퍼 메서드로 캡슐화하면 중복 제거와 스키마 변경 시 영향 최소화에 도움이 됩니다.
- jdbcTemplate.update( - "UPDATE room_participants SET status = ? WHERE room_participant_id = ?", - StatusType.INACTIVE.name(), exit1.getRoomParticipantId()); - jdbcTemplate.update( - "UPDATE room_participants SET status = ? WHERE room_participant_id = ?", - StatusType.INACTIVE.name(), exit2.getRoomParticipantId()); + deactivateParticipant(exit1.getRoomParticipantId()); + deactivateParticipant(exit2.getRoomParticipantId());테스트 클래스에 보조 메서드 추가:
private void deactivateParticipant(Long roomParticipantId) { jdbcTemplate.update( "UPDATE room_participants SET status = ? WHERE room_participant_id = ?", StatusType.INACTIVE.name(), roomParticipantId ); }
91-103: 참여자 생성은 TestEntityFactory 활용 고려(초깃값 일관성 확보)직접 빌더로 생성하면 기본값(예: currentPage, userPercentage 등) 일관성이 깨질 수 있습니다. 팩토리 메서드 사용을 권장합니다.
- private RoomParticipantJpaEntity saveSingleUserToRoom(RoomJpaEntity roomJpaEntity, UserJpaEntity userJpaEntity) { - RoomParticipantJpaEntity roomParticipantJpaEntity = RoomParticipantJpaEntity.builder() - .userJpaEntity(userJpaEntity) - .roomJpaEntity(roomJpaEntity) - .roomParticipantRole(RoomParticipantRole.MEMBER) - .build(); - RoomParticipantJpaEntity saved = roomParticipantJpaRepository.save(roomParticipantJpaEntity); + private RoomParticipantJpaEntity saveSingleUserToRoom(RoomJpaEntity roomJpaEntity, UserJpaEntity userJpaEntity) { + RoomParticipantJpaEntity roomParticipant = TestEntityFactory + .createRoomParticipant(roomJpaEntity, userJpaEntity, RoomParticipantRole.MEMBER, 0.0); + RoomParticipantJpaEntity saved = roomParticipantJpaRepository.save(roomParticipant); roomJpaEntity.updateMemberCount(roomJpaEntity.getMemberCount() + 1); roomJpaRepository.save(roomJpaEntity); return saved; }
450-494: 탈퇴 시 memberCount 반영 여부 별도 케이스로 검증 제안본 테스트는 목록 제외만 확인합니다. 도메인 상 “방 나가기”가 memberCount 감소를 동반해야 한다면, 그 동작을 검증하는 별도 통합 테스트를 추가해 주세요(서비스·이벤트 핸들러 경로 포함). 현재는 raw SQL로 status만 바꾸므로 카운트 정합성은 커버되지 않습니다.
원하시면 케이스 초안을 드리겠습니다(나가기 API 호출 → count 감소 및 목록 제외 동시 검증).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
src/main/java/konkuk/thip/room/adapter/out/persistence/repository/RoomQueryRepositoryImpl.java(4 hunks)src/test/java/konkuk/thip/room/adapter/in/web/RoomShowMineApiTest.java(5 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#113
File: src/main/java/konkuk/thip/recentSearch/adapter/out/persistence/RecentSearchCommandPersistenceAdapter.java:38-44
Timestamp: 2025-07-30T14:05:04.945Z
Learning: seongjunnoh는 코드 최적화 제안에 대해 구체적인 기술적 근거와 효율성 차이를 이해하고 싶어하며, 성능 개선 방식에 대한 상세한 설명을 선호한다.
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#93
File: src/main/java/konkuk/thip/room/adapter/out/persistence/RoomQueryPersistenceAdapter.java:49-114
Timestamp: 2025-07-28T16:44:31.224Z
Learning: seongjunnoh는 코드 중복 문제에 대한 리팩토링 제안을 적극적으로 수용하고 함수형 인터페이스를 활용한 해결책을 선호한다.
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#195
File: src/main/java/konkuk/thip/feed/application/mapper/FeedQueryMapper.java:0-0
Timestamp: 2025-08-13T05:22:32.287Z
Learning: seongjunnoh는 데이터 무결성과 중복 방지에 대한 고민이 깊으며, LinkedHashSet을 활용한 중복 제거와 순서 보장을 동시에 달성하는 솔루션을 선호한다.
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#180
File: src/main/java/konkuk/thip/room/application/service/AttendanceCheckCreateService.java:22-40
Timestamp: 2025-08-14T09:15:31.371Z
Learning: seongjunnoh는 기술적 완벽성보다 실제 비즈니스 시나리오와 사용자 행동 패턴을 우선 고려하며, 발생 가능성이 낮은 엣지 케이스보다는 실용적인 구현을 선호한다.
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#112
File: src/main/java/konkuk/thip/feed/adapter/out/persistence/repository/FeedQueryRepositoryImpl.java:272-272
Timestamp: 2025-07-30T10:44:34.115Z
Learning: seongjunnoh는 피드 커서 페이지네이션에서 LocalDateTime 단일 커서 방식을 선호하며, 복합 키 기반 커서보다 구현 단순성과 성능을 우선시한다.
🧬 Code graph analysis (1)
src/test/java/konkuk/thip/room/adapter/in/web/RoomShowMineApiTest.java (1)
src/test/java/konkuk/thip/common/util/TestEntityFactory.java (1)
TestEntityFactory(30-394)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (2)
src/main/java/konkuk/thip/room/adapter/out/persistence/repository/RoomQueryRepositoryImpl.java (1)
271-274: ACTIVE 참여자 필터 추가로 ‘나간 방’ 배제 — 의도 충족합니다각 쿼리의 기본 조건에
participant.status.eq(StatusType.ACTIVE)를 추가하여, 참여 이력이 INACTIVE인 방이/rooms/my결과에서 제외됩니다. 비즈니스 요구와 정합합니다.Also applies to: 289-293, 310-313, 340-343
src/test/java/konkuk/thip/room/adapter/in/web/RoomShowMineApiTest.java (1)
450-494: ‘나간 방 제외’ 시나리오 커버 좋습니다INACTIVE로 마킹한 참여 이력이 목록에서 제외되는 것을 end-to-end로 검증하고 있어 회귀 방지에 유효합니다. 정렬과 카운트 기대치도 명확합니다.
- 유저가 방에서 나가지 않고, 현재 활동중인 모임방만 조회되도록 where 절 추가
#️⃣ 연관된 이슈
📝 작업 내용
main 브랜치에 바로 hotfix 한
수정 코드를 develop 브랜치에도 적용
📸 스크린샷
💬 리뷰 요구사항
📌 PR 진행 시 이러한 점들을 참고해 주세요
Summary by CodeRabbit