Files
hms-licht-ton/backend/app/schemas/contact.py
T

22 lines
498 B
Python
Raw Normal View History

"""Pydantic schema for contact form."""
from pydantic import BaseModel, EmailStr, field_validator
class ContactCreate(BaseModel):
name: str
email: EmailStr
phone: str | None = None
message: str
privacy_consent: bool
@field_validator("privacy_consent")
@classmethod
def consent_must_be_true(cls, v: bool) -> bool:
if not v:
raise ValueError("privacy_consent must be True")
return v
class ContactResponse(BaseModel):
success: bool