mirror of
http://88.130.71.182:3000/BlitTech/deals24togo_be.git
synced 2026-06-12 23:33:21 +00:00
56 lines
1.5 KiB
Python
56 lines
1.5 KiB
Python
"""Agency request / response schemas."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel, EmailStr, Field, HttpUrl
|
|
|
|
|
|
class AgencyBase(BaseModel):
|
|
name: str = Field(..., min_length=1, max_length=255)
|
|
description: str = Field(..., min_length=1, max_length=2000)
|
|
address: str = Field(..., min_length=1, max_length=500)
|
|
phone: str = Field(..., min_length=1, max_length=20)
|
|
email: EmailStr
|
|
website: Optional[str] = Field(None, max_length=500)
|
|
|
|
|
|
class AgencyCreate(AgencyBase):
|
|
pass
|
|
|
|
|
|
class AgencyUpdate(BaseModel):
|
|
name: Optional[str] = Field(None, min_length=1, max_length=255)
|
|
description: Optional[str] = Field(None, min_length=1, max_length=2000)
|
|
address: Optional[str] = Field(None, min_length=1, max_length=500)
|
|
phone: Optional[str] = Field(None, min_length=1, max_length=20)
|
|
email: Optional[EmailStr] = None
|
|
website: Optional[str] = Field(None, max_length=500)
|
|
logo: Optional[str] = None
|
|
|
|
|
|
class AgencyResponse(BaseModel):
|
|
id: str
|
|
user_id: str
|
|
name: str
|
|
description: str
|
|
logo: Optional[str] = None
|
|
address: str
|
|
phone: str
|
|
email: str
|
|
website: Optional[str] = None
|
|
verified: bool
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class AgencyListResponse(BaseModel):
|
|
agencies: list[AgencyResponse]
|
|
total: int
|
|
page: int
|
|
page_size: int
|