유니티 상에서 플레이어가 사망 시 fastapi로 전달하여 db에 데이터 추가

This commit is contained in:
김민구
2026-07-03 18:20:32 +09:00
parent 7f2e3101a7
commit 83bc9e3200
4 changed files with 80 additions and 14 deletions
+3 -2
View File
@@ -3,6 +3,7 @@ from sqlalchemy.orm import Session
from backend.repository.db_init import get_db
from backend.schemas.game_schema import (
AncestorDeathCreate,
DeathRecordRequest,
AncestorDeathResponse,
DialogueResponse,
SkillCreateRequest,
@@ -13,8 +14,8 @@ from backend.services import game_service
router = APIRouter(prefix="/api/game", tags=["Game"])
@router.post("/death", response_model=AncestorDeathResponse)
def record_death(req: AncestorDeathCreate, db: Session = Depends(get_db)):
return game_service.create_death_history(db=db, death_data=req)
def record_death(req: DeathRecordRequest, db: Session = Depends(get_db)):
return game_service.create_death_history(db=db, cause_of_death=req.cause_of_death)
@router.get("/npc-dialogue", response_model=DialogueResponse)
def get_npc_dialogue(current_generation: int = Query(..., description="현재 플레이어 세대"), db: Session = Depends(get_db)):