model.py 1.2 KB

1234567891011121314151617181920212223242526272829
  1. from sqlalchemy import ForeignKey, Integer, String, Date, Time
  2. from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship
  3. from sqlalchemy.dialects.mysql.base import LONGTEXT, MEDIUMTEXT
  4. from datetime import date, time
  5. class Base(DeclarativeBase):
  6. pass
  7. class StatusMeldung(Base):
  8. __tablename__ = "status_meldung"
  9. datum: Mapped[date] = mapped_column(Date, primary_key=True)
  10. kunde: Mapped[str] = mapped_column(ForeignKey("kunden.kunde"), primary_key=True)
  11. kunde_ref: Mapped["Kunde"] = relationship()
  12. aufgabe: Mapped[str] = mapped_column(String(30), primary_key=True)
  13. start: Mapped[time] = mapped_column(Time, primary_key=True)
  14. ende: Mapped[time] = mapped_column(Time)
  15. fehlerbericht_import: Mapped[LONGTEXT] = mapped_column(LONGTEXT, nullable=True)
  16. fehlerbericht: Mapped[LONGTEXT] = mapped_column(LONGTEXT, nullable=True)
  17. anzahl: Mapped[int] = mapped_column(Integer, default=0)
  18. bearbeitet: Mapped[int] = mapped_column(Integer, default=0)
  19. kommentar_id: Mapped[int] = mapped_column(Integer, default=0)
  20. class Kunde(Base):
  21. __tablename__ = "kunden"
  22. kunde: Mapped[str] = mapped_column(String(50), primary_key=True)
  23. whitelist: Mapped[MEDIUMTEXT] = mapped_column(MEDIUMTEXT)