feat(personal): PERS-004 Einsatzfunktionen (Gruppenführer/Melder/...)
CI / backend-tests (push) Successful in 2m17s
CI / frontend-build (push) Successful in 26s

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
This commit is contained in:
2026-09-08 20:07:16 +02:00
co-authored by Claude Sonnet 5
parent b7d9581b90
commit 15f783fb5e
12 changed files with 228 additions and 7 deletions
+45
View File
@@ -139,6 +139,51 @@ async def test_benutzer_einheit_zuordnung(client, admin_user):
assert geloest.json()["einheit_id"] is None
@pytest.mark.asyncio
async def test_einsatzfunktion_anlegen_und_benutzer_zuordnen(client, admin_user):
"""PERS-004: Einsatzfunktion unabhängig von der technischen App-Rolle."""
token = await login(client, "admin1")
funktion = await client.post(
"/api/v1/einsatzfunktionen", json={"name": "Gruppenführer"}, headers=auth_header(token)
)
assert funktion.status_code == 201
funktion_id = funktion.json()["id"]
duplikat = await client.post(
"/api/v1/einsatzfunktionen", json={"name": "Gruppenführer"}, headers=auth_header(token)
)
assert duplikat.status_code == 409
benutzer = await client.post(
"/api/v1/benutzer",
json={
"name": "Neuer Gruppenführer",
"login": "gf1",
"passwort": "test-passwort-123",
"einsatzfunktion_id": funktion_id,
},
headers=auth_header(token),
)
assert benutzer.status_code == 201
assert benutzer.json()["einsatzfunktion_id"] == funktion_id
benutzer_id = benutzer.json()["id"]
geloest = await client.patch(
f"/api/v1/benutzer/{benutzer_id}", json={"einsatzfunktion_id": None}, headers=auth_header(token)
)
assert geloest.json()["einsatzfunktion_id"] is None
@pytest.mark.asyncio
async def test_mitarbeiter_darf_einsatzfunktion_nicht_anlegen(client, mitarbeiter_user):
token = await login(client, "mitarbeiter1")
response = await client.post(
"/api/v1/einsatzfunktionen", json={"name": "Melder"}, headers=auth_header(token)
)
assert response.status_code == 403
@pytest.mark.asyncio
async def test_bald_ablaufende_qualifikation_erscheint_im_dashboard(
client, admin_user, mitarbeiter_user