19 lines
755 B
Python
19 lines
755 B
Python
from __future__ import annotations
|
|
|
|
from sqlalchemy import ForeignKey, String
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from app.db.base import Base, TimestampMixin, UUIDMixin
|
|
|
|
|
|
class Contact(Base, UUIDMixin, TimestampMixin):
|
|
__tablename__ = "contacts"
|
|
|
|
customer_id: Mapped[str] = mapped_column(ForeignKey("customers.id", ondelete="CASCADE"), index=True)
|
|
full_name: Mapped[str] = mapped_column(String(160))
|
|
function: Mapped[str | None] = mapped_column(String(120))
|
|
email: Mapped[str | None] = mapped_column(String(255))
|
|
phone: Mapped[str | None] = mapped_column(String(80))
|
|
notes: Mapped[str | None] = mapped_column(String(500))
|
|
|
|
customer: Mapped["Customer"] = relationship(back_populates="contacts")
|