refactor: RoomMember 엔티티에서 실시간 상태 필드 제거, redis로 이관 (#96) #143
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.
📌 개요
Redis 연결을 위해
RoomMember엔티티를 수정하던 중, RTC/채팅 관련 최신 코드가 병합되면서 충돌 및 에러가 지속적으로 발생했습니다.따라서 Redis까지 연동했던 작업을 초기화하고, DB ↔ Redis 역할 분리까지만 진행했습니다.
주요 변경 사항:
RoomMember엔티티에서 실시간 상태 관련 필드 제거 (Redis 이관을 위해)// TODO주석으로 처리🔨 작업 내용
1. RoomMember 엔티티 리팩토링
제거된 필드
isOnline: 온라인 상태 → Redis 이관 예정connectionId: WebSocket 연결 ID → Redis 이관 예정lastHeartbeat: 마지막 하트비트 시간 → Redis 이관 예정lastActiveAt: 마지막 활동 시간 → Redis 이관 예정추가된 필드
promotedAt: MEMBER 이상으로 권한 변경된 시간의미 변경
joinedAt: 기존 = 방 입장 시간변경 후 = MEMBER 이상으로 승격된 시간 (Member 이상부터만 db에 권한에 대한 정보로써 저장하기 위해)
2. Repository 수정
RoomMemberRepository.findByConnectionId()제거RoomMemberRepositoryImpl.leaveRoom()→@DeprecatedRoomMemberRepositoryImpl.disconnectAllMembers()→@DeprecatedRoomRepository.updateCurrentParticipants()→rm.isOnline = true조건 제거RoomRepositoryImpl.findRoomsByUserId()→isOnline조건 제거3. Service 로직 수정
RoomService.joinRoom()→isOnline체크 및updateOnlineStatus()호출 제거RoomService.leaveRoom()→member.leave()호출 제거 + Redis 이관 TODO 추가RoomService.terminateRoom()→disconnectAllMembers()주석 처리RoomService.kickMember()→targetMember.leave()호출 제거4. Validator 수정
WebRTCSignalValidator: 온라인 상태 검증 로직 제거5. DTO 수정
RoomMemberResponse→isOnline,lastActiveAt제거 /promotedAt추가6. 테스트 수정
RoomServiceTest:updateOnlineStatus()호출 제거,disconnectAllMembers검증 제거WebRTCSignalValidatorTest: 온라인/오프라인 관련 테스트 제거 및 간소화🔗 관련 이슈
Closes #96
📝 참고 사항
RoomMemberResponse:isOnline,lastActiveAt제거updateCurrentParticipants(): Redis 연결 전이라 온라인 구분 없이 전체 인원 기준으로 처리로 변경한 상태입니다.바로 진행할 다음 작업 예정
✅ 체크리스트