Phase 4: API Endpoint

- Add RandomNumberOutcomeResponse schema to schemas.py
- Add GET /api/audit/random-jobs endpoint to routes/audit.py
- Returns list of outcomes (newest first, no pagination)
- Requires VIEW_AUDIT permission
- Add tests: admin can access, regular user forbidden, unauthenticated 401
This commit is contained in:
counterweight 2025-12-21 22:53:54 +01:00
parent 7beb213cf5
commit b3ed81e8fd
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
3 changed files with 71 additions and 1 deletions

View file

@ -257,6 +257,24 @@ class AppointmentResponse(BaseModel):
PaginatedAppointments = PaginatedResponse[AppointmentResponse]
# =============================================================================
# Random Number Job Schemas
# =============================================================================
class RandomNumberOutcomeResponse(BaseModel):
"""Response model for a random number job outcome."""
id: int
job_id: int
triggered_by_user_id: int
triggered_by_email: str
value: int
duration_ms: int
status: str
created_at: datetime
# =============================================================================
# Meta/Constants Schemas
# =============================================================================