Luca Sacchi Ricciardi
c1f47c897f
feat(frontend): T44 setup FastAPI static files and templates
...
- Mount static files on /static endpoint
- Configure Jinja2Templates with directory structure
- Create base template with Pico.css, HTMX, Chart.js
- Create all template subdirectories (auth, dashboard, keys, tokens, profile, components)
- Create initial CSS and JS files
- Add tests for static files and templates configuration
Tests: 12 passing
Coverage: 100% on new configuration code
2026-04-07 17:58:03 +02:00
Luca Sacchi Ricciardi
3ae5d736ce
feat(tasks): T55-T58 implement background tasks for OpenRouter sync
...
- T55: Setup APScheduler with AsyncIOScheduler and @scheduled_job decorator
- T56: Implement hourly usage stats sync from OpenRouter API
- T57: Implement daily API key validation job
- T58: Implement weekly cleanup job for old usage stats
- Add usage_stats_retention_days config option
- Integrate scheduler with FastAPI lifespan events
- Add 26 unit tests for scheduler, sync, and cleanup tasks
- Add apscheduler to requirements.txt
The background tasks now automatically:
- Sync usage stats every hour from OpenRouter
- Validate API keys daily at 2 AM UTC
- Clean up old data weekly on Sunday at 3 AM UTC
2026-04-07 17:41:24 +02:00
Luca Sacchi Ricciardi
0df1638da8
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
2026-04-07 15:04:49 +02:00
Luca Sacchi Ricciardi
2e4c1bb1e5
feat(schemas): T23 add Pydantic API key schemas
...
- Add ApiKeyCreate schema with OpenRouter key format validation
- Add ApiKeyUpdate schema for partial updates
- Add ApiKeyResponse schema (excludes key value for security)
- Add ApiKeyListResponse schema for pagination
- Export schemas from __init__.py
- 100% coverage on new module (23 tests)
Refs: T23
2026-04-07 14:28:03 +02:00
Luca Sacchi Ricciardi
02473bc39e
feat(schemas): T17 add Pydantic auth schemas
...
Add authentication schemas for user registration and login:
- UserRegister: email, password (with strength validation), password_confirm
- UserLogin: email, password
- UserResponse: id, email, created_at, is_active (orm_mode=True)
- TokenResponse: access_token, token_type, expires_in
- TokenData: user_id, exp
Includes field validators for password strength and password confirmation matching.
Test coverage: 19 tests for all schemas
2026-04-07 13:52:33 +02:00
Luca Sacchi Ricciardi
2fdd9d16fd
feat(security): T12 implement AES-256 encryption service
...
- Add EncryptionService with AES-256-GCM via cryptography.fernet
- Implement PBKDF2HMAC key derivation with SHA256 (100k iterations)
- Deterministic salt derived from master_key for consistency
- Methods: encrypt(), decrypt() with proper error handling
- 12 comprehensive tests with 100% coverage
- Handle InvalidToken, TypeError edge cases
2026-04-07 12:03:45 +02:00
Luca Sacchi Ricciardi
60d9228d91
feat(db): T06 create database connection and session management
...
- Add database.py with SQLAlchemy engine and session
- Implement get_db() for FastAPI dependency injection
- Implement init_db() for table creation
- Use SQLAlchemy 2.0 declarative_base() syntax
- Add comprehensive tests with 100% coverage
Tests: 11 passed, 100% coverage
2026-04-07 10:53:13 +02:00
Luca Sacchi Ricciardi
75f40acb17
feat(setup): T01 create project directory structure
...
- Create src/openrouter_monitor/ package structure
- Create models/, routers/, services/, utils/ subpackages
- Create tests/unit/ and tests/integration/ structure
- Create alembic/, docs/, scripts/ directories
- Add test_project_structure.py with 13 unit tests
- All tests passing (13/13)
Refs: T01
2026-04-07 09:44:41 +02:00