Complete Task 8: Database Support for NFO Status
- Added 5 NFO tracking fields to AnimeSeries model - Fields: has_nfo, nfo_created_at, nfo_updated_at, tmdb_id, tvdb_id - Added 3 service methods to AnimeService for NFO operations - Methods: update_nfo_status, get_series_without_nfo, get_nfo_statistics - SQLAlchemy auto-migration (no manual migration needed) - Backward compatible with existing data - 15 new tests added (19/19 passing) - Tests: database models, service methods, integration queries
This commit is contained in:
@@ -78,6 +78,28 @@ class AnimeSeries(Base, TimestampMixin):
|
||||
doc="Release year of the series"
|
||||
)
|
||||
|
||||
# NFO metadata tracking
|
||||
has_nfo: Mapped[bool] = mapped_column(
|
||||
Boolean, nullable=False, default=False, server_default="0",
|
||||
doc="Whether tvshow.nfo file exists for this series"
|
||||
)
|
||||
nfo_created_at: Mapped[Optional[datetime]] = mapped_column(
|
||||
DateTime(timezone=True), nullable=True,
|
||||
doc="Timestamp when NFO was first created"
|
||||
)
|
||||
nfo_updated_at: Mapped[Optional[datetime]] = mapped_column(
|
||||
DateTime(timezone=True), nullable=True,
|
||||
doc="Timestamp when NFO was last updated"
|
||||
)
|
||||
tmdb_id: Mapped[Optional[int]] = mapped_column(
|
||||
Integer, nullable=True, index=True,
|
||||
doc="TMDB (The Movie Database) ID for series metadata"
|
||||
)
|
||||
tvdb_id: Mapped[Optional[int]] = mapped_column(
|
||||
Integer, nullable=True, index=True,
|
||||
doc="TVDB (TheTVDB) ID for series metadata"
|
||||
)
|
||||
|
||||
# Relationships
|
||||
episodes: Mapped[List["Episode"]] = relationship(
|
||||
"Episode",
|
||||
@@ -127,7 +149,10 @@ class AnimeSeries(Base, TimestampMixin):
|
||||
return value.strip()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"<AnimeSeries(id={self.id}, key='{self.key}', name='{self.name}')>"
|
||||
return (
|
||||
f"<AnimeSeries(id={self.id}, key='{self.key}', "
|
||||
f"name='{self.name}')>"
|
||||
)
|
||||
|
||||
|
||||
class Episode(Base, TimestampMixin):
|
||||
|
||||
Reference in New Issue
Block a user