feat(identity): IDENT-005 Hersteller/Modell-Stammdaten
CI / backend-tests (push) Failing after 2m16s
CI / frontend-build (push) Successful in 26s

Neue Tabellen hersteller/modell (Migration 0030), CRUD-Endpunkte
(/hersteller, /modelle) nach bestehendem Kategorie-Muster, inkl. 409 bei
Duplikaten (IntegrityError abgefangen wie in personal.py). geraet_instanz
bekommt optionales modell_id-Feld - verknüpft eine konkrete Geräteinstanz
(mit Seriennummer, IDENT-004) mit ihrem Hersteller/Modell.

Ergänzt Material.hersteller (bleibt unverändert als Freitext) um eine
normalisierte Variante gezielt für Geräte mit Seriennummer - keine
Datenmigration bestehender Freitext-Werte (Scope dieser Kachel).

Bewusst kein neues Admin-UI-Screen für die Pflege (Scope-Grenze der
Kachel) - Hersteller/Modell aktuell nur über die API verwaltbar.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CVgbozhYmuEhiEJHffRXCV
This commit is contained in:
2026-09-08 14:51:15 +02:00
co-authored by Claude Sonnet 5
parent ae09433c11
commit 2dd7e574e6
12 changed files with 249 additions and 6 deletions
+23 -1
View File
@@ -1,6 +1,6 @@
import enum
from sqlalchemy import Boolean, ForeignKey, String, Text
from sqlalchemy import Boolean, ForeignKey, String, Text, UniqueConstraint
from sqlalchemy.dialects.postgresql import ENUM as PgEnum
from sqlalchemy.orm import Mapped, mapped_column
@@ -67,6 +67,28 @@ class Fach(Base):
sortierung: Mapped[int] = mapped_column(default=0)
class Hersteller(Base):
"""IDENT-005: normalisierte Hersteller-Stammdaten statt Freitext - macht
Geräte/Fahrzeuge herstellerübergreifend auswertbar/filterbar (z.B. "alle
Weinmann-Geräte prüfpflichtig"). Ergänzt Material.hersteller (Freitext,
bleibt unverändert), betrifft hier gezielt Geräteinstanzen mit
Seriennummer (IDENT-004)."""
__tablename__ = "hersteller"
id: Mapped[int] = mapped_column(primary_key=True)
name: Mapped[str] = mapped_column(String, unique=True, nullable=False)
class Modell(Base):
__tablename__ = "modell"
__table_args__ = (UniqueConstraint("hersteller_id", "name"),)
id: Mapped[int] = mapped_column(primary_key=True)
hersteller_id: Mapped[int] = mapped_column(ForeignKey("hersteller.id"), nullable=False)
name: Mapped[str] = mapped_column(String, nullable=False)
class Material(Base):
__tablename__ = "material"