Files
MobilityOps/backend/app/models/customer.py
T
NuklearRabbit 04d26f1f2e M0: implement operational core
Backend: SQLAlchemy models, Alembic migrations, requirements lockfile. Frontend: pinned deps, package-lock, vite-env types fix. Verified compose build/health, pytest, ruff clean.
2026-08-01 21:01:04 +02:00

26 lines
1.0 KiB
Python

import uuid
from datetime import date
from sqlalchemy import Date, ForeignKey, String
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import Mapped, mapped_column
from app.core.db import Base
from app.models.mixins import TimestampMixin, UUIDPrimaryKeyMixin
class Customer(UUIDPrimaryKeyMixin, TimestampMixin, Base):
__tablename__ = "customers"
public_ref: Mapped[str] = mapped_column(String(20), unique=True, nullable=False)
first_name: Mapped[str] = mapped_column(String(80), nullable=False)
last_name: Mapped[str] = mapped_column(String(80), nullable=False)
email: Mapped[str | None] = mapped_column(String(200))
phone: Mapped[str | None] = mapped_column(String(40))
postal_code: Mapped[str | None] = mapped_column(String(20))
city: Mapped[str | None] = mapped_column(String(120))
date_of_birth: Mapped[date | None] = mapped_column(Date)
merged_into_customer_id: Mapped[uuid.UUID | None] = mapped_column(
UUID(as_uuid=True), ForeignKey("customers.id")
)