feat: agent-11 PR1 – Vertretung, Storno-Re-Genehmigung, Kommentare
Abwesenheits-Modul abgerundet (Feature-Parität mit Urlaubsverwaltung):
- Vertretung: Overlap-Warnung beim Anlegen, E-Mail an Vertretung bei
Genehmigung, GET /absences/?as_substitute=true, neuer schlanker
GET /users/colleagues (alle Rollen, RLS-gefenced) für die Auswahl;
Vertreter-Dropdown + Anzeige in der Liste.
- Stornierung mit Re-Genehmigung: neuer Status CANCELLATION_REQUESTED,
POST /absences/{id}/request-cancellation; Manager genehmigt/lehnt über
bestehende approve/reject ab (Urlaub + FZA-Rückbuchung via _apply_cancellation).
- Kommentare: Model AbsenceComment (company_id-RLS), GET/POST comments,
System-Kommentare bei Statuswechsel, AbsenceCommentsModal.
- Fix: CalDAV fire-and-forget nutzte die Request-Session weiter (in Tests
geteilt -> "another operation in progress"); jetzt sync_*_bg mit eigener
Session + RLS-Bypass.
Migration 0035. 178/178 Tests grün. Deployed auf 137 + 164.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,27 @@ async def invite_user(
|
||||
return UserOut.model_validate(user)
|
||||
|
||||
|
||||
@router.get("/colleagues")
|
||||
async def list_colleagues(
|
||||
current_user: CurrentUser,
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
"""Schlanke Kollegenliste (id + Name) für alle Mitarbeiter – z.B. zur
|
||||
Vertreter-Auswahl. Nur aktive User der eigenen Firma (RLS-gefenced),
|
||||
ohne sensible Felder."""
|
||||
from sqlalchemy import select
|
||||
rows = await db.scalars(
|
||||
select(User)
|
||||
.where(
|
||||
User.company_id == current_user.company_id,
|
||||
User.is_active.is_(True),
|
||||
User.id != current_user.id,
|
||||
)
|
||||
.order_by(User.last_name, User.first_name)
|
||||
)
|
||||
return [{"id": str(u.id), "full_name": u.full_name} for u in rows.all()]
|
||||
|
||||
|
||||
@router.get("/me", response_model=UserOut)
|
||||
async def get_me(current_user: CurrentUser):
|
||||
return UserOut.model_validate(current_user)
|
||||
|
||||
Reference in New Issue
Block a user