feat(models): T07-T10 create SQLAlchemy models for User, ApiKey, UsageStats, ApiToken
- Add User model with email unique constraint and relationships - Add ApiKey model with encrypted key storage and user relationship - Add UsageStats model with unique constraint (api_key_id, date, model) - Add ApiToken model with token_hash indexing - Configure all cascade delete relationships - Add 49 comprehensive tests with 95% coverage Models: - User: id, email, password_hash, created_at, updated_at, is_active - ApiKey: id, user_id, name, key_encrypted, is_active, created_at, last_used_at - UsageStats: id, api_key_id, date, model, requests_count, tokens_input, tokens_output, cost - ApiToken: id, user_id, token_hash, name, created_at, last_used_at, is_active Tests: 49 passed, coverage 95%
This commit is contained in:
@@ -44,13 +44,13 @@
|
||||
- [x] T04: Setup file configurazione (.env, config.py) (2024-04-07)
|
||||
- [x] T05: Configurare pytest e struttura test (2024-04-07)
|
||||
|
||||
### 🗄️ Database & Models (T06-T11) - 1/6 completati
|
||||
### 🗄️ Database & Models (T06-T11) - 5/6 completati
|
||||
- [x] T06: Creare database.py (connection & session) - ✅ Completato (2026-04-07 11:00)
|
||||
- [ ] T07: Creare model User (SQLAlchemy) - 🟡 In progress
|
||||
- [ ] T08: Creare model ApiKey (SQLAlchemy)
|
||||
- [ ] T09: Creare model UsageStats (SQLAlchemy)
|
||||
- [ ] T10: Creare model ApiToken (SQLAlchemy)
|
||||
- [ ] T11: Setup Alembic e creare migrazione iniziale
|
||||
- [x] T07: Creare model User (SQLAlchemy) - ✅ Completato (2026-04-07 11:15)
|
||||
- [x] T08: Creare model ApiKey (SQLAlchemy) - ✅ Completato (2026-04-07 11:15)
|
||||
- [x] T09: Creare model UsageStats (SQLAlchemy) - ✅ Completato (2026-04-07 11:15)
|
||||
- [x] T10: Creare model ApiToken (SQLAlchemy) - ✅ Completato (2026-04-07 11:15)
|
||||
- [ ] T11: Setup Alembic e creare migrazione iniziale - 🟡 In progress
|
||||
|
||||
### 🔐 Servizi di Sicurezza (T12-T16) - 0/5 completati
|
||||
- [ ] T12: Implementare EncryptionService (AES-256)
|
||||
|
||||
Reference in New Issue
Block a user