diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-09-23 17:17:28 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-09-23 17:17:28 +0200 |
| commit | 7682da81ff4c775eca048aaf0586593fb159cb85 (patch) | |
| tree | e310245e136b21e15696ffee2756cc6f49f6ae73 /crates/rocie-client/src/models | |
| parent | feat(scripts/generate_api_client.sh): Make the API better by configuring the ... (diff) | |
| download | server-7682da81ff4c775eca048aaf0586593fb159cb85.zip | |
chore(crates/rocie-client): Regenerate
Diffstat (limited to 'crates/rocie-client/src/models')
| -rw-r--r-- | crates/rocie-client/src/models/barcode.rs | 8 | ||||
| -rw-r--r-- | crates/rocie-client/src/models/barcode_id.rs | 27 | ||||
| -rw-r--r-- | crates/rocie-client/src/models/mod.rs | 6 | ||||
| -rw-r--r-- | crates/rocie-client/src/models/product.rs | 4 | ||||
| -rw-r--r-- | crates/rocie-client/src/models/product_amount.rs | 8 | ||||
| -rw-r--r-- | crates/rocie-client/src/models/product_id.rs | 27 | ||||
| -rw-r--r-- | crates/rocie-client/src/models/product_stub.rs | 4 | ||||
| -rw-r--r-- | crates/rocie-client/src/models/unit.rs | 4 | ||||
| -rw-r--r-- | crates/rocie-client/src/models/unit_amount.rs | 6 | ||||
| -rw-r--r-- | crates/rocie-client/src/models/unit_id.rs | 27 |
10 files changed, 104 insertions, 17 deletions
diff --git a/crates/rocie-client/src/models/barcode.rs b/crates/rocie-client/src/models/barcode.rs index 7690be2..76661dc 100644 --- a/crates/rocie-client/src/models/barcode.rs +++ b/crates/rocie-client/src/models/barcode.rs @@ -14,15 +14,15 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Barcode { #[serde(rename = "amount")] - pub amount: Box<models::UnitAmount>, + pub amount: models::UnitAmount, #[serde(rename = "id")] - pub id: i32, + pub id: models::BarcodeId, } impl Barcode { - pub fn new(amount: models::UnitAmount, id: i32) -> Barcode { + pub fn new(amount: models::UnitAmount, id: models::BarcodeId) -> Barcode { Barcode { - amount: Box::new(amount), + amount, id, } } diff --git a/crates/rocie-client/src/models/barcode_id.rs b/crates/rocie-client/src/models/barcode_id.rs new file mode 100644 index 0000000..2bd4775 --- /dev/null +++ b/crates/rocie-client/src/models/barcode_id.rs @@ -0,0 +1,27 @@ +/* + * 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 BarcodeId { + #[serde(rename = "value")] + pub value: u32, +} + +impl BarcodeId { + pub fn new(value: u32) -> BarcodeId { + BarcodeId { + value, + } + } +} + diff --git a/crates/rocie-client/src/models/mod.rs b/crates/rocie-client/src/models/mod.rs index 20ed0ff..6456de7 100644 --- a/crates/rocie-client/src/models/mod.rs +++ b/crates/rocie-client/src/models/mod.rs @@ -1,14 +1,20 @@ pub mod barcode; pub use self::barcode::Barcode; +pub mod barcode_id; +pub use self::barcode_id::BarcodeId; pub mod product; pub use self::product::Product; pub mod product_amount; pub use self::product_amount::ProductAmount; +pub mod product_id; +pub use self::product_id::ProductId; 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_id; +pub use self::unit_id::UnitId; pub mod unit_stub; pub use self::unit_stub::UnitStub; diff --git a/crates/rocie-client/src/models/product.rs b/crates/rocie-client/src/models/product.rs index acdc6c6..8fe68ee 100644 --- a/crates/rocie-client/src/models/product.rs +++ b/crates/rocie-client/src/models/product.rs @@ -18,13 +18,13 @@ pub struct Product { #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub description: Option<Option<String>>, #[serde(rename = "id")] - pub id: uuid::Uuid, + pub id: models::ProductId, #[serde(rename = "name")] pub name: String, } impl Product { - pub fn new(associated_bar_codes: Vec<models::Barcode>, id: uuid::Uuid, name: String) -> Product { + pub fn new(associated_bar_codes: Vec<models::Barcode>, id: models::ProductId, name: String) -> Product { Product { associated_bar_codes, description: None, diff --git a/crates/rocie-client/src/models/product_amount.rs b/crates/rocie-client/src/models/product_amount.rs index 6f1b436..1a2ed02 100644 --- a/crates/rocie-client/src/models/product_amount.rs +++ b/crates/rocie-client/src/models/product_amount.rs @@ -14,15 +14,15 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ProductAmount { #[serde(rename = "amount")] - pub amount: Box<models::UnitAmount>, + pub amount: models::UnitAmount, #[serde(rename = "product_id")] - pub product_id: uuid::Uuid, + pub product_id: models::ProductId, } impl ProductAmount { - pub fn new(amount: models::UnitAmount, product_id: uuid::Uuid) -> ProductAmount { + pub fn new(amount: models::UnitAmount, product_id: models::ProductId) -> ProductAmount { ProductAmount { - amount: Box::new(amount), + amount, product_id, } } diff --git a/crates/rocie-client/src/models/product_id.rs b/crates/rocie-client/src/models/product_id.rs new file mode 100644 index 0000000..021bd38 --- /dev/null +++ b/crates/rocie-client/src/models/product_id.rs @@ -0,0 +1,27 @@ +/* + * 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 ProductId { + #[serde(rename = "value")] + pub value: uuid::Uuid, +} + +impl ProductId { + pub fn new(value: uuid::Uuid) -> ProductId { + ProductId { + value, + } + } +} + diff --git a/crates/rocie-client/src/models/product_stub.rs b/crates/rocie-client/src/models/product_stub.rs index 3849c18..40c1123 100644 --- a/crates/rocie-client/src/models/product_stub.rs +++ b/crates/rocie-client/src/models/product_stub.rs @@ -17,8 +17,8 @@ pub struct ProductStub { pub description: Option<Option<String>>, #[serde(rename = "name")] pub name: String, - #[serde(rename = "parent", skip_serializing_if = "Option::is_none")] - pub parent: Option<uuid::Uuid>, + #[serde(rename = "parent", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub parent: Option<Option<models::ProductId>>, } impl ProductStub { diff --git a/crates/rocie-client/src/models/unit.rs b/crates/rocie-client/src/models/unit.rs index 95ec588..760d532 100644 --- a/crates/rocie-client/src/models/unit.rs +++ b/crates/rocie-client/src/models/unit.rs @@ -20,13 +20,13 @@ pub struct Unit { #[serde(rename = "full_name_singular")] pub full_name_singular: String, #[serde(rename = "id")] - pub id: uuid::Uuid, + pub id: models::UnitId, #[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 { + pub fn new(full_name_plural: String, full_name_singular: String, id: models::UnitId, short_name: String) -> Unit { Unit { description: None, full_name_plural, diff --git a/crates/rocie-client/src/models/unit_amount.rs b/crates/rocie-client/src/models/unit_amount.rs index 3ab482c..928a6f4 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: uuid::Uuid, + pub unit: models::UnitId, #[serde(rename = "value")] - pub value: i64, + pub value: u32, } impl UnitAmount { - pub fn new(unit: uuid::Uuid, value: i64) -> UnitAmount { + pub fn new(unit: models::UnitId, value: u32) -> UnitAmount { UnitAmount { unit, value, diff --git a/crates/rocie-client/src/models/unit_id.rs b/crates/rocie-client/src/models/unit_id.rs new file mode 100644 index 0000000..ea1ef51 --- /dev/null +++ b/crates/rocie-client/src/models/unit_id.rs @@ -0,0 +1,27 @@ +/* + * 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 UnitId { + #[serde(rename = "value")] + pub value: uuid::Uuid, +} + +impl UnitId { + pub fn new(value: uuid::Uuid) -> UnitId { + UnitId { + value, + } + } +} + |
