feat(database): Implement comprehensive database service layer
Implemented database service layer with CRUD operations for all models: - AnimeSeriesService: Create, read, update, delete, search anime series - EpisodeService: Episode management and download tracking - DownloadQueueService: Priority-based queue with status tracking - UserSessionService: Session management with JWT support Features: - Repository pattern for clean separation of concerns - Full async/await support for non-blocking operations - Comprehensive type hints and docstrings - Transaction management via FastAPI dependency injection - Priority queue ordering (HIGH > NORMAL > LOW) - Automatic timestamp management - Cascade delete support Testing: - 22 comprehensive unit tests with 100% pass rate - In-memory SQLite for isolated testing - All CRUD operations tested Documentation: - Enhanced database README with service examples - Integration examples in examples.py - Updated infrastructure.md with service details - Migration utilities for schema management Files: - src/server/database/service.py (968 lines) - src/server/database/examples.py (467 lines) - tests/unit/test_database_service.py (22 tests) - src/server/database/migrations.py (enhanced) - src/server/database/__init__.py (exports added) Closes #9 - Database Layer: Create database service
This commit is contained in:
@@ -29,6 +29,12 @@ from src.server.database.models import (
|
||||
Episode,
|
||||
UserSession,
|
||||
)
|
||||
from src.server.database.service import (
|
||||
AnimeSeriesService,
|
||||
DownloadQueueService,
|
||||
EpisodeService,
|
||||
UserSessionService,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"Base",
|
||||
@@ -39,4 +45,8 @@ __all__ = [
|
||||
"Episode",
|
||||
"DownloadQueueItem",
|
||||
"UserSession",
|
||||
"AnimeSeriesService",
|
||||
"EpisodeService",
|
||||
"DownloadQueueService",
|
||||
"UserSessionService",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user