lab4 / app /api /participants /schemas.py
brestok's picture
init
69f2337
raw
history blame contribute delete
647 Bytes
from datetime import datetime
from uuid import UUID
from pydantic import BaseModel, Field
from app.core.config import NAME_MAX_LENGTH, NAME_MIN_LENGTH, RATING_MIN_VALUE
class ParticipantBase(BaseModel):
first_name: str = Field(min_length=NAME_MIN_LENGTH, max_length=NAME_MAX_LENGTH)
last_name: str = Field(min_length=NAME_MIN_LENGTH, max_length=NAME_MAX_LENGTH)
nickname: str = Field(min_length=NAME_MIN_LENGTH, max_length=NAME_MAX_LENGTH)
activity_rating: float = Field(ge=RATING_MIN_VALUE)
class ParticipantCreate(ParticipantBase):
pass
class Participant(ParticipantBase):
id: UUID
registered_at: datetime