feat: add full project - backend, frontend, docker, specs and configs
This commit is contained in:
parent
b77c7d5a01
commit
e6cb06255b
24489 changed files with 61341 additions and 36 deletions
37
backend/app/schemas/homepage.py
Normal file
37
backend/app/schemas/homepage.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, field_validator
|
||||
|
||||
|
||||
class HomepageConfigOut(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
hero_headline: str
|
||||
hero_subheadline: str | None
|
||||
hero_cta_label: str
|
||||
hero_cta_url: str
|
||||
featured_properties_limit: int
|
||||
hero_image_url: str | None = None
|
||||
|
||||
|
||||
class HomepageConfigIn(BaseModel):
|
||||
hero_headline: str
|
||||
hero_subheadline: str | None = None
|
||||
hero_cta_label: str = "Ver Imóveis"
|
||||
hero_cta_url: str = "/imoveis"
|
||||
featured_properties_limit: int = 6
|
||||
hero_image_url: str | None = None
|
||||
|
||||
@field_validator("hero_headline")
|
||||
@classmethod
|
||||
def headline_not_empty(cls, v: str) -> str:
|
||||
if not v.strip():
|
||||
raise ValueError("hero_headline não pode ser vazio")
|
||||
return v
|
||||
|
||||
@field_validator("featured_properties_limit")
|
||||
@classmethod
|
||||
def limit_in_range(cls, v: int) -> int:
|
||||
if not (1 <= v <= 12):
|
||||
raise ValueError("featured_properties_limit deve estar entre 1 e 12")
|
||||
return v
|
||||
Loading…
Add table
Add a link
Reference in a new issue