| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- from datetime import datetime
- from enum import Enum
- from pydantic import UUID4, BaseModel, ConfigDict, EmailStr
- class BaseResponse(BaseModel):
- model_config = ConfigDict(from_attributes=True)
- class BaseObjectResponse(BaseResponse):
- id: UUID4
- created_at: datetime
- updated_at: datetime
- class AccessTokenResponse(BaseResponse):
- token_type: str
- access_token: str
- expires_at: int
- issued_at: int
- refresh_token: str
- refresh_token_expires_at: int
- refresh_token_issued_at: int
- # ---- Organization ----
- class OrganizationResponse(BaseResponse):
- id: str
- name: str
- class MembershipUserResponse(BaseResponse):
- id: str
- email: EmailStr
- name: str
- class OrganizationMembershipResponse(BaseResponse):
- user_id: str
- organization_id: str
- role: str
- user: MembershipUserResponse
- class OrganizationDetailResponse(OrganizationResponse):
- name: str
- memberships: list[OrganizationMembershipResponse] = []
- class UserOrganizationResponse(BaseResponse):
- organization_id: str
- organization: OrganizationResponse
- role: str
- class UserResponse(BaseResponse):
- id: str
- email: EmailStr
- name: str
- phone_number: str | None = None
- global_role: str
- organizations: list[UserOrganizationResponse] = []
- class CommissionContactResponse(BaseResponse):
- name: str
- phone_number: str | None = None
- class CommissionResponse(BaseObjectResponse):
- name: str
- contacts: list[CommissionContactResponse] = []
- templates_id: list[UUID4] = []
- class VolunteerGroupResponse(BaseObjectResponse):
- name: str
- color: str | None = None
- volunteers_id: list[UUID4] = []
- class VolunteerResponse(BaseObjectResponse):
- name: str
- surname: str
- email: str
- phone_number: str
- automatic_sms: bool
- slots_id: list[UUID4] = []
- groups_id: list[str] = []
- comment: str
- class SlotResponse(BaseObjectResponse):
- title: str
- starting_time: datetime
- ending_time: datetime
- required_volunteers: int
- volunteers_id: list[str] = []
- template_id: UUID4 | None
- class SMSResponse(BaseObjectResponse):
- volunteer_id: UUID4 | None
- content: str
- phone_number: str
- sending_time: datetime
- send_time: datetime | None
- class TemplateResponse(BaseObjectResponse):
- title: str
- description: str
- place: str
- responsible_override: str | None = None
- commission_id: str | None = None
- tags_id: list[UUID4] = []
- comment: str
- class TagResponse(BaseObjectResponse):
- title: str
- templates_id: list[str] = []
- class ProjectResponse(BaseObjectResponse):
- name: str
- organization_id: str
- volunteers: list[VolunteerResponse]
- sms: list[SMSResponse]
- slots: list[SlotResponse]
- tags: list[TagResponse]
- templates: list[TemplateResponse]
- groups: list[VolunteerGroupResponse] = []
- is_public: bool
- class ProjectListResponse(BaseResponse):
- id: UUID4
- created_at: datetime
- updated_at: datetime
- name: str
- organization_id: str
- is_public: bool
- class EnumServerStatus(Enum):
- ACTIVE = "active"
- INVALID = "invalid (heartbeat missing)"
- INACTIVE = "inactive (stale)"
- class SMSServerStatus(BaseResponse):
- updated_at: datetime
- host: str
- user_agent: str
- message: EnumServerStatus
|