Skip to content

refactor: 플레이어 init을 GET 로드 + POST 생성으로 분리 - #29

Merged
Sean-mn merged 13 commits into
developfrom
refactor/player-load-create
Jun 29, 2026
Merged

Sean-mn merged 13 commits into
developfrom
refactor/player-load-create

Conversation

@Sean-mn

@Sean-mn Sean-mn commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

📚작업 내용

  • 플레이어 init 단일 엔드포인트를 GET /v1/player(로드)와 POST /v1/player(생성)로 분리
  • GetPlayerService 추가: Redis 캐시 우선 조회, 미스 시 DB 조회 후 캐시 적재, 플레이어 미존재 시 404
  • CreatePlayerService 추가: 트랜잭션으로 player/resource/stage/session 생성, 이미 존재하면 409, 생성 후 Redis 캐시 적재
  • 기존 InitPlayerService/IInitPlayerService/InitPlayerRequest 제거 → CreatePlayerRequest, IGetPlayerService/ICreatePlayerService로 대체
  • PlayerServiceConfig DI 등록을 신규 서비스에 맞게 갱신
  • Production Swagger Basic Auth 보호(SwaggerBasicAuthMiddleware) 및 관련 Program.cs/compose.prod.yaml 설정 제거
  • 클라이언트 연동 가이드 문서 추가 및 GET 로드 + POST 생성 흐름으로 갱신, 골드/티켓 충전 표현 명확화

◀️참고 사항

  • API 계약 변경: POST /v1/player/init → GET /v1/player + POST /v1/player. 클라이언트는 로드(GET) 후 404면 생성(POST)하는 흐름으로 동작
  • 테스트: GetPlayerServiceTest, CreatePlayerServiceTest 신규 추가, 기존 InitPlayerServiceTests 제거, 라우트 테스트를 GET/POST 구조로 갱신
  • 본 PR은 기존 Swagger/문서 PR(update: Production Swagger 공개 전환 및 클라이언트 연동 가이드 추가 #28)을 대체합니다

✅체크리스트

[ ]안에 x를 작성하면 체크박스를 체크할 수 있습니다.

  • 현재 의도하고자 하는 기능이 정상적으로 작동하나요?
  • 변경한 기능이 다른 기능을 깨뜨리지 않나요?

추후 필요한 체크리스트는 업데이트 될 예정입니다.

@Sean-mn Sean-mn added the enhancement:개선사항 New feature or request label Jun 29, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request redesigns the player loading and creation flow by splitting the combined POST /v1/player/init endpoint into a GET /v1/player endpoint for loading player data and a POST /v1/player endpoint for player creation. It updates the corresponding services, controllers, DI registrations, unit tests, and client integration documentation. The review feedback highlights two important issues: first, a potential client-side deadlock if a player exists but has missing related data, where throwing a 404 instead of a 500 would cause a loop of creation failures; second, a concurrency race condition during simultaneous player creation requests that could be mitigated by handling database unique constraint violations or using locks.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread Fantasy-server/Fantasy.Server/Domain/Player/Service/GetPlayerService.cs Outdated
Sean-mn added 3 commits June 29, 2026 11:50
플레이어 엔티티는 있으나 resource/stage/session이 누락된 데이터 정합성 위반에서 NotFoundException(404) 대신 InvalidOperationException(500)을 던진다. 404는 클라이언트가 POST /v1/player 생성을 시도하게 만들어 409와 교착 상태에 빠뜨린다. (PR #29 리뷰 반영)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the player initialization flow by splitting the combined load/create endpoint (POST /v1/player/init) into two distinct endpoints: GET /v1/player for loading player data and POST /v1/player for creating a new player. Correspondingly, InitPlayerService is split into GetPlayerService and CreatePlayerService, and the request DTO is renamed to CreatePlayerRequest. Additionally, the production Swagger basic authentication middleware is removed. Feedback on the changes suggests adding [EnumDataType(typeof(JobType))] validation to the CreatePlayerRequest to prevent invalid enum values from bypassing model validation.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

[Required]만으로는 미정의 정수 값(예: 99)이 모델 검증을 통과해
도메인 영역으로 유입될 수 있어, [EnumDataType(typeof(JobType))]으로
정의된 JobType 값만 허용하도록 보강.
@Sean-mn
Sean-mn merged commit 62af46c into develop Jun 29, 2026
4 checks passed
@Sean-mn
Sean-mn deleted the refactor/player-load-create branch June 29, 2026 06:36
@Sean-mn Sean-mn mentioned this pull request Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement:개선사항 New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant