Kontrollverantwortung im Frontend anbinden (Karte 01)
CI / backend-tests (push) Successful in 1m14s
CI / frontend-build (push) Successful in 23s

Backend: DELETE /kontrollverantwortung/{id} ergänzt (fehlte bisher). Frontend:
neuer Admin-Tab "Kontrollverantwortung" - Objekt + Benutzer/Gruppe zuordnen,
Liste, Entfernen. Reine Sichtbarkeit/Priorisierung, keine Pflichtkontrolle.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CVgbozhYmuEhiEJHffRXCV
This commit is contained in:
2026-09-04 20:22:32 +02:00
co-authored by Claude Sonnet 5
parent fbae3fccc7
commit c1f6eaa14c
7 changed files with 318 additions and 1 deletions
+16
View File
@@ -131,3 +131,19 @@ Keine Commits in dieser Session.
- frontend/src/pages/admin/EskalationSection.tsx | 127 +++++++++++++++++++++++++
---
## 2026-09-04 20:21 20:22 (1m)
**Beschreibung:** Claude Code Session
**Projekt:** asb-material
### Commits
Keine Commits in dieser Session.
### Geänderte Dateien
- DEVLOG.md | 30 +++++++++++
- backend/DEVLOG.md | 15 ++++++
- frontend/e2e/mockApi.ts | 10 ++++
- frontend/src/pages/KontrollPage.tsx | 78 ++++++++++++++++++++--------
- frontend/src/pages/kontrolle/types.ts | 4 ++
- frontend/src/pages/kontrolle/useKontrolle.ts | 13 +++--
---
@@ -87,3 +87,13 @@ async def erstelle_kontrollverantwortung(
db.add(kontrollverantwortung)
await db.flush()
return kontrollverantwortung
@router.delete("/kontrollverantwortung/{kontrollverantwortung_id}", status_code=status.HTTP_204_NO_CONTENT)
async def loesche_kontrollverantwortung(
kontrollverantwortung_id: uuid.UUID, db: AsyncSession = Depends(get_db), _=Depends(_verantwortliche)
) -> None:
kontrollverantwortung = await db.get(Kontrollverantwortung, kontrollverantwortung_id)
if kontrollverantwortung is None:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Kontrollverantwortung nicht gefunden")
await db.delete(kontrollverantwortung)
+45
View File
@@ -78,3 +78,48 @@ async def test_zustaendigkeit_braucht_standort_oder_objekt(client, admin_user, m
headers=auth_header(token),
)
assert response.status_code == 422
@pytest.mark.asyncio
async def test_kontrollverantwortung_anlegen_listen_loeschen(
client, standort_factory, objekt_factory, admin_user, mitarbeiter_user
):
standort = await standort_factory("Wache K")
objekt = await objekt_factory(name="Rucksack K", code="K1", standort=standort)
token = await login(client, "admin1")
erstellt = await client.post(
"/api/v1/kontrollverantwortung",
json={"objekt_id": objekt.id, "benutzer_id": mitarbeiter_user.id},
headers=auth_header(token),
)
assert erstellt.status_code == 201
eintrag_id = erstellt.json()["id"]
liste = await client.get("/api/v1/kontrollverantwortung", headers=auth_header(token))
assert liste.status_code == 200
assert any(e["id"] == eintrag_id for e in liste.json())
geloescht = await client.delete(
f"/api/v1/kontrollverantwortung/{eintrag_id}", headers=auth_header(token)
)
assert geloescht.status_code == 204
liste_danach = await client.get("/api/v1/kontrollverantwortung", headers=auth_header(token))
assert all(e["id"] != eintrag_id for e in liste_danach.json())
@pytest.mark.asyncio
async def test_kontrollverantwortung_braucht_benutzer_oder_gruppe(
client, standort_factory, objekt_factory, admin_user
):
standort = await standort_factory("Wache L")
objekt = await objekt_factory(name="Rucksack L", code="L1", standort=standort)
token = await login(client, "admin1")
response = await client.post(
"/api/v1/kontrollverantwortung",
json={"objekt_id": objekt.id},
headers=auth_header(token),
)
assert response.status_code == 422