20 lines
479 B
Python
20 lines
479 B
Python
from sqlalchemy.orm import Session
|
|
from backend.app.crud.base import CRUDBase
|
|
from backend.app.models.match import Match, MatchCreate, MatchUpdate
|
|
|
|
|
|
class CRUDMatch(CRUDBase[Match, MatchCreate, MatchUpdate]):
|
|
|
|
def create(self, db: Session, *, obj_in: MatchCreate) -> Match:
|
|
db_obj = Match(
|
|
**obj_in.dict()
|
|
)
|
|
db.add(db_obj)
|
|
db.commit()
|
|
db.refresh(db_obj)
|
|
return db_obj
|
|
|
|
|
|
|
|
match = CRUDMatch(Match)
|