sass-imobiliaria/backend/app/schemas/catalog.py

58 lines
1.1 KiB
Python

from __future__ import annotations
from pydantic import BaseModel, ConfigDict
class PropertyTypeOut(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: int
name: str
slug: str
parent_id: int | None
subtypes: list["PropertyTypeOut"] = []
property_count: int = 0
# Required for Pydantic v2 to resolve the self-referential forward reference
PropertyTypeOut.model_rebuild()
class AmenityOut(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: int
name: str
slug: str
group: str
class CityOut(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: int
name: str
slug: str
state: str
property_count: int = 0
class NeighborhoodOut(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: int
name: str
slug: str
city_id: int
property_count: int = 0
class ImobiliariaOut(BaseModel):
model_config = ConfigDict(from_attributes=True)
id: int
name: str
logo_url: str | None
website: str | None
is_active: bool
display_order: int