eksplicit mapping af envs
This commit is contained in:
19
backend/app/api/match.py
Normal file
19
backend/app/api/match.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.core.database import get_db
|
||||
from app.models.match import MatchRequest, MatchResult
|
||||
from app.services import match_service, stats_service
|
||||
|
||||
router = APIRouter(tags=["match"])
|
||||
|
||||
|
||||
@router.post("", response_model=MatchResult)
|
||||
async def attempt_match(
|
||||
body: MatchRequest,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
) -> MatchResult:
|
||||
result = await match_service.attempt_match(body.own_token, body.detected_token)
|
||||
if result["match"]:
|
||||
await stats_service.increment_matches(db)
|
||||
return MatchResult(**result)
|
||||
Reference in New Issue
Block a user