fix: Task back button navigates to correct recipe (not version_id)

- Add recipe_id property to RecipeTask model (via version relationship)
- Add recipe_id to TaskResponse schema
- Eager-load version in _get_task_or_404 query
- Use task.recipe_id instead of task.version_id in task_execute template URLs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Adriano
2026-02-08 10:34:23 +01:00
parent 00d6c68b2f
commit f665bffb7a
4 changed files with 15 additions and 4 deletions
+7
View File
@@ -39,6 +39,13 @@ class RecipeTask(Base):
{"mysql_engine": "InnoDB", "mysql_charset": "utf8mb4"},
)
@property
def recipe_id(self) -> int | None:
"""Shortcut: recipe_id via the version relationship."""
if self.version:
return self.version.recipe_id
return None
def __repr__(self) -> str:
return f"<RecipeTask #{self.order_index} '{self.title}'>"