Phase 2 of the full modernization: - App factory pattern with create_app() - Settings via dataclass with env vars - Dependency injection container - Router stubs for auth, storage, api, recipes, cache, runs - Service layer stubs for run, recipe, cache - Repository layer placeholder Routes are stubs that import from legacy server.py during migration. Next: Migrate each router fully with templates. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
"""
|
|
Recipe management routes for L1 server.
|
|
|
|
Handles recipe upload, listing, viewing, and execution.
|
|
"""
|
|
|
|
from fastapi import APIRouter, Request, Depends, HTTPException
|
|
from fastapi.responses import HTMLResponse
|
|
|
|
from artdag_common.middleware import UserContext, wants_html
|
|
|
|
from ..dependencies import require_auth, get_templates
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
# TODO: Migrate routes from server.py lines 1990-2767
|
|
# - POST /recipes/upload - Upload recipe YAML
|
|
# - GET /recipes - List recipes
|
|
# - GET /recipes/{recipe_id} - Get recipe details
|
|
# - DELETE /recipes/{recipe_id} - Delete recipe
|
|
# - POST /recipes/{recipe_id}/run - Run recipe
|
|
# - GET /recipe/{recipe_id} - Recipe detail page
|
|
# - GET /recipe/{recipe_id}/dag - Recipe DAG visualization
|
|
# - POST /ui/recipes/{recipe_id}/run - Run from UI
|
|
# - GET /ui/recipes-list - Recipes list UI
|
|
|
|
|
|
@router.get("/recipes")
|
|
async def list_recipes(
|
|
request: Request,
|
|
user: UserContext = Depends(require_auth),
|
|
):
|
|
"""List available recipes."""
|
|
# TODO: Implement
|
|
raise HTTPException(501, "Not yet migrated")
|
|
|
|
|
|
@router.get("/recipe/{recipe_id}")
|
|
async def recipe_detail(
|
|
recipe_id: str,
|
|
request: Request,
|
|
user: UserContext = Depends(require_auth),
|
|
):
|
|
"""Recipe detail page with DAG visualization."""
|
|
# TODO: Implement
|
|
raise HTTPException(501, "Not yet migrated")
|