aboutsummaryrefslogtreecommitdiffstats
path: root/crates/rocie-client/src/models
diff options
context:
space:
mode:
Diffstat (limited to 'crates/rocie-client/src/models')
-rw-r--r--crates/rocie-client/src/models/mod.rs12
-rw-r--r--crates/rocie-client/src/models/product.rs8
-rw-r--r--crates/rocie-client/src/models/product_parent.rs42
-rw-r--r--crates/rocie-client/src/models/product_parent_id.rs27
-rw-r--r--crates/rocie-client/src/models/product_parent_stub.rs36
-rw-r--r--crates/rocie-client/src/models/product_stub.rs8
-rw-r--r--crates/rocie-client/src/models/recipe.rs33
-rw-r--r--crates/rocie-client/src/models/recipe_id.rs27
-rw-r--r--crates/rocie-client/src/models/recipe_stub.rs32
-rw-r--r--crates/rocie-client/src/models/unit.rs4
-rw-r--r--crates/rocie-client/src/models/unit_property.rs4
-rw-r--r--crates/rocie-client/src/models/unit_property_stub.rs6
-rw-r--r--crates/rocie-client/src/models/unit_stub.rs4
13 files changed, 229 insertions, 14 deletions
diff --git a/crates/rocie-client/src/models/mod.rs b/crates/rocie-client/src/models/mod.rs
index 4eabdfc..e053411 100644
--- a/crates/rocie-client/src/models/mod.rs
+++ b/crates/rocie-client/src/models/mod.rs
@@ -8,8 +8,20 @@ pub mod product_amount;
pub use self::product_amount::ProductAmount;
pub mod product_id;
pub use self::product_id::ProductId;
+pub mod product_parent;
+pub use self::product_parent::ProductParent;
+pub mod product_parent_id;
+pub use self::product_parent_id::ProductParentId;
+pub mod product_parent_stub;
+pub use self::product_parent_stub::ProductParentStub;
pub mod product_stub;
pub use self::product_stub::ProductStub;
+pub mod recipe;
+pub use self::recipe::Recipe;
+pub mod recipe_id;
+pub use self::recipe_id::RecipeId;
+pub mod recipe_stub;
+pub use self::recipe_stub::RecipeStub;
pub mod unit;
pub use self::unit::Unit;
pub mod unit_amount;
diff --git a/crates/rocie-client/src/models/product.rs b/crates/rocie-client/src/models/product.rs
index 251046c..2ab9445 100644
--- a/crates/rocie-client/src/models/product.rs
+++ b/crates/rocie-client/src/models/product.rs
@@ -18,14 +18,17 @@ pub struct Product {
#[serde(rename = "associated_bar_codes")]
pub associated_bar_codes: Vec<models::Barcode>,
/// An optional description of this product.
- #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
- pub description: Option<Option<String>>,
+ #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
+ pub description: Option<String>,
/// The id of the product.
#[serde(rename = "id")]
pub id: models::ProductId,
/// The name of the product. This should be globally unique, to make searching easier for the user.
#[serde(rename = "name")]
pub name: String,
+ /// The parent this product has. This is effectively it's anchor in the product DAG.
+ #[serde(rename = "parent", skip_serializing_if = "Option::is_none")]
+ pub parent: Option<models::ProductParentId>,
/// The property this product is measured in. (This is probably always either Mass, Volume or Quantity).
#[serde(rename = "unit_property")]
pub unit_property: models::UnitPropertyId,
@@ -39,6 +42,7 @@ impl Product {
description: None,
id,
name,
+ parent: None,
unit_property,
}
}
diff --git a/crates/rocie-client/src/models/product_parent.rs b/crates/rocie-client/src/models/product_parent.rs
new file mode 100644
index 0000000..7ce26c9
--- /dev/null
+++ b/crates/rocie-client/src/models/product_parent.rs
@@ -0,0 +1,42 @@
+/*
+ * rocie-server
+ *
+ * An enterprise grocery management system - server
+ *
+ * The version of the OpenAPI document: 0.1.0
+ * Contact: benedikt.peetz@b-peetz.de
+ * Generated by: https://openapi-generator.tech
+ */
+
+use crate::models;
+use serde::{Deserialize, Serialize};
+
+/// ProductParent : The grouping system for products. Every Product can have a related parent, and every parent can have a parent themselves. As such, the products list constructs a DAG.
+#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
+pub struct ProductParent {
+ /// An optional description of this product parent.
+ #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
+ pub description: Option<String>,
+ /// The id of the product parent.
+ #[serde(rename = "id")]
+ pub id: models::ProductParentId,
+ /// The name of the product parent. This should be globally unique, to make searching easier for the user.
+ #[serde(rename = "name")]
+ pub name: String,
+ /// The optional id of the parent of this product parent. This must not form a cycle.
+ #[serde(rename = "parent", skip_serializing_if = "Option::is_none")]
+ pub parent: Option<models::ProductParentId>,
+}
+
+impl ProductParent {
+ /// The grouping system for products. Every Product can have a related parent, and every parent can have a parent themselves. As such, the products list constructs a DAG.
+ pub fn new(id: models::ProductParentId, name: String) -> ProductParent {
+ ProductParent {
+ description: None,
+ id,
+ name,
+ parent: None,
+ }
+ }
+}
+
diff --git a/crates/rocie-client/src/models/product_parent_id.rs b/crates/rocie-client/src/models/product_parent_id.rs
new file mode 100644
index 0000000..1305117
--- /dev/null
+++ b/crates/rocie-client/src/models/product_parent_id.rs
@@ -0,0 +1,27 @@
+/*
+ * rocie-server
+ *
+ * An enterprise grocery management system - server
+ *
+ * The version of the OpenAPI document: 0.1.0
+ * Contact: benedikt.peetz@b-peetz.de
+ * Generated by: https://openapi-generator.tech
+ */
+
+use crate::models;
+use serde::{Deserialize, Serialize};
+
+#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
+pub struct ProductParentId {
+ #[serde(rename = "value")]
+ pub value: uuid::Uuid,
+}
+
+impl ProductParentId {
+ pub fn new(value: uuid::Uuid) -> ProductParentId {
+ ProductParentId {
+ value,
+ }
+ }
+}
+
diff --git a/crates/rocie-client/src/models/product_parent_stub.rs b/crates/rocie-client/src/models/product_parent_stub.rs
new file mode 100644
index 0000000..a874502
--- /dev/null
+++ b/crates/rocie-client/src/models/product_parent_stub.rs
@@ -0,0 +1,36 @@
+/*
+ * rocie-server
+ *
+ * An enterprise grocery management system - server
+ *
+ * The version of the OpenAPI document: 0.1.0
+ * Contact: benedikt.peetz@b-peetz.de
+ * Generated by: https://openapi-generator.tech
+ */
+
+use crate::models;
+use serde::{Deserialize, Serialize};
+
+#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
+pub struct ProductParentStub {
+ /// A description.
+ #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
+ pub description: Option<String>,
+ /// The name of the product parent
+ #[serde(rename = "name")]
+ pub name: String,
+ /// A parent of this product parent, otherwise the parent will be the root of the parent tree.
+ #[serde(rename = "parent", skip_serializing_if = "Option::is_none")]
+ pub parent: Option<models::ProductParentId>,
+}
+
+impl ProductParentStub {
+ pub fn new(name: String) -> ProductParentStub {
+ ProductParentStub {
+ description: None,
+ name,
+ parent: None,
+ }
+ }
+}
+
diff --git a/crates/rocie-client/src/models/product_stub.rs b/crates/rocie-client/src/models/product_stub.rs
index 0328076..76bc086 100644
--- a/crates/rocie-client/src/models/product_stub.rs
+++ b/crates/rocie-client/src/models/product_stub.rs
@@ -14,14 +14,14 @@ use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ProductStub {
/// A description.
- #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
- pub description: Option<Option<String>>,
+ #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
+ pub description: Option<String>,
/// The name of the product
#[serde(rename = "name")]
pub name: String,
/// A parent of this product, otherwise the parent will be the root of the parent tree.
- #[serde(rename = "parent", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
- pub parent: Option<Option<models::ProductId>>,
+ #[serde(rename = "parent", skip_serializing_if = "Option::is_none")]
+ pub parent: Option<models::ProductParentId>,
/// The Unit Property to use for this product.
#[serde(rename = "unit_property")]
pub unit_property: models::UnitPropertyId,
diff --git a/crates/rocie-client/src/models/recipe.rs b/crates/rocie-client/src/models/recipe.rs
new file mode 100644
index 0000000..81cb6bd
--- /dev/null
+++ b/crates/rocie-client/src/models/recipe.rs
@@ -0,0 +1,33 @@
+/*
+ * rocie-server
+ *
+ * An enterprise grocery management system - server
+ *
+ * The version of the OpenAPI document: 0.1.0
+ * Contact: benedikt.peetz@b-peetz.de
+ * Generated by: https://openapi-generator.tech
+ */
+
+use crate::models;
+use serde::{Deserialize, Serialize};
+
+#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
+pub struct Recipe {
+ #[serde(rename = "content")]
+ pub content: String,
+ #[serde(rename = "id")]
+ pub id: models::RecipeId,
+ #[serde(rename = "path")]
+ pub path: String,
+}
+
+impl Recipe {
+ pub fn new(content: String, id: models::RecipeId, path: String) -> Recipe {
+ Recipe {
+ content,
+ id,
+ path,
+ }
+ }
+}
+
diff --git a/crates/rocie-client/src/models/recipe_id.rs b/crates/rocie-client/src/models/recipe_id.rs
new file mode 100644
index 0000000..7d13aed
--- /dev/null
+++ b/crates/rocie-client/src/models/recipe_id.rs
@@ -0,0 +1,27 @@
+/*
+ * rocie-server
+ *
+ * An enterprise grocery management system - server
+ *
+ * The version of the OpenAPI document: 0.1.0
+ * Contact: benedikt.peetz@b-peetz.de
+ * Generated by: https://openapi-generator.tech
+ */
+
+use crate::models;
+use serde::{Deserialize, Serialize};
+
+#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
+pub struct RecipeId {
+ #[serde(rename = "value")]
+ pub value: uuid::Uuid,
+}
+
+impl RecipeId {
+ pub fn new(value: uuid::Uuid) -> RecipeId {
+ RecipeId {
+ value,
+ }
+ }
+}
+
diff --git a/crates/rocie-client/src/models/recipe_stub.rs b/crates/rocie-client/src/models/recipe_stub.rs
new file mode 100644
index 0000000..e8e9c63
--- /dev/null
+++ b/crates/rocie-client/src/models/recipe_stub.rs
@@ -0,0 +1,32 @@
+/*
+ * rocie-server
+ *
+ * An enterprise grocery management system - server
+ *
+ * The version of the OpenAPI document: 0.1.0
+ * Contact: benedikt.peetz@b-peetz.de
+ * Generated by: https://openapi-generator.tech
+ */
+
+use crate::models;
+use serde::{Deserialize, Serialize};
+
+#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
+pub struct RecipeStub {
+ /// The content of this recipe, in cooklang format
+ #[serde(rename = "content")]
+ pub content: String,
+ /// The path the recipe should have
+ #[serde(rename = "path")]
+ pub path: String,
+}
+
+impl RecipeStub {
+ pub fn new(content: String, path: String) -> RecipeStub {
+ RecipeStub {
+ content,
+ path,
+ }
+ }
+}
+
diff --git a/crates/rocie-client/src/models/unit.rs b/crates/rocie-client/src/models/unit.rs
index 6361a1c..873cb33 100644
--- a/crates/rocie-client/src/models/unit.rs
+++ b/crates/rocie-client/src/models/unit.rs
@@ -14,8 +14,8 @@ use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Unit {
/// Description of this unit.
- #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
- pub description: Option<Option<String>>,
+ #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
+ pub description: Option<String>,
/// The plural version of this unit's name. Is used by a value of two and more. (We do not support Slovenian dual numerus versions) E.g.: Kilogram -> Kilograms gram -> meters
#[serde(rename = "full_name_plural")]
pub full_name_plural: String,
diff --git a/crates/rocie-client/src/models/unit_property.rs b/crates/rocie-client/src/models/unit_property.rs
index f62012b..b4dfbe1 100644
--- a/crates/rocie-client/src/models/unit_property.rs
+++ b/crates/rocie-client/src/models/unit_property.rs
@@ -15,8 +15,8 @@ use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct UnitProperty {
/// An description of this property.
- #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
- pub description: Option<Option<String>>,
+ #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
+ pub description: Option<String>,
/// The unique ID for this unit property.
#[serde(rename = "id")]
pub id: models::UnitPropertyId,
diff --git a/crates/rocie-client/src/models/unit_property_stub.rs b/crates/rocie-client/src/models/unit_property_stub.rs
index be2d31e..c43d91e 100644
--- a/crates/rocie-client/src/models/unit_property_stub.rs
+++ b/crates/rocie-client/src/models/unit_property_stub.rs
@@ -13,8 +13,10 @@ use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct UnitPropertyStub {
- #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
- pub description: Option<Option<String>>,
+ /// An optional description of the unit property.
+ #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
+ pub description: Option<String>,
+ /// The name of the unit property.
#[serde(rename = "name")]
pub name: String,
}
diff --git a/crates/rocie-client/src/models/unit_stub.rs b/crates/rocie-client/src/models/unit_stub.rs
index aafad6c..162674f 100644
--- a/crates/rocie-client/src/models/unit_stub.rs
+++ b/crates/rocie-client/src/models/unit_stub.rs
@@ -13,8 +13,8 @@ use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct UnitStub {
- #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
- pub description: Option<Option<String>>,
+ #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
+ pub description: Option<String>,
#[serde(rename = "full_name_plural")]
pub full_name_plural: String,
#[serde(rename = "full_name_singular")]