Sprint 1: Stammdaten-Modelle/-Endpunkte, Admin-Benutzerverwaltung, Zuständigkeits-Vererbung (E2)
CI / backend-tests (push) Failing after 0s
CI / backend-tests (push) Failing after 0s
- ORM-Modelle: Bereich, Kategorie, Standort, Objekttyp, Material (Prompt 06/07),
minimales Objekt-Modell (voll ausgebaut erst Sprint 2), Zustaendigkeit/
Kontrollverantwortung
- Admin-API 7a: GET/POST Stammdaten-Endpunkte, PATCH Material, Benutzerverwaltung
(anlegen/Rollen ändern), Zuständigkeits-/Kontrollverantwortungs-CRUD
- Vererbungslogik E2 als eigener Service (app/services/zustaendigkeit.py):
Standort-Zuordnung vererbt sich auf alle Objekte, Objekt-Zeile ist Vereinigung
statt Ersatz - GET /zustaendigkeiten/benutzer/{id}/objekte exponiert das
- Tests: Stammdaten-CRUD + Rollenrechte, Benutzerverwaltung (inkl. 409 bei
Login-Duplikat), E2-Vererbungslogik (Standort-only, Standort+Objekt-Vereinigung,
End-to-End über den Endpunkt)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L85hmKbvX7Cqkq47KnQhFt
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import CheckConstraint, ForeignKey, String
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.db.base import Base
|
||||
|
||||
|
||||
class Zustaendigkeit(Base):
|
||||
"""Karte 04 / Sprintplan E2: Standort-Zuordnung vererbt sich auf alle Objekte
|
||||
am Standort, Objekt-Zeile ist feinere Ergänzung (Vereinigung, kein Ersatz).
|
||||
Siehe app/services/zustaendigkeit.py für die Auswertelogik."""
|
||||
|
||||
__tablename__ = "zustaendigkeit"
|
||||
__table_args__ = (
|
||||
CheckConstraint(
|
||||
"standort_id IS NOT NULL OR objekt_id IS NOT NULL",
|
||||
name="zustaendigkeit_standort_oder_objekt",
|
||||
),
|
||||
)
|
||||
|
||||
id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
benutzer_id: Mapped[int] = mapped_column(ForeignKey("benutzer.id"), nullable=False)
|
||||
standort_id: Mapped[int | None] = mapped_column(ForeignKey("standort.id"))
|
||||
objekt_id: Mapped[int | None] = mapped_column(ForeignKey("objekt.id"))
|
||||
|
||||
|
||||
class Kontrollverantwortung(Base):
|
||||
"""Karte 01 / Sprintplan E3: reine Sichtbarkeit/Priorisierung, keine Pflichtkontrolle."""
|
||||
|
||||
__tablename__ = "kontrollverantwortung"
|
||||
|
||||
id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
objekt_id: Mapped[int] = mapped_column(ForeignKey("objekt.id"), nullable=False)
|
||||
benutzer_id: Mapped[int | None] = mapped_column(ForeignKey("benutzer.id"))
|
||||
gruppe: Mapped[str | None] = mapped_column(String)
|
||||
Reference in New Issue
Block a user