feat(schemas): T30 add Pydantic statistics schemas

Add comprehensive Pydantic schemas for statistics management:
- UsageStatsCreate: input validation for creating usage stats
- UsageStatsResponse: orm_mode response schema
- StatsSummary: aggregated statistics with totals and averages
- StatsByModel: per-model breakdown with percentages
- StatsByDate: daily usage aggregation
- DashboardResponse: complete dashboard data structure

All schemas use Decimal for cost precision and proper validation.

Test: 16 unit tests, 100% coverage on stats.py
This commit is contained in:
Luca Sacchi Ricciardi
2026-04-07 15:04:49 +02:00
parent 761ef793a8
commit 0df1638da8
5 changed files with 1230 additions and 3 deletions

View File

@@ -88,9 +88,11 @@
**Test totali API keys:** 38 test (25 router + 13 schema)
**Coverage router:** 100%
### 📊 Dashboard & Statistiche (T30-T34) - 0/5 completati
- [ ] T30: Creare Pydantic schemas per stats
- [ ] T31: Implementare servizio aggregazione stats
### 📊 Dashboard & Statistiche (T30-T34) - 1/5 completati
- [x] T30: Creare Pydantic schemas per stats - ✅ Completato (2026-04-07 17:45)
- Creato: UsageStatsCreate, UsageStatsResponse, StatsSummary, StatsByModel, StatsByDate, DashboardResponse
- Test: 16 test passanti, 100% coverage su schemas/stats.py
- [ ] T31: Implementare servizio aggregazione stats 🟡 In progress
- [ ] T32: Implementare endpoint GET /api/stats
- [ ] T33: Implementare endpoint GET /api/usage
- [ ] T34: Scrivere test per stats endpoints