Skip to content

백엔드-> 프론트 redirect 주소 변경 - #134

Merged
roode1017 merged 5 commits into
mainfrom
dev
Aug 21, 2025
Merged

백엔드-> 프론트 redirect 주소 변경#134
roode1017 merged 5 commits into
mainfrom
dev

Conversation

@roode1017

@roode1017 roode1017 commented Aug 21, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • 플레이어 데이터를 검색 엔진에 자동 색인·동기화하여 검색/자동완성 응답성과 정확도를 개선했습니다.
  • Bug Fixes
    • OAuth2 로그인 리다이렉트 URL 처리를 단순화하고 환경변수 지원을 확장해 간헐적 리다이렉트 오류를 줄였습니다.
    • WebSocket 허용 오리진이 HTTPS 설정을 따르도록 조정해 보안 연결(HTTPS) 환경에서의 접속 문제를 해결했습니다.

@roode1017 roode1017 self-assigned this Aug 21, 2025
@roode1017 roode1017 added the bug Something isn't working label Aug 21, 2025
@coderabbitai

coderabbitai Bot commented Aug 21, 2025

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Walkthrough

애플리케이션 시작 시 Elasticsearch 인덱스(player-index) 존재 여부를 확인하고 없으면 리소스의 JSON 매핑으로 생성합니다. 플레이어 캐시 로직은 Redis 저장과 함께 Elasticsearch에도 동기 저장하도록 확장되었습니다. WebSocket과 OAuth2 리다이렉트의 프런트엔드 URL 설정은 HTTPS 속성/환경변수를 사용하도록 변경되었습니다. 새 인덱스 매핑 JSON이 추가되었습니다.

Changes

Cohort / File(s) Summary
Elasticsearch 인덱스 초기화
backendProject/src/main/java/.../domain/draft/PlayerIndexInitializer.java
앱 시작 시 player-index 존재 확인 후, 없으면 elasticsearch/player-index.json 로드해 생성. 로그 및 IOException 처리. 신규 컴포넌트/메서드 추가.
플레이어 캐시 동기화(Redis ↔ ES)
backendProject/src/main/java/.../player/cache/service/PlayerCacheService.java
캐시 미스/초기 로드 경로에서 DB→DTO 후 Redis 저장과 함께 playerEsService.saveAll(...) 호출 추가로 Elasticsearch에 동시 저장. 시그니처 변경 없음.
WebSocket 허용 오리진 설정 변경
backendProject/src/main/java/.../global/configuration/MatchWebSocketConfig.java
허용 오리진 소스를 frontend.http.urlfrontend.https.url로 변경. ENV도 FRONTEND_HTTP_URLFRONTEND_HTTPS_URL, 기본값 http://localhost:5173.
OAuth2 리다이렉트 URL 구성 수정
backendProject/src/main/java/.../global/security/oauth/OAuth2SuccessHandler.java
URL 빌더 제거, 문자열 연결로 리다이렉트 URL 구성. 속성 주입 키를 frontend.https.url(+ENV/기본값)로 변경하고 필드명 frontendHttpUrl로 갱신.
Elasticsearch 인덱스 스키마 추가
backendProject/src/main/resources/elasticsearch/player-index.json
플레이어 인덱스 설정/매핑 추가: n-gram/edge-ngram 분석기와 오토컴플리트 지원, 주요 필드(keyword/텍스트/서브필드) 정의.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant App as Application
    participant Init as PlayerIndexInitializer
    participant ES as Elasticsearch

    App->>Init: @PostConstruct
    Init->>ES: Check index "player-index" exists
    alt Not exists
        Init->>App: Load elasticsearch/player-index.json
        Init->>ES: Create index with settings/mappings
        ES-->>Init: Created
    else Exists
        ES-->>Init: Exists
    end
Loading
sequenceDiagram
    autonumber
    participant Client as Service Caller
    participant Cache as PlayerCacheService
    participant DB as PlayerRepository
    participant Redis as Redis
    participant ES as Elasticsearch

    Client->>Cache: getPlayersFromRedis()
    Cache->>Redis: GET players
    alt Cache miss
        Cache->>DB: Load players
        DB-->>Cache: Entities
        Cache->>Cache: Convert to DTOs
        Cache->>Redis: SET players
        Cache->>ES: saveAll(Documents)
        ES-->>Cache: Ack
    else Cache hit
        Redis-->>Cache: Players DTOs
    end
    Cache-->>Client: Players DTOs
Loading
sequenceDiagram
    autonumber
    participant User as User
    participant OAuth as OAuth2SuccessHandler
    participant FE as Frontend (HTTPS URL)

    User->>OAuth: OAuth2 login success
    OAuth->>OAuth: Build redirect = frontendHttpsUrl + "/auth/callback?accessToken=..."
    OAuth-->>User: Redirect to FE
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

새벽 캐시에 톡, 공 튕기듯 쌓이고
모래밭 글자처럼 ES에도 남긴다요 🐇
시작과 함께 인덱스 이름을 속삭이고,
HTTPS 길 따라 토큰은 집으로 달려가네.
플레이어 이름, n-gram 바람에 흩날리다 다시 모인다.


📜 Recent 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 499fa32 and be9080b.

📒 Files selected for processing (5)
  • backendProject/src/main/java/likelion/mlb/backendProject/domain/draft/PlayerIndexInitializer.java (1 hunks)
  • backendProject/src/main/java/likelion/mlb/backendProject/domain/player/cache/service/PlayerCacheService.java (1 hunks)
  • backendProject/src/main/java/likelion/mlb/backendProject/global/configuration/MatchWebSocketConfig.java (1 hunks)
  • backendProject/src/main/java/likelion/mlb/backendProject/global/security/oauth/OAuth2SuccessHandler.java (2 hunks)
  • backendProject/src/main/resources/elasticsearch/player-index.json (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

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.

❤️ Share
🪧 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@roode1017
roode1017 merged commit e59df29 into main Aug 21, 2025
1 check was pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants