mirror of
http://88.130.71.182:3000/BlitTech/deals24togo_be.git
synced 2026-06-12 23:33:21 +00:00
Initial commit
This commit is contained in:
55
app/schemas/agency.py
Normal file
55
app/schemas/agency.py
Normal file
@@ -0,0 +1,55 @@
|
||||
"""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
|
||||
Reference in New Issue
Block a user