Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /rubelw_OSSS /src /OSSS /schemas /committee.py
| # Auto-generated by OSSS.schemas.codegen — DO NOT EDIT BY HAND | |
| from __future__ import annotations | |
| from typing import Optional | |
| from datetime import datetime | |
| import uuid | |
| from pydantic import Field, ConfigDict, model_validator | |
| from OSSS.schemas.base import APIModel | |
| # --------------------------------------------------------------------------- | |
| # Shared base (used for Out as well via inheritance) | |
| # --------------------------------------------------------------------------- | |
| class _CommitteeBase(APIModel): | |
| model_config = ConfigDict(from_attributes=True, populate_by_name=True) | |
| organization_id: Optional[uuid.UUID] = Field( | |
| default=None, description="FK to mentors.id (nullable)." | |
| ) | |
| school_id: Optional[uuid.UUID] = Field( | |
| default=None, description="FK to schools.id (nullable)." | |
| ) | |
| name: str = Field(..., description="Committee name.") | |
| description: Optional[str] = Field(default=None, description="Optional details.") | |
| # SQL default is 'active'; expose as field but default in Create/Replace. | |
| status: Optional[str] = Field(default=None, description="Lifecycle status (default: 'active').") | |
| # --------------------------------------------------------------------------- | |
| # Out (read) model | |
| # --------------------------------------------------------------------------- | |
| class CommitteeOut(_CommitteeBase): | |
| id: uuid.UUID | |
| created_at: datetime | |
| updated_at: datetime | |
| # In responses, status should always be present (server default). | |
| status: str = Field(..., description="Lifecycle status.") | |
| # --------------------------------------------------------------------------- | |
| # Create (POST) — enforce at least one of org or school; default status | |
| # --------------------------------------------------------------------------- | |
| class CommitteeCreate(APIModel): | |
| model_config = ConfigDict(from_attributes=True, populate_by_name=True) | |
| organization_id: Optional[uuid.UUID] = Field( | |
| default=None, description="FK to mentors.id (nullable)." | |
| ) | |
| school_id: Optional[uuid.UUID] = Field( | |
| default=None, description="FK to schools.id (nullable)." | |
| ) | |
| name: str = Field(..., description="Committee name.") | |
| description: Optional[str] = Field(default=None, description="Optional details.") | |
| status: Optional[str] = Field( | |
| default="active", description="Lifecycle status (server default: 'active')." | |
| ) | |
| def _require_scope(self) -> "CommitteeCreate": | |
| if not (self.organization_id or self.school_id): | |
| raise ValueError("Either organization_id or school_id must be provided.") | |
| return self | |
| # --------------------------------------------------------------------------- | |
| # Replace (PUT) — same validation as Create | |
| # --------------------------------------------------------------------------- | |
| class CommitteeReplace(CommitteeCreate): | |
| pass | |
| # --------------------------------------------------------------------------- | |
| # Patch (PATCH) — all fields optional; do NOT enforce scope rule here | |
| # (DB constraint will enforce at write time if both become NULL) | |
| # --------------------------------------------------------------------------- | |
| class CommitteePatch(APIModel): | |
| model_config = ConfigDict(from_attributes=True, populate_by_name=True) | |
| organization_id: Optional[uuid.UUID] = None | |
| school_id: Optional[uuid.UUID] = None | |
| name: Optional[str] = None | |
| description: Optional[str] = None | |
| status: Optional[str] = None | |
| # --------------------------------------------------------------------------- | |
| # List wrapper | |
| # --------------------------------------------------------------------------- | |
| class CommitteeList(APIModel): | |
| items: list[CommitteeOut] | |
| total: int | None = None | |
| skip: int = 0 | |
| limit: int = 100 | |
Xet Storage Details
- Size:
- 3.81 kB
- Xet hash:
- bc742bf9f673d7f81be428977c036d4719ea87fd87742ff4d4228b44d48b2f8f
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.