Files
govoplan-committee/src/govoplan_committee/backend/schemas.py
T

59 lines
1.7 KiB
Python

from __future__ import annotations
from datetime import datetime
from typing import Any
from pydantic import BaseModel, ConfigDict, Field
class CommitteeWorkspaceWriteRequest(BaseModel):
model_config = ConfigDict(extra="forbid")
record: dict[str, Any]
idempotency_key: str = Field(min_length=1, max_length=255)
expected_revision: int | None = Field(default=None, ge=1)
class CommitteeWorkspaceListResponse(BaseModel):
records: list[dict[str, Any]]
total: int
offset: int
limit: int
class CommitteeWorkspaceHistoryResponse(BaseModel):
revisions: list[dict[str, Any]]
class CommitteeBallotFinalizeRequest(BaseModel):
model_config = ConfigDict(extra="forbid")
provider_id: str = Field(min_length=1, max_length=80)
provider_ballot_ref: str = Field(min_length=1, max_length=255)
approval_ref: dict[str, Any]
expected_revision: int = Field(ge=1)
recorded_at: datetime
change_reason: str = Field(min_length=1, max_length=1_000)
idempotency_key: str = Field(min_length=1, max_length=255)
class CommitteeVotingFinalizeRequest(BaseModel):
model_config = ConfigDict(extra="forbid")
voting_ballot_id: str = Field(min_length=1, max_length=255)
voting_expected_revision: int = Field(ge=1)
approval_ref: dict[str, Any]
expected_revision: int = Field(ge=1)
recorded_at: datetime
change_reason: str = Field(min_length=1, max_length=1_000)
idempotency_key: str = Field(min_length=1, max_length=255)
__all__ = [
"CommitteeWorkspaceHistoryResponse",
"CommitteeWorkspaceListResponse",
"CommitteeWorkspaceWriteRequest",
"CommitteeBallotFinalizeRequest",
"CommitteeVotingFinalizeRequest",
]