Spaces:
Running
Running
File size: 735 Bytes
478dec6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | from uuid import UUID
from typing import Optional
from datetime import datetime
from pydantic import BaseModel, Field
# ---------- REQUEST ----------
class TenantCreate(BaseModel):
tenant_name: str = Field(..., min_length=3, max_length=100)
notes: Optional[str] = None
# ---------- UPDATE (OPTIONAL) ----------
class TenantUpdate(BaseModel):
tenant_name: Optional[str] = Field(None, min_length=3, max_length=100)
notes: Optional[str] = None
# ---------- RESPONSE ----------
class TenantResponse(BaseModel):
tenant_id: UUID
tenant_name: str
created_at: datetime
date_modified: datetime
notes: Optional[str] = None
class Config:
from_attributes = True # Pydantic v2 (ORM support)
|