Skip to content

Conversation

@ggamnunq
Copy link
Contributor

@ggamnunq ggamnunq commented Aug 11, 2025

채팅 기능 구현

  • 웹소켓으로 채팅 토픽 subscribe -> 실시간으로 채팅 받아옴
  • 채팅 전송 REST API -> db에 저장 후 웹소켓 publish
  • 채팅 목록 조회 ( 현재는 전체 조회, 추후 페이징 적용 예정 )

로그인 방식 변경

  • jwt token을 json body로 넘기는 방식 -> 딥링크 이용하여 전달

응답값 변경

  • address, region -> address 통일

mongodb 세팅

  • 채팅 기록 저장 목적

Summary by CodeRabbit

  • New Features
    • 실시간 채팅(WebSocket)과 채팅 기록 조회 제공(메시지 저장·브로드캐스트).
    • AI 챗봇 응답 기능 추가.
  • Refactor
    • 다수 응답 DTO의 region 필드를 address로 변경(홈/축제/검색).
    • 카카오 로그인 콜백이 API 응답 대신 앱 딥링크로 리다이렉트.
    • JWT 기반 인증이 이메일 → 사용자 ID 기준으로 전환.
  • Chores
    • CORS/Jackson/Redis/Mongo/OpenAI 구성 추가 및 로깅 개선.

@ggamnunq ggamnunq self-assigned this Aug 11, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 11, 2025

Walkthrough

채팅 기능을 도입하고(REST/웹소켓/Redis/Mongo) Jackson/Mongo/Redis/OpenAI/JWT/웹소켓 설정을 추가했습니다. OAuth 콜백은 리다이렉트 방식으로 변경되었습니다. 여러 DTO에서 region 필드를 address로 변경했고, 한 DTO(PlaceQueryResult)를 삭제했습니다. 예외/보안/CORS/Jackson 설정이 확장되었습니다.

Changes

Cohort / File(s) Summary
Build & Config
build.gradle, src/main/resources/application.yml
Redis/Mongo/WebSocket/Jackson(Kotlin/JSR310) 의존성 추가, OpenAI 설정 추가, 로깅/Jackson 날짜 직렬화 설정 및 딥링크/몽고/오픈AI 프로퍼티 추가
Chat Controllers
.../chat/controller/ChatRestController.kt, .../chat/controller/ChatWebSocketController.kt
REST 전송/히스토리 API 추가, 웹소켓 컨트롤러 스켈레톤 추가
Chat Domain & Repo
.../chat/domain/ChatMessage.kt, .../chat/enums/MessageType.kt, .../chat/repository/ChatMongoRepository.kt
Mongo 문서/메시지 타입/정렬 조회 리포지토리 추가
Chat DTOs (WebSocket)
.../chat/dto/websocket/*
송수신/응답/오류/유저정보 DTO 추가, snake_case 매핑
Chat DTOs (OpenAI)
.../chat/dto/openai/*
OpenAI 요청/응답 DTO 추가 및 프롬프트용 보조 생성자
Chat Services
.../chat/service/ChatMongoService.kt, .../chat/service/RedisPublisher.kt, .../chat/service/RedisSubscriber.kt, .../chat/service/ChatGPTService.kt
채팅 저장+Redis 발행/구독 처리, 웹소켓 전파, OpenAI 프롬프트 서비스 추가
Mongo/Redis/Jackson/OpenAI Config
.../global/config/mongo/MongoConfig.kt, .../global/config/redis/RedisConfig.kt, .../global/config/JacksonConfig.kt, .../global/config/openai/ChatGPTConfig.kt
MongoClient/Template/리포지토리 활성화, Redis 템플릿/리스너/토픽/직렬화기, ObjectMapper 커스터마이즈, OpenAI RestTemplate/Headers 빈 추가
WebSocket Config & Listeners
.../global/config/webSocket/WebSocketConfig.kt, .../global/config/webSocket/StompEventListener.kt
STOMP 엔드포인트/브로커/경로/허용 오리진 설정, 연결/해제 이벤트 리스너 추가
Security & WS Auth
.../global/config/security/JwtTokenProvider.kt, .../global/config/security/SecurityConfig.kt, .../global/config/webSocket/AuthChannelInterceptorAdapter.kt, .../global/config/webSocket/JwtHandshakeInterceptor.kt
JWT subject를 이메일→사용자ID로 변경, 보안 체인/CORS 경로 갱신, STOMP CONNECT 인터셉터 추가, 핸드셰이크 인터셉터 도입(미사용 가능)
Exception/CORS
.../global/apiPayload/exception/ExceptionAdvice.kt, .../global/config/CorsConfig.kt
예외 어드바이스 대상에 Controller 추가, 전역 CORS 매핑 추가
Error Codes
.../global/apiPayload/code/status/ErrorStatus.kt
CHAT_INVALID_LENGTH 에러 코드 추가
User Login Redirect
.../user/controller/UserController.kt, .../user/util/LoginRedirectUtil.kt, .../user/data/User.kt, .../user/service/login/AuthService.kt
카카오 콜백을 302 리다이렉트로 변경(딥링크 생성 유틸 추가), UserDetails username을 id로 반환, 불필요 import 정리
Region→Address 변경
.../festival/converter/FestivalConverter.kt, .../festival/dto/FestivalDetailsDTO.kt, .../festival/dto/FestivalListResponseDTO.kt, .../festival/service/FestivalQueryService.kt, .../home/dto/HomeResponseDTO.kt, .../home/service/HomeQueryService.kt, .../search/dto/SearchResultDTO.kt, .../search/service/SearchQueryService.kt
여러 DTO 및 매핑에서 region 필드를 address로 리네이밍 및 호출부 반영
Removal
.../place/dto/PlaceQueryResult.kt
PlaceQueryResult DTO 삭제

Sequence Diagram(s)

sequenceDiagram
  participant C as Client
  participant REST as ChatRestController
  participant S as ChatMongoService
  participant M as MongoDB
  participant R as RedisPublisher
  participant RT as Redis
  participant RS as RedisSubscriber
  participant WS as WebSocket(/sub/chatroom)

  C->>REST: POST /chat/send (ChatMessageSendDTO)
  REST->>S: saveAndPublish(dto)
  S->>M: save(ChatMessage)
  M-->>S: saved
  S->>R: publish(topic, ChatMessageReceiveDTO)
  R->>RT: convertAndSend("chatroom", payload)
  RT-->>RS: message
  RS->>WS: convertAndSend(/sub/chatroom, payload)
  WS-->>C: STOMP message
Loading
sequenceDiagram
  participant K as Kakao OAuth
  participant UC as UserController
  participant U as UserCommandService
  participant L as LoginRedirectUtil
  participant B as Browser/App

  K-->>UC: GET /users/oauth/kakao/callback?code=...
  UC->>U: loginWithKakao(code)
  U-->>UC: UserResponseDTO.LoginDto
  UC->>L: getRedirectHeader(userResponse)
  L-->>UC: HttpHeaders(Location: deepLink?accessToken=...&refreshToken=...)
  UC-->>B: 302 Found (Location header)
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~75 minutes

Poem

토끼는 톡톡, 채팅방 뛰어들어
몽고에 퐁당, 레디스에 휙—흘러가요
웹소켓 바람 타고 쏜살같이 전파되고
주소로 이름 바꾼 들판을 질주해요
깡총! 로그인은 링크 따라 삐빅—리다이렉트


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 0625477 and 45ad950.

📒 Files selected for processing (44)
  • build.gradle (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/chat/controller/ChatRestController.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/chat/controller/ChatWebSocketController.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/chat/domain/ChatMessage.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/chat/dto/openai/ChatRequest.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/chat/dto/openai/MessageDTO.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/chat/dto/websocket/ChatMessageReceiveDTO.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/chat/dto/websocket/ChatMessageResponseDTO.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/chat/dto/websocket/ChatMessageSendDTO.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/chat/dto/websocket/UserInfoResponse.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/chat/dto/websocket/WebSocketErrorDTO.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/chat/enums/MessageType.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/chat/repository/ChatMongoRepository.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/chat/service/ChatGPTService.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/chat/service/ChatMongoService.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/chat/service/RedisPublisher.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/chat/service/RedisSubscriber.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/festival/converter/FestivalConverter.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/festival/dto/FestivalDetailsDTO.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/festival/dto/FestivalListResponseDTO.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/festival/service/FestivalQueryService.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/home/dto/HomeResponseDTO.kt (2 hunks)
  • src/main/kotlin/busanVibe/busan/domain/home/service/HomeQueryService.kt (2 hunks)
  • src/main/kotlin/busanVibe/busan/domain/place/dto/PlaceQueryResult.kt (0 hunks)
  • src/main/kotlin/busanVibe/busan/domain/search/dto/SearchResultDTO.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/search/service/SearchQueryService.kt (2 hunks)
  • src/main/kotlin/busanVibe/busan/domain/user/controller/UserController.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/user/data/User.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/user/service/login/AuthService.kt (0 hunks)
  • src/main/kotlin/busanVibe/busan/domain/user/util/LoginRedirectUtil.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/global/apiPayload/code/status/ErrorStatus.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/global/apiPayload/exception/ExceptionAdvice.kt (2 hunks)
  • src/main/kotlin/busanVibe/busan/global/config/CorsConfig.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/global/config/JacksonConfig.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/global/config/mongo/MongoConfig.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/global/config/openai/ChatGPTConfig.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/global/config/redis/RedisConfig.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/global/config/security/JwtTokenProvider.kt (3 hunks)
  • src/main/kotlin/busanVibe/busan/global/config/security/SecurityConfig.kt (2 hunks)
  • src/main/kotlin/busanVibe/busan/global/config/webSocket/AuthChannelInterceptorAdapter.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/global/config/webSocket/JwtHandshakeInterceptor.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/global/config/webSocket/StompEventListener.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/global/config/webSocket/WebSocketConfig.kt (1 hunks)
  • src/main/resources/application.yml (3 hunks)
💤 Files with no reviewable changes (2)
  • src/main/kotlin/busanVibe/busan/domain/user/service/login/AuthService.kt
  • src/main/kotlin/busanVibe/busan/domain/place/dto/PlaceQueryResult.kt

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Join our Discord community for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ggamnunq ggamnunq merged commit d9c1656 into main Aug 11, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants