- feat(025): favoritos locais com FavoritesContext, HeartButton, PublicFavoritesPage
- feat(026): central de contatos admin (leads/contatos unificados)
- feat(027): configuração da página de contato via admin
- feat(028): trabalhe conosco - candidaturas com upload e admin
- feat(029): UX área do cliente - visitas, comparação, perfil
- feat(030): navbar UX - menu mobile, ThemeToggle, useFavorites
- feat(031): hero light/dark - imagens separadas por tema, upload, preview, seed
- feat(032): performance homepage - Promise.all parallel fetches, sessionStorage cache,
preload hero image, loading=lazy nos cards, useInView hook, will-change carrossel,
keyframes em index.css, AgentsCarousel e HomeScrollScene via props
- fix: light mode HomeScrollScene - gradiente, cores de texto, scroll hint
migrations: g1h2i3j4k5l6 (source em leads), h1i2j3k4l5m6 (contact_config),
i1j2k3l4m5n6 (job_applications), j2k3l4m5n6o7 (hero theme images)
55 lines
1.6 KiB
Python
55 lines
1.6 KiB
Python
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
|
|
hero_image_light_url: str | None = None
|
|
hero_image_dark_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
|
|
hero_image_light_url: str | None = None
|
|
hero_image_dark_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
|
|
|
|
|
|
class HomepageHeroImagesIn(BaseModel):
|
|
hero_image_url: str | None = None
|
|
hero_image_light_url: str | None = None
|
|
hero_image_dark_url: str | None = None
|
|
|
|
@field_validator("hero_image_url", "hero_image_light_url", "hero_image_dark_url")
|
|
@classmethod
|
|
def normalize_empty_to_none(cls, v: str | None) -> str | None:
|
|
if v is None:
|
|
return None
|
|
trimmed = v.strip()
|
|
return trimmed or None
|