Add team registration and deletion
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from datetime import datetime
|
||||
from typing import Literal
|
||||
|
||||
from sqlmodel import Field, Relationship, SQLModel
|
||||
from sqlmodel import Field, Relationship, SQLModel, String
|
||||
|
||||
|
||||
class Event(SQLModel, table=True):
|
||||
@@ -11,7 +12,28 @@ class Event(SQLModel, table=True):
|
||||
description: str
|
||||
recipe_link: str
|
||||
|
||||
# Min and max number of people needed for cooking, doing the dishes and preparing the tables
|
||||
team_cooking_min: int = 3
|
||||
team_cooking_max: int = 5
|
||||
|
||||
team_dishes_min: int = 3
|
||||
team_dishes_max: int = 5
|
||||
|
||||
team_prep_min: int = 1
|
||||
team_prep_max: int = 1
|
||||
|
||||
registrations: list["Registration"] = Relationship()
|
||||
team: list["TeamRegistration"] = Relationship()
|
||||
|
||||
|
||||
class TeamRegistration(SQLModel, table=True):
|
||||
id: int | None = Field(default=None, primary_key=True)
|
||||
event_id: int | None = Field(default=None, foreign_key="event.id")
|
||||
person_name: str = Field(nullable=False)
|
||||
work_type: Literal["cooking", "dishes", "tables"] = Field(
|
||||
nullable=False, sa_type=String
|
||||
)
|
||||
comment: str | None
|
||||
|
||||
|
||||
class Household(SQLModel, table=True):
|
||||
|
||||
Reference in New Issue
Block a user