Recipe edit (WIP): add API to set some recipe values
This commit is contained in:
parent
c6dfff065c
commit
dd05a673d9
20 changed files with 690 additions and 2189 deletions
|
|
@ -13,6 +13,7 @@ use crate::{
|
|||
ron_utils,
|
||||
};
|
||||
|
||||
pub mod fragments;
|
||||
pub mod recipe;
|
||||
pub mod ron;
|
||||
pub mod user;
|
||||
|
|
@ -46,15 +47,19 @@ pub async fn home_page(
|
|||
State(connection): State<db::Connection>,
|
||||
Extension(user): Extension<Option<model::User>>,
|
||||
) -> Result<impl IntoResponse> {
|
||||
let recipes = connection.get_all_recipe_titles().await?;
|
||||
|
||||
Ok(HomeTemplate {
|
||||
user,
|
||||
recipes: Recipes {
|
||||
list: recipes,
|
||||
current_id: None,
|
||||
let recipes = Recipes {
|
||||
published: connection.get_all_published_recipe_titles().await?,
|
||||
unpublished: if let Some(user) = user.as_ref() {
|
||||
connection
|
||||
.get_all_unpublished_recipe_titles(user.id)
|
||||
.await?
|
||||
} else {
|
||||
vec![]
|
||||
},
|
||||
})
|
||||
current_id: None,
|
||||
};
|
||||
|
||||
Ok(HomeTemplate { user, recipes })
|
||||
}
|
||||
|
||||
///// 404 /////
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue