Skip to content

feat(admin): implement dashboard stats API#57

Merged
ademboukabes merged 1 commit into
developfrom
feature/admin-dashboard-stats
Jun 30, 2026
Merged

feat(admin): implement dashboard stats API#57
ademboukabes merged 1 commit into
developfrom
feature/admin-dashboard-stats

Conversation

@ademboukabes

Copy link
Copy Markdown
Collaborator

Description

This PR implements the necessary API endpoints to power the Admin Dashboard with real-time statistics instead of hardcoded data.

Features

Added 4 protected endpoints under /admin/stats/:

  • GET /dashboard: Returns global KPIs (active events, unread alerts, total photos uploaded).
  • GET /processing-load: Calculates AI pipeline load.
  • GET /storage: Calculates S3/MinIO actual storage consumption.
  • GET /alerts: Returns the 10 most recent notifications for the admin.

Technical Details

  • Added stats.sql and generated the Python AsyncQuerier.
  • Implemented StatsService for business logic and aggregations.
  • Added Pydantic response schemas.
  • Added E2E integration test (tests/e2e/test_stats_endpoint.py).
  • Fixed a pre-existing typing bug in photo_approval.py.

Testing

  • Ruff linting passed
  • Mypy type-checking passed
  • E2E Pytest passed

- Add stats SQL queries for dashboard KPIs, processing load, and storage

- Generate sqlc python queriers

- Create StatsService for business logic and aggregations

- Add 4 new endpoints in web/stats router

- Fix photo_approval typing bug

- Add e2e integration test for stats api
@ademboukabes ademboukabes merged commit de47e92 into develop Jun 30, 2026
1 check passed
@ademboukabes ademboukabes deleted the feature/admin-dashboard-stats branch June 30, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant