feat(mangel): Leitungsverantwortliche dürfen Mangel-Status ändern/erledigen
Nutzer-Entscheidung: Status ändern/Erledigen bleibt nicht nur Materialverant- wortlichen+Admin vorbehalten, Leitungsverantwortliche gehören ebenfalls dazu. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KC8HYvv6UkCVYheYiTw9DD
This commit is contained in:
@@ -4019,3 +4019,35 @@ Keine Commits in dieser Session.
|
||||
- frontend/src/pages/admin/ObjektSection.tsx | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
|
||||
---
|
||||
## 2026-09-05 13:36 – 13:39 (2m)
|
||||
**Beschreibung:** Claude Code Session
|
||||
**Projekt:** asb-material
|
||||
|
||||
### Commits
|
||||
- e9904d5 feat(dashboard): drei fehlende Kacheln (Kennzahlen, Mängel, Qualifikationsablauf)
|
||||
|
||||
### Geänderte Dateien
|
||||
- DEVLOG.md | 22 ++++++++++++++++
|
||||
- backend/app/api/v1/endpoints/dashboard.py | 13 ++++++++++
|
||||
- backend/app/schemas/dashboard.py | 14 ++++++++++
|
||||
- backend/app/services/dashboard.py | 35 +++++++++++++++++++++++++
|
||||
- backend/tests/test_personal.py | 59 ++++++++++++++++++++++++++++++++++++++++++
|
||||
- frontend/src/pages/DashboardPage.tsx | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
|
||||
---
|
||||
## 2026-09-05 13:41 – 13:41 (0m)
|
||||
**Beschreibung:** Claude Code Session
|
||||
**Projekt:** asb-material
|
||||
|
||||
### Commits
|
||||
Keine Commits in dieser Session.
|
||||
|
||||
### Geänderte Dateien
|
||||
- DEVLOG.md | 22 ++++++++++++++++
|
||||
- backend/app/api/v1/endpoints/dashboard.py | 13 ++++++++++
|
||||
- backend/app/schemas/dashboard.py | 14 ++++++++++
|
||||
- backend/app/services/dashboard.py | 35 +++++++++++++++++++++++++
|
||||
- backend/tests/test_personal.py | 59 ++++++++++++++++++++++++++++++++++++++++++
|
||||
- frontend/src/pages/DashboardPage.tsx | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
|
||||
---
|
||||
|
||||
@@ -21,7 +21,9 @@ _mitarbeiter_plus = require_roles(
|
||||
RolleTyp.leitungsverantwortlicher,
|
||||
RolleTyp.administration,
|
||||
)
|
||||
_materialverantwortliche = require_roles(RolleTyp.administration, RolleTyp.materialverantwortlicher)
|
||||
_materialverantwortliche = require_roles(
|
||||
RolleTyp.administration, RolleTyp.materialverantwortlicher, RolleTyp.leitungsverantwortlicher
|
||||
)
|
||||
|
||||
|
||||
@router.get("/maengel", response_model=list[MangelRead])
|
||||
|
||||
@@ -113,3 +113,33 @@ async def test_niedrige_prioritaet_blockiert_einsatzbereitschaft_nicht(
|
||||
"/api/v1/dashboard/einsatzbereitschaft", headers=auth_header(verantwortlicher_token)
|
||||
)
|
||||
assert response.json()["einsatzbereit"] == 1
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_leitungsverantwortlicher_kann_status_aendern(client, objekt_mit_position, mitarbeiter_user, db_session):
|
||||
from app.core.security import hash_password
|
||||
from app.models.auth import Benutzer, BenutzerRolle, RolleTyp
|
||||
|
||||
benutzer = Benutzer(
|
||||
name="Test Leitung", login="leitung1", passwort_hash=hash_password("test-passwort-123"), aktiv=True
|
||||
)
|
||||
db_session.add(benutzer)
|
||||
await db_session.flush()
|
||||
db_session.add(BenutzerRolle(benutzer_id=benutzer.id, rolle=RolleTyp.leitungsverantwortlicher))
|
||||
await db_session.flush()
|
||||
|
||||
objekt, _material = objekt_mit_position
|
||||
mitarbeiter_token = await login(client, "mitarbeiter1")
|
||||
gemeldet = await client.post(
|
||||
"/api/v1/maengel",
|
||||
json={"objekt_id": objekt.id, "beschreibung": "Scheinwerfer defekt"},
|
||||
headers=auth_header(mitarbeiter_token),
|
||||
)
|
||||
mangel_id = gemeldet.json()["id"]
|
||||
|
||||
leitung_token = await login(client, "leitung1")
|
||||
response = await client.patch(
|
||||
f"/api/v1/maengel/{mangel_id}", json={"status": "erledigt"}, headers=auth_header(leitung_token)
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert response.json()["status"] == "erledigt"
|
||||
|
||||
@@ -24,8 +24,8 @@ const STATUS_OPTIONEN: MangelStatus[] = [
|
||||
// Erledigung verfolgen - jeder Mitarbeiter darf melden/lesen, Status ändern
|
||||
// bleibt Materialverantwortlichen+ vorbehalten (Backend erzwingt das).
|
||||
export function MangelListePage() {
|
||||
const { istMaterialverantwortlich, istAdmin } = useAuth();
|
||||
const darfStatusAendern = istMaterialverantwortlich || istAdmin;
|
||||
const { istMaterialverantwortlich, istLeitungsverantwortlich, istAdmin } = useAuth();
|
||||
const darfStatusAendern = istMaterialverantwortlich || istLeitungsverantwortlich || istAdmin;
|
||||
|
||||
const [maengel, setMaengel] = useState<Mangel[]>([]);
|
||||
const [objekte, setObjekte] = useState<Objekt[]>([]);
|
||||
|
||||
Reference in New Issue
Block a user