fix: web routes

This commit is contained in:
2025-10-22 12:02:49 -04:00
committed by sbcrumb
parent 470d77c28f
commit b55b786787
2 changed files with 34 additions and 9 deletions
+27 -5
View File
@@ -1220,6 +1220,10 @@ def register_web_routes(app, dependencies):
"""Register all web API routes with FastAPI app""" """Register all web API routes with FastAPI app"""
# Dashboard and stats endpoints # Dashboard and stats endpoints
@app.get("/api/dashboard")
async def api_dashboard():
return await get_dashboard_stats(dependencies)
@app.get("/api/dashboard/stats") @app.get("/api/dashboard/stats")
async def api_dashboard_stats(): async def api_dashboard_stats():
return await get_dashboard_stats(dependencies) return await get_dashboard_stats(dependencies)
@@ -1232,11 +1236,15 @@ def register_web_routes(app, dependencies):
@app.post("/api/movies/{imdb_id}/update-date") @app.post("/api/movies/{imdb_id}/update-date")
async def api_update_movie_date(imdb_id: str, dateadded: str = None, source: str = "manual"): 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) return {"error": "Updates not available in web container. Use core container on port 8085."}
@app.put("/api/movies/{imdb_id}")
async def api_update_movie(imdb_id: str, dateadded: str = None, source: str = "manual"):
return {"error": "Updates not available in web container. Use core container on port 8085."}
@app.get("/api/movies/{imdb_id}/date-options") @app.get("/api/movies/{imdb_id}/date-options")
async def api_movie_date_options(imdb_id: str): async def api_movie_date_options(imdb_id: str):
return await get_movie_date_options(dependencies, imdb_id) return {"options": [], "message": "Date options not available in web container. Use core container on port 8085."}
# TV series endpoints # TV series endpoints
@app.get("/api/series") @app.get("/api/series")
@@ -1260,18 +1268,32 @@ def register_web_routes(app, dependencies):
@app.post("/api/episodes/{imdb_id}/{season}/{episode}/update-date") @app.post("/api/episodes/{imdb_id}/{season}/{episode}/update-date")
async def api_update_episode_date(imdb_id: str, season: int, episode: int, async def api_update_episode_date(imdb_id: str, season: int, episode: int,
dateadded: str = None, source: str = "manual"): dateadded: str = None, source: str = "manual"):
return await update_episode_date(dependencies, imdb_id, season, episode, dateadded, source) return {"error": "Updates not available in web container. Use core container on port 8085."}
@app.put("/api/episodes/{imdb_id}/{season}/{episode}")
async def api_update_episode(imdb_id: str, season: int, episode: int,
dateadded: str = None, source: str = "manual"):
return {"error": "Updates not available in web container. Use core container on port 8085."}
@app.get("/api/episodes/{imdb_id}/{season}/{episode}/date-options") @app.get("/api/episodes/{imdb_id}/{season}/{episode}/date-options")
async def api_episode_date_options(imdb_id: str, season: int, episode: int): async def api_episode_date_options(imdb_id: str, season: int, episode: int):
return await get_episode_date_options(dependencies, imdb_id, season, episode) return {"options": [], "message": "Date options not available in web container. Use core container on port 8085."}
# Bulk operations # Bulk operations
@app.post("/api/bulk/update-source") @app.post("/api/bulk/update-source")
async def api_bulk_update_source(media_type: str, old_source: str, new_source: str): 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) return {"error": "Bulk operations not available in web container. Use core container on port 8085."}
# Reports # Reports
@app.get("/api/reports/missing-dates") @app.get("/api/reports/missing-dates")
async def api_missing_dates_report(): async def api_missing_dates_report():
return await get_missing_dates_report(dependencies) return await get_missing_dates_report(dependencies)
# Authentication endpoints (for web interface compatibility)
@app.get("/api/auth/status")
async def api_auth_status():
return {"authenticated": False, "username": None} # Simplified for now
@app.post("/api/auth/logout")
async def api_auth_logout():
return {"status": "success", "message": "Logged out"}
+5 -2
View File
@@ -75,10 +75,13 @@ def main():
print(f"❌ Failed to connect to database: {e}") print(f"❌ Failed to connect to database: {e}")
sys.exit(1) sys.exit(1)
# Create dependencies for dependency injection # Create dependencies for dependency injection (simplified for web-only)
dependencies = { dependencies = {
"db": db, "db": db,
"config": config "config": config,
"nfo_manager": None, # Not needed for read-only web interface
"movie_processor": None, # Not needed for read-only web interface
"tv_processor": None # Not needed for read-only web interface
} }
# Setup static files and routes # Setup static files and routes