22 lines
744 B
Python
22 lines
744 B
Python
"""Unit model — an apartment at Pavilion East/West."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from sqlalchemy import String
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.core.database import Base
|
|
|
|
|
|
class Unit(Base):
|
|
__tablename__ = "units"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
|
property: Mapped[str] = mapped_column(String(10), nullable=False, comment="East or West")
|
|
apartment_code: Mapped[str] = mapped_column(String(20), unique=True, nullable=False, index=True)
|
|
building: Mapped[str | None] = mapped_column(String(100), nullable=True)
|
|
floor: Mapped[int | None] = mapped_column(nullable=True)
|
|
|
|
def __repr__(self) -> str:
|
|
return f"<Unit {self.apartment_code}>"
|