Complete main functionallity of backend and frontend.
This commit is contained in:
@@ -3,4 +3,4 @@ from fastapi import APIRouter
|
||||
|
||||
router = APIRouter(prefix="/tournaments", tags=["Tournaments"])
|
||||
|
||||
from . import tournaments, teams, courts, matches, report
|
||||
from . import tournaments, settings, teams, courts, matches, report
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# backend/app/routes/tournaments/settings.py
|
||||
|
||||
|
||||
from fastapi import Depends, HTTPException
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from ... import crud, schemas
|
||||
from ...database import get_db
|
||||
from ...core.auth import get_current_user
|
||||
from . import router
|
||||
|
||||
|
||||
@router.get("/{id}/settings", response_model=schemas.TournamentSettingsResponse)
|
||||
def get_tournament(
|
||||
id: str, db: Session = Depends(get_db), user: str = Depends(get_current_user)
|
||||
):
|
||||
t = crud.get_tournament(db, id)
|
||||
if not t:
|
||||
raise HTTPException(404, "Tournament not found")
|
||||
return t
|
||||
@@ -10,7 +10,7 @@ from ...core.auth import get_current_user
|
||||
from . import router
|
||||
|
||||
|
||||
@router.post("", response_model=schemas.TournamentUpdateResponse)
|
||||
@router.post("", response_model=schemas.TournamentSettingsResponse)
|
||||
async def create_tournament(
|
||||
data: schemas.TournamentCreate,
|
||||
db: Session = Depends(get_db),
|
||||
@@ -34,7 +34,7 @@ def get_tournament(id: str, db: Session = Depends(get_db)):
|
||||
return t
|
||||
|
||||
|
||||
@router.patch("/{id}", response_model=schemas.TournamentUpdateResponse)
|
||||
@router.patch("/{id}", response_model=schemas.TournamentSettingsResponse)
|
||||
async def update_settings(
|
||||
id: str,
|
||||
data: schemas.TournamentUpdate,
|
||||
|
||||
Reference in New Issue
Block a user