from datetime import datetime from typing import Optional from pydantic import BaseModel, Field class User(BaseModel): id: int telegram_id: int = Field( exclude=True, ) first_name: str last_name: Optional[str] username: Optional[str] class PollSchema(BaseModel): id: int name: str question: str class PollOption(BaseModel): id: int poll_schema: PollSchema name: str ordinal: Optional[int] class Poll(BaseModel): id: int telegram_message_id: int = Field( exclude=True, ) telegram_poll_id: str = Field( exclude=True, ) poll_schema: PollSchema created_at: datetime is_complete: bool class PollAnswer(BaseModel): id: int poll: Poll user: User poll_option: list[PollOption]