This commit is contained in:
2026-02-11 23:54:42 +01:00 Unverified
commit ace6f5a022
47 changed files with 5315 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
# backend/app/routes/tournaments/matches.py
from fastapi import Depends, HTTPException
from sqlalchemy.orm import Session
from ... import crud, schemas
from ...database import get_db
from . import router
@router.get("/{id}/matches", response_model=list[schemas.MatchOut])
def get_tournament_matches(id: str, db: Session = Depends(get_db)):
matches = crud.get_tournament_matches(db, id)
return matches
@router.get("/{id}/matches/{match_id}", response_model=schemas.MatchOut)
def get_match_details(id: str, match_id: str, db: Session = Depends(get_db)):
match = crud.get_match(db, id, match_id)
if not match:
raise HTTPException(404, "Match not found")
return match