feat: complete moderation history dashboard
This commit is contained in:
@@ -162,6 +162,29 @@ def admin_moderation_history(
|
||||
return history[offset:offset + limit]
|
||||
|
||||
|
||||
@app.get("/api/v1/admin/moderation-history-export")
|
||||
def admin_moderation_history_export(
|
||||
db: Db,
|
||||
_: Annotated[str, Depends(_admin)],
|
||||
limit: int = Query(1000, ge=1, le=5000),
|
||||
) -> JSONResponse:
|
||||
"""Return an anonymized, analysis-safe decision export."""
|
||||
events = admin_moderation_history(db, _, limit=limit, offset=0)
|
||||
payload = {
|
||||
"generated_at": datetime.now(timezone.utc).isoformat(),
|
||||
"count": len(events),
|
||||
"events": [{
|
||||
"entity_type": event.entity_type,
|
||||
"decided_at": event.decided_at.isoformat(),
|
||||
"action": event.action,
|
||||
"requires_confirmation": event.requires_confirmation,
|
||||
} for event in events],
|
||||
}
|
||||
return JSONResponse(payload, headers={
|
||||
"Content-Disposition": "attachment; filename=rf4spotter-moderation-history.json",
|
||||
})
|
||||
|
||||
|
||||
@app.get("/api/v1/admin/imports", response_model=list[ImportRunOut])
|
||||
def admin_imports(
|
||||
db: Db,
|
||||
|
||||
Reference in New Issue
Block a user