diff options
Diffstat (limited to 'crates/rocie-client/src/models/recipe.rs')
| -rw-r--r-- | crates/rocie-client/src/models/recipe.rs | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/crates/rocie-client/src/models/recipe.rs b/crates/rocie-client/src/models/recipe.rs index e3b9d56..dfbbc03 100644 --- a/crates/rocie-client/src/models/recipe.rs +++ b/crates/rocie-client/src/models/recipe.rs @@ -11,18 +11,32 @@ use crate::models; use serde::{Deserialize, Serialize}; +/// Recipe : An recipe. These are transparently expressed in cooklang. #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Recipe { + /// The actual content of this recipe. #[serde(rename = "content")] - pub content: String, + pub content: models::CooklangRecipe, + /// The unique id of this recipe. #[serde(rename = "id")] pub id: models::RecipeId, - #[serde(rename = "path")] - pub path: String, + /// The name of the recipe. This should be globally unique, to make searching easier for the user. + #[serde(rename = "name")] + pub name: String, + /// The parent this recipe has. This is effectively it's anchor in the recipe DAG. None means, that it has no parents and as such is in the toplevel. + #[serde(rename = "parent", skip_serializing_if = "Option::is_none")] + pub parent: Option<models::RecipeParentId>, } impl Recipe { - pub fn new(content: String, id: models::RecipeId, path: String) -> Recipe { - Recipe { content, id, path } + /// An recipe. These are transparently expressed in cooklang. + pub fn new(content: models::CooklangRecipe, id: models::RecipeId, name: String) -> Recipe { + Recipe { + content, + id, + name, + parent: None, + } } } + |
