Recipe edit (WIP): forms to edit groups, steps and ingredients

This commit is contained in:
Greg Burri 2024-12-26 01:39:07 +01:00
parent dd05a673d9
commit 07b7ff425e
25 changed files with 881 additions and 203 deletions

View file

@ -1,8 +1,9 @@
use axum::{
debug_handler,
extract::{Extension, State},
extract::{Extension, Query, State},
response::{IntoResponse, Result},
};
use serde::Deserialize;
// use tracing::{event, Level};
use crate::{
@ -10,9 +11,15 @@ use crate::{
html_templates::*,
};
#[derive(Deserialize)]
pub struct CurrentRecipeId {
current_recipe_id: Option<i64>,
}
#[debug_handler]
pub async fn recipes_list_fragments(
State(connection): State<db::Connection>,
current_recipe: Query<CurrentRecipeId>,
Extension(user): Extension<Option<model::User>>,
) -> Result<impl IntoResponse> {
let recipes = Recipes {
@ -24,8 +31,7 @@ pub async fn recipes_list_fragments(
} else {
vec![]
},
current_id: None,
current_id: current_recipe.current_recipe_id,
};
Ok(RecipesListFragmentTemplate { user, recipes })
}