diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-02-15 22:24:32 +0100 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-02-15 22:25:06 +0100 |
| commit | e5f90f4474cb96a78080395980283e4b2ce40214 (patch) | |
| tree | caac3300795eae8e4cb1ee3c1c4bf85cd5950402 /crates/rocie-server/src/api/set/auth/recipe.rs | |
| parent | chore(treewide): Update (diff) | |
| download | server-e5f90f4474cb96a78080395980283e4b2ce40214.zip | |
feat(treewide): Add recipes and user handling
Diffstat (limited to 'crates/rocie-server/src/api/set/auth/recipe.rs')
| -rw-r--r-- | crates/rocie-server/src/api/set/auth/recipe.rs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/crates/rocie-server/src/api/set/auth/recipe.rs b/crates/rocie-server/src/api/set/auth/recipe.rs index 43a034e..b9f930d 100644 --- a/crates/rocie-server/src/api/set/auth/recipe.rs +++ b/crates/rocie-server/src/api/set/auth/recipe.rs @@ -1,5 +1,3 @@ -use std::path::PathBuf; - use actix_identity::Identity; use actix_web::{HttpResponse, Responder, error::Result, post, web}; use serde::Deserialize; @@ -10,14 +8,18 @@ use crate::{ storage::sql::{ insert::Operations, recipe::{Recipe, RecipeId}, + recipe_parent::RecipeParentId, }, }; #[derive(Deserialize, ToSchema)] struct RecipeStub { - /// The path the recipe should have - #[schema(value_type = String)] - path: PathBuf, + /// The globally unique name of this recipe + name: String, + + /// The optional parent of this recipe. + #[schema(nullable = false)] + parent: Option<RecipeParentId>, /// The content of this recipe, in cooklang format content: String, @@ -52,7 +54,14 @@ pub(crate) async fn add_recipe( let stub = stub.into_inner(); let mut ops = Operations::new("add recipe parent"); - let recipe = Recipe::new(stub.path, stub.content, &mut ops); + let recipe = Recipe::new( + &app, + stub.name, + stub.parent, + stub.content, + &mut ops, + ) + .await?; ops.apply(&app).await?; |
