|
- from pydantic import BaseModel, computed_field, PrivateAttr
-
-
- class IssuePost(BaseModel):
- _id: bytes = PrivateAttr()
- title: str
- summary: str
- paragraph_count: int
- positive_votes: int
- negative_votes: int
- telegram_handle: str
- created_at: int
-
- def __init__(self, id: bytes, **data):
- super().__init__(**data)
- self._id = id
-
- @computed_field(return_type=str)
- @property
- def id(self) -> str:
- return self._id.hex()
-
- @id.setter
- def id(self, value: bytes) -> None:
- self._id = value
-
-
- class AddIssueRequest(BaseModel):
- session_id: str
- title: str
- paragraphs: list[str]
-
-
- class AddIssueResponse(BaseModel):
- result: bool
-
-
- class VoteIssueRequest(BaseModel):
- issue_id: str
- increase: bool
- decrease: bool
|