udpates: to database population
Local Docker Build (Dev) / build-dev (push) Successful in 5s

This commit is contained in:
2025-11-03 10:49:30 -05:00
parent 5305e327b3
commit de2203a53d
+9 -3
View File
@@ -1136,8 +1136,8 @@ async def get_populate_status():
def register_web_routes(app, dependencies):
"""Register all web API routes with FastAPI app"""
from fastapi import Request, Response
# Dashboard and stats endpoints
# Dashboard and stats endpoints
@app.get("/api/dashboard")
async def api_dashboard():
return await get_dashboard_stats(dependencies)
@@ -1259,8 +1259,14 @@ def register_web_routes(app, dependencies):
# Database population endpoints
@app.post("/admin/populate-database")
async def api_populate_database(background_tasks: BackgroundTasks, media_type: str = "both"):
async def api_populate_database(request: Request, background_tasks: BackgroundTasks):
"""Populate database from Radarr/Sonarr"""
try:
data = await request.json()
media_type = data.get("media_type", "both")
except Exception:
# Fallback to query parameter if JSON parsing fails
media_type = request.query_params.get("media_type", "both")
return await populate_database(background_tasks, media_type, dependencies)
@app.get("/api/populate/status")