about summary refs log tree commit diff stats
path: root/crates/rocie-client/src/models
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-09-06 18:31:40 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-09-06 18:31:40 +0200
commit1c09b0eb5db415985bfefb52786dbe48d757665e (patch)
treedb1cdbcff8baae9a73fca34e14b52cb8cf7ff230 /crates/rocie-client/src/models
parentfeat: Provide basic API frame (diff)
downloadserver-1c09b0eb5db415985bfefb52786dbe48d757665e.zip
feat: Provide basic barcode handling support
Diffstat (limited to 'crates/rocie-client/src/models')
-rw-r--r--crates/rocie-client/src/models/barcode.rs4
-rw-r--r--crates/rocie-client/src/models/mod.rs4
-rw-r--r--crates/rocie-client/src/models/unit.rs39
-rw-r--r--crates/rocie-client/src/models/unit_amount.rs6
-rw-r--r--crates/rocie-client/src/models/unit_stub.rs36
5 files changed, 84 insertions, 5 deletions
diff --git a/crates/rocie-client/src/models/barcode.rs b/crates/rocie-client/src/models/barcode.rs
index 7690be2..2b1759a 100644
--- a/crates/rocie-client/src/models/barcode.rs
+++ b/crates/rocie-client/src/models/barcode.rs
@@ -16,11 +16,11 @@ pub struct Barcode {
     #[serde(rename = "amount")]
     pub amount: Box<models::UnitAmount>,
     #[serde(rename = "id")]
-    pub id: i32,
+    pub id: i64,
 }
 
 impl Barcode {
-    pub fn new(amount: models::UnitAmount, id: i32) -> Barcode {
+    pub fn new(amount: models::UnitAmount, id: i64) -> Barcode {
         Barcode {
             amount: Box::new(amount),
             id,
diff --git a/crates/rocie-client/src/models/mod.rs b/crates/rocie-client/src/models/mod.rs
index 6c96c01..42fecc5 100644
--- a/crates/rocie-client/src/models/mod.rs
+++ b/crates/rocie-client/src/models/mod.rs
@@ -4,5 +4,9 @@ pub mod product;
 pub use self::product::Product;
 pub mod product_stub;
 pub use self::product_stub::ProductStub;
+pub mod unit;
+pub use self::unit::Unit;
 pub mod unit_amount;
 pub use self::unit_amount::UnitAmount;
+pub mod unit_stub;
+pub use self::unit_stub::UnitStub;
diff --git a/crates/rocie-client/src/models/unit.rs b/crates/rocie-client/src/models/unit.rs
new file mode 100644
index 0000000..95ec588
--- /dev/null
+++ b/crates/rocie-client/src/models/unit.rs
@@ -0,0 +1,39 @@
+/*
+ * rocie-server
+ *
+ * An enterprise grocery management system
+ *
+ * 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 Unit {
+    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
+    pub description: Option<Option<String>>,
+    #[serde(rename = "full_name_plural")]
+    pub full_name_plural: String,
+    #[serde(rename = "full_name_singular")]
+    pub full_name_singular: String,
+    #[serde(rename = "id")]
+    pub id: uuid::Uuid,
+    #[serde(rename = "short_name")]
+    pub short_name: String,
+}
+
+impl Unit {
+    pub fn new(full_name_plural: String, full_name_singular: String, id: uuid::Uuid, short_name: String) -> Unit {
+        Unit {
+            description: None,
+            full_name_plural,
+            full_name_singular,
+            id,
+            short_name,
+        }
+    }
+}
+
diff --git a/crates/rocie-client/src/models/unit_amount.rs b/crates/rocie-client/src/models/unit_amount.rs
index 038adb0..3ab482c 100644
--- a/crates/rocie-client/src/models/unit_amount.rs
+++ b/crates/rocie-client/src/models/unit_amount.rs
@@ -14,13 +14,13 @@ use serde::{Deserialize, Serialize};
 #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
 pub struct UnitAmount {
     #[serde(rename = "unit")]
-    pub unit: String,
+    pub unit: uuid::Uuid,
     #[serde(rename = "value")]
-    pub value: i32,
+    pub value: i64,
 }
 
 impl UnitAmount {
-    pub fn new(unit: String, value: i32) -> UnitAmount {
+    pub fn new(unit: uuid::Uuid, value: i64) -> UnitAmount {
         UnitAmount {
             unit,
             value,
diff --git a/crates/rocie-client/src/models/unit_stub.rs b/crates/rocie-client/src/models/unit_stub.rs
new file mode 100644
index 0000000..03f81fd
--- /dev/null
+++ b/crates/rocie-client/src/models/unit_stub.rs
@@ -0,0 +1,36 @@
+/*
+ * rocie-server
+ *
+ * An enterprise grocery management system
+ *
+ * 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 UnitStub {
+    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
+    pub description: Option<Option<String>>,
+    #[serde(rename = "full_name_plural")]
+    pub full_name_plural: String,
+    #[serde(rename = "full_name_singular")]
+    pub full_name_singular: String,
+    #[serde(rename = "short_name")]
+    pub short_name: String,
+}
+
+impl UnitStub {
+    pub fn new(full_name_plural: String, full_name_singular: String, short_name: String) -> UnitStub {
+        UnitStub {
+            description: None,
+            full_name_plural,
+            full_name_singular,
+            short_name,
+        }
+    }
+}
+