Karte 12: Eskalationslogik für lange offene Fehlbestände
Zwei Stufen (Erinnerung an Materialverantwortliche, Eskalation an Leitungsverantwortliche/Administration) mit Tracking-Zeitstempel je Stufe gegen Mehrfachversand. Zeitschwellen in eskalation_konfiguration (DB, Singleton), admin-editierbar über GET/PUT /eskalation/konfiguration - bewusst nicht fix im Code. Prüflauf per POST /eskalation/pruefen angestoßen, Scheduling (Cron/systemd-Timer) bleibt Betriebsaufgabe. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CVgbozhYmuEhiEJHffRXCV
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from app.models.auth import Benutzer, BenutzerRolle, RolleTyp, Systemknoten, KnotenTyp
|
||||
from app.models.eskalation import EskalationKonfiguration
|
||||
from app.models.fehlbestand import Fehlbestand, FehlbestandStatus
|
||||
from app.models.historie import Historie
|
||||
from app.models.kontrolle import Kontrolle, KontrollStatus, Kontrollposition
|
||||
@@ -16,6 +17,7 @@ __all__ = [
|
||||
"RolleTyp",
|
||||
"Systemknoten",
|
||||
"KnotenTyp",
|
||||
"EskalationKonfiguration",
|
||||
"Fehlbestand",
|
||||
"FehlbestandStatus",
|
||||
"Historie",
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
from sqlalchemy import Integer
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.db.base import Base
|
||||
|
||||
|
||||
class EskalationKonfiguration(Base):
|
||||
"""Karte 12: Zeitschwellen für die Fehlbestand-Eskalation müssen zur Laufzeit
|
||||
änderbar sein, nicht fix im Code (Nutzer-Vorgabe) - Singleton-Zeile (id=1),
|
||||
per Admin-Endpunkt lesbar/änderbar statt Settings/Env."""
|
||||
|
||||
__tablename__ = "eskalation_konfiguration"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
||||
erinnerung_tage: Mapped[int] = mapped_column(Integer, nullable=False, default=3)
|
||||
leitung_tage: Mapped[int] = mapped_column(Integer, nullable=False, default=7)
|
||||
@@ -45,3 +45,7 @@ class Fehlbestand(Base):
|
||||
fehlbestand_status_pg, nullable=False, default=FehlbestandStatus.offen
|
||||
)
|
||||
erledigt_am: Mapped[datetime | None] = mapped_column(TIMESTAMP(timezone=True))
|
||||
# Karte 12: Eskalationsstufen-Tracking, damit dieselbe Stufe nicht bei jedem
|
||||
# Prüflauf erneut verschickt wird (NULL = Stufe noch nicht ausgelöst).
|
||||
erinnerung_gesendet_am: Mapped[datetime | None] = mapped_column(TIMESTAMP(timezone=True))
|
||||
eskalation_gesendet_am: Mapped[datetime | None] = mapped_column(TIMESTAMP(timezone=True))
|
||||
|
||||
Reference in New Issue
Block a user