diff --git a/api/web_routes.py b/api/web_routes.py index 302352f..decdd65 100644 --- a/api/web_routes.py +++ b/api/web_routes.py @@ -1213,4 +1213,65 @@ async def get_episode_date_options(dependencies: dict, imdb_id: str, season: int "episode": episode, "current_data": episode_data, "options": options - } \ No newline at end of file + } + + +def register_web_routes(app, dependencies): + """Register all web API routes with FastAPI app""" + + # Dashboard and stats endpoints + @app.get("/api/dashboard/stats") + async def api_dashboard_stats(): + return await get_dashboard_stats(dependencies) + + # Movies endpoints + @app.get("/api/movies") + async def api_movies_list(skip: int = 0, limit: int = 100, has_date: bool = None, + source_filter: str = None, search: str = None, imdb_search: str = None): + return await get_movies_list(dependencies, skip, limit, has_date, source_filter, search, imdb_search) + + @app.post("/api/movies/{imdb_id}/update-date") + async def api_update_movie_date(imdb_id: str, dateadded: str = None, source: str = "manual"): + return await update_movie_date(dependencies, imdb_id, dateadded, source) + + @app.get("/api/movies/{imdb_id}/date-options") + async def api_movie_date_options(imdb_id: str): + return await get_movie_date_options(dependencies, imdb_id) + + # TV series endpoints + @app.get("/api/series") + async def api_series_list(skip: int = 0, limit: int = 50, search: str = None, + imdb_search: str = None, date_filter: str = None, source_filter: str = None): + return await get_tv_series_list(dependencies, skip, limit, search, imdb_search, date_filter, source_filter) + + @app.get("/api/series/{imdb_id}/episodes") + async def api_series_episodes(imdb_id: str): + return await get_series_episodes(dependencies, imdb_id) + + @app.get("/api/series/sources") + async def api_series_sources(): + return await get_series_sources(dependencies) + + @app.get("/api/series/debug/date-distribution") + async def api_debug_series_date_distribution(): + return await debug_series_date_distribution(dependencies) + + # Episode endpoints + @app.post("/api/episodes/{imdb_id}/{season}/{episode}/update-date") + async def api_update_episode_date(imdb_id: str, season: int, episode: int, + dateadded: str = None, source: str = "manual"): + return await update_episode_date(dependencies, imdb_id, season, episode, dateadded, source) + + @app.get("/api/episodes/{imdb_id}/{season}/{episode}/date-options") + async def api_episode_date_options(imdb_id: str, season: int, episode: int): + return await get_episode_date_options(dependencies, imdb_id, season, episode) + + # Bulk operations + @app.post("/api/bulk/update-source") + async def api_bulk_update_source(media_type: str, old_source: str, new_source: str): + return await bulk_update_source(dependencies, media_type, old_source, new_source) + + # Reports + @app.get("/api/reports/missing-dates") + async def api_missing_dates_report(): + return await get_missing_dates_report(dependencies) \ No newline at end of file