29 lines
1.3 KiB
Python
29 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
from datetime import date
|
|
|
|
from sqlalchemy import Date, ForeignKey, Integer, String, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from app.db.base import Base, TimestampMixin, UUIDMixin
|
|
|
|
|
|
class Device(Base, UUIDMixin, TimestampMixin):
|
|
__tablename__ = "devices"
|
|
|
|
customer_id: Mapped[str] = mapped_column(ForeignKey("customers.id"), index=True)
|
|
location_id: Mapped[str | None] = mapped_column(ForeignKey("locations.id"), index=True)
|
|
manufacturer: Mapped[str] = mapped_column(String(140))
|
|
model: Mapped[str] = mapped_column(String(140))
|
|
device_type: Mapped[str | None] = mapped_column(String(120))
|
|
serial_number: Mapped[str] = mapped_column(String(140), unique=True, index=True)
|
|
year_built: Mapped[int | None] = mapped_column(Integer)
|
|
commissioned_on: Mapped[date | None] = mapped_column(Date)
|
|
chamber_volume_liters: Mapped[int | None] = mapped_column(Integer)
|
|
steam_generation: Mapped[str | None] = mapped_column(String(220))
|
|
water_treatment: Mapped[str | None] = mapped_column(String(220))
|
|
documentation: Mapped[str | None] = mapped_column(Text)
|
|
supplier: Mapped[str | None] = mapped_column(String(180))
|
|
|
|
location: Mapped["Location | None"] = relationship(back_populates="devices")
|
|
|