dbdbb77daf
Struttura monorepo completa con server FastAPI e client Flask: - Server: FastAPI + SQLAlchemy 2.0 async + Alembic migrations - Client: Flask + blueprints (auth, measure, maker, statistics) - Database: docker-compose MySQL 8.0 + Alembic async config - Config: pydantic-settings, TailwindCSS, Flask-Babel i18n - Piano implementazione completo (18 sezioni, 1600 righe) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
"""Maker blueprint - recipe creation and editing."""
|
|
from flask import Blueprint, render_template, session, redirect, url_for
|
|
|
|
maker_bp = Blueprint("maker", __name__)
|
|
|
|
|
|
@maker_bp.route("/recipes")
|
|
def recipe_list():
|
|
"""List all recipes with filters."""
|
|
if "user" not in session:
|
|
return redirect(url_for("auth.login"))
|
|
return render_template("maker/recipe_list.html")
|
|
|
|
|
|
@maker_bp.route("/recipes/new")
|
|
@maker_bp.route("/recipes/<int:recipe_id>/edit")
|
|
def recipe_editor(recipe_id: int | None = None):
|
|
"""Recipe editor - create or edit."""
|
|
if "user" not in session:
|
|
return redirect(url_for("auth.login"))
|
|
return render_template("maker/recipe_editor.html", recipe_id=recipe_id)
|
|
|
|
|
|
@maker_bp.route("/recipes/<int:recipe_id>/tasks")
|
|
def task_editor(recipe_id: int):
|
|
"""Task/subtask editor with tolerances."""
|
|
if "user" not in session:
|
|
return redirect(url_for("auth.login"))
|
|
return render_template("maker/task_editor.html", recipe_id=recipe_id)
|
|
|
|
|
|
@maker_bp.route("/recipes/<int:recipe_id>/preview")
|
|
def recipe_preview(recipe_id: int):
|
|
"""Preview recipe as MeasurementTec would see it."""
|
|
if "user" not in session:
|
|
return redirect(url_for("auth.login"))
|
|
return render_template("maker/recipe_preview.html", recipe_id=recipe_id)
|
|
|
|
|
|
@maker_bp.route("/recipes/<int:recipe_id>/versions")
|
|
def version_history(recipe_id: int):
|
|
"""Version history with diff."""
|
|
if "user" not in session:
|
|
return redirect(url_for("auth.login"))
|
|
return render_template("maker/version_history.html", recipe_id=recipe_id)
|