46 lines
937 B
Python
46 lines
937 B
Python
import uuid
|
|
|
|
from pydantic import EmailStr
|
|
from sqlmodel import Field, SQLModel
|
|
from enum import Enum
|
|
|
|
from datetime import date, datetime
|
|
|
|
|
|
from sqlalchemy.sql import func
|
|
|
|
|
|
class VoiceEnum(str, Enum):
|
|
base = "Bass"
|
|
tenor = "Tenor"
|
|
alto = "Alt"
|
|
soprano = "Sopran"
|
|
men = "Bass oder Tenor"
|
|
women = "Alt oder Sopran"
|
|
|
|
|
|
class PeriodEnum(str, Enum):
|
|
halfyear = "1/2 Jahr"
|
|
year = "1/2 - 1 Jahr"
|
|
twoyears = "1 - 2 Jahre"
|
|
longterm = "mehr als zwei Jahre"
|
|
|
|
|
|
class RegistrationBase(SQLModel):
|
|
email: EmailStr = Field(max_length=255)
|
|
first_name: str
|
|
last_name: str
|
|
birthday: date
|
|
voice: VoiceEnum
|
|
duration: PeriodEnum
|
|
number_of_attempts: int
|
|
|
|
|
|
class RegistrationCreate(RegistrationBase):
|
|
pass
|
|
|
|
|
|
class Registration(RegistrationBase, table=True):
|
|
id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
|
|
timestamp: datetime = Field(default_factory=func.now)
|