initial commit
This commit is contained in:
42
app/models.py
Normal file
42
app/models.py
Normal file
@@ -0,0 +1,42 @@
|
||||
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(unique=True, index=True, max_length=255)
|
||||
first_name: str
|
||||
last_name: str
|
||||
birthday: date
|
||||
voice: VoiceEnum
|
||||
duration: PeriodEnum
|
||||
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user