Phase 6: Update database layer identifier documentation
- Updated AnimeSeries model docstring to clarify key is primary identifier - Updated folder field to indicate metadata-only usage - Updated AnimeSeriesService docstring and get_by_key method - Updated infrastructure.md with database identifier documentation - All 996 tests passing
This commit is contained in:
@@ -43,6 +43,11 @@ class AnimeSeriesService:
|
||||
|
||||
Provides methods for creating, reading, updating, and deleting anime series
|
||||
with support for both async and sync database sessions.
|
||||
|
||||
Series Identifier Convention:
|
||||
- Use `get_by_key()` for lookups by provider key (primary identifier)
|
||||
- Use `get_by_id()` for lookups by database primary key (internal)
|
||||
- Never use `folder` for identification - it's metadata only
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
@@ -115,12 +120,19 @@ class AnimeSeriesService:
|
||||
async def get_by_key(db: AsyncSession, key: str) -> Optional[AnimeSeries]:
|
||||
"""Get anime series by provider key.
|
||||
|
||||
This is the PRIMARY lookup method for series identification.
|
||||
Use this method instead of get_by_id() when looking up by
|
||||
the provider-assigned unique key.
|
||||
|
||||
Args:
|
||||
db: Database session
|
||||
key: Unique provider key
|
||||
key: Unique provider key (e.g., "attack-on-titan")
|
||||
|
||||
Returns:
|
||||
AnimeSeries instance or None if not found
|
||||
|
||||
Note:
|
||||
Do NOT use folder for lookups - it's metadata only.
|
||||
"""
|
||||
result = await db.execute(
|
||||
select(AnimeSeries).where(AnimeSeries.key == key)
|
||||
|
||||
Reference in New Issue
Block a user