Neue Tabelle person (Migration 0034, Backfill bestehender Benutzer 1:1 per Zeilennummer, keine Datenverluste). Benutzer.person_id optional - Login kann bestehende Person verknüpfen oder legt automatisch eine neue an (Rückwärtskompatibilität zum bisherigen Anlegen-Flow). /personen-CRUD (admin-only), neue PersonSection.tsx im Personal-Tab, BenutzerSection um Personen-Auswahl erweitert. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CVgbozhYmuEhiEJHffRXCV
112 lines
2.6 KiB
Python
112 lines
2.6 KiB
Python
import uuid
|
|
from datetime import date
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
from app.models.personal import Qualifikationskategorie
|
|
|
|
|
|
class PersonCreate(BaseModel):
|
|
name: str
|
|
geburtsdatum: date | None = None
|
|
kontakt: str | None = None
|
|
|
|
|
|
class PersonRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
name: str
|
|
geburtsdatum: date | None
|
|
kontakt: str | None
|
|
|
|
|
|
class PersonUpdate(BaseModel):
|
|
name: str | None = None
|
|
geburtsdatum: date | None = None
|
|
kontakt: str | None = None
|
|
|
|
|
|
class EinheitCreate(BaseModel):
|
|
name: str
|
|
uebergeordnete_einheit_id: int | None = None
|
|
standort_id: int | None = None
|
|
|
|
|
|
class EinheitRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
name: str
|
|
uebergeordnete_einheit_id: int | None
|
|
standort_id: int | None
|
|
|
|
|
|
class EinheitUpdate(BaseModel):
|
|
name: str | None = None
|
|
uebergeordnete_einheit_id: int | None = None
|
|
standort_id: int | None = None
|
|
|
|
|
|
class EinsatzfunktionCreate(BaseModel):
|
|
name: str
|
|
|
|
|
|
class EinsatzfunktionRead(EinsatzfunktionCreate):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
|
|
|
|
class QualifikationstypCreate(BaseModel):
|
|
name: str
|
|
kategorie: Qualifikationskategorie
|
|
gueltigkeit_monate: int | None = None
|
|
|
|
|
|
class QualifikationstypRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
name: str
|
|
kategorie: Qualifikationskategorie
|
|
gueltigkeit_monate: int | None
|
|
|
|
|
|
class QualifikationstypUpdate(BaseModel):
|
|
name: str | None = None
|
|
kategorie: Qualifikationskategorie | None = None
|
|
gueltigkeit_monate: int | None = None
|
|
|
|
|
|
class BenutzerQualifikationCreate(BaseModel):
|
|
benutzer_id: int
|
|
qualifikationstyp_id: int
|
|
erworben_am: date
|
|
gueltig_bis: date | None = None
|
|
nachweis_nummer: str | None = None
|
|
|
|
|
|
class BenutzerQualifikationRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: uuid.UUID
|
|
benutzer_id: int
|
|
qualifikationstyp_id: int
|
|
erworben_am: date
|
|
gueltig_bis: date | None
|
|
nachweis_nummer: str | None
|
|
|
|
|
|
class ObjekttypQualifikationsanforderungCreate(BaseModel):
|
|
objekttyp_id: int
|
|
qualifikationstyp_id: int
|
|
|
|
|
|
class ObjekttypQualifikationsanforderungRead(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
objekttyp_id: int
|
|
qualifikationstyp_id: int
|
|
|
|
|
|
class BerechtigungspruefungRead(BaseModel):
|
|
"""Antwort auf "darf Benutzer X Objekt Y bedienen/fahren?" (Nutzer-Beispiel)."""
|
|
|
|
berechtigt: bool
|
|
fehlende_qualifikationstypen: list[QualifikationstypRead]
|