Neue Stammdaten-Tabelle einsatzfunktion (Migration 0031), benutzer bekommt optionales einsatzfunktion_id-Feld - analog zu einheit_id modelliert, eine Person hat im Regelfall genau eine primäre Einsatzfunktion. Bewusst getrennt von den technischen App-Rollen (RolleTyp), die nur steuern, was jemand in MABEA tun darf, nicht welche Funktion er im Einsatz hat. CRUD-Endpunkt /einsatzfunktionen nach Kategorie-Muster, Duplikat-Prüfung vorab (Projekt-Konvention). Admin-UI: Auswahl + Inline-Neuanlage in der Benutzerverwaltung (BenutzerSection). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CVgbozhYmuEhiEJHffRXCV
92 lines
2.2 KiB
Python
92 lines
2.2 KiB
Python
import uuid
|
|
from datetime import date
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
from app.models.personal import Qualifikationskategorie
|
|
|
|
|
|
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]
|