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

24 lines
901 B
Python
Raw Normal View History

"""Contact SQLAlchemy model."""
from datetime import datetime
from sqlalchemy import Boolean, Integer, String, Text, func
from sqlalchemy.orm import Mapped, mapped_column
from app.database import Base
class Contact(Base):
"""Contact form submission."""
__tablename__ = "contacts"
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
name: Mapped[str] = mapped_column(String(255), nullable=False)
email: Mapped[str] = mapped_column(String(255), nullable=False)
phone: Mapped[str | None] = mapped_column(String(64), nullable=True)
message: Mapped[str] = mapped_column(Text, nullable=False)
privacy_consent: Mapped[bool] = mapped_column(Boolean, nullable=False)
email_sent: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
created_at: Mapped[datetime] = mapped_column(server_default=func.now(), nullable=False)