Spaces:
Running
on
Zero
Running
on
Zero
File size: 371 Bytes
ee3a6ac |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
from fastapi import APIRouter, HTTPException
from sqlalchemy.orm import Session
from models import Team
from schemas import TeamSchema
router = APIRouter()
@router.post("/teams")
async def create_team(team: TeamSchema, db: Session = Depends()):
new_team = Team(name=team.name)
db.add(new_team)
db.commit()
return {"message": "Team created successfully"} |