diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-12-09 13:12:31 +0100 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-12-09 13:12:31 +0100 |
| commit | 7565c34d69ee259fef3ac9813d689d97689a6d58 (patch) | |
| tree | ee4f00e3d090ec288d481cc92781e55637619824 /crates/rocie-client/src/models | |
| parent | feat(rocie-server): Implement basic user handling and authentication (diff) | |
| download | server-7565c34d69ee259fef3ac9813d689d97689a6d58.zip | |
style(rocie-client): Format
Diffstat (limited to 'crates/rocie-client/src/models')
27 files changed, 41 insertions, 89 deletions
diff --git a/crates/rocie-client/src/models/bar_code.rs b/crates/rocie-client/src/models/bar_code.rs index c8123a2..efe4683 100644 --- a/crates/rocie-client/src/models/bar_code.rs +++ b/crates/rocie-client/src/models/bar_code.rs @@ -19,9 +19,6 @@ pub struct BarCode { impl BarCode { pub fn new(id: i64) -> BarCode { - BarCode { - id, - } + BarCode { id } } } - diff --git a/crates/rocie-client/src/models/barcode.rs b/crates/rocie-client/src/models/barcode.rs index f44caa9..ca950cd 100644 --- a/crates/rocie-client/src/models/barcode.rs +++ b/crates/rocie-client/src/models/barcode.rs @@ -21,10 +21,6 @@ pub struct Barcode { impl Barcode { pub fn new(amount: models::UnitAmount, id: models::BarcodeId) -> Barcode { - Barcode { - amount, - id, - } + Barcode { amount, id } } } - diff --git a/crates/rocie-client/src/models/barcode_id.rs b/crates/rocie-client/src/models/barcode_id.rs index a081913..581c07d 100644 --- a/crates/rocie-client/src/models/barcode_id.rs +++ b/crates/rocie-client/src/models/barcode_id.rs @@ -19,9 +19,6 @@ pub struct BarcodeId { impl BarcodeId { pub fn new(value: u32) -> BarcodeId { - BarcodeId { - value, - } + BarcodeId { value } } } - diff --git a/crates/rocie-client/src/models/login_info.rs b/crates/rocie-client/src/models/login_info.rs index 5aef74e..1f9215b 100644 --- a/crates/rocie-client/src/models/login_info.rs +++ b/crates/rocie-client/src/models/login_info.rs @@ -23,10 +23,6 @@ pub struct LoginInfo { impl LoginInfo { pub fn new(id: models::UserId, password: String) -> LoginInfo { - LoginInfo { - id, - password, - } + LoginInfo { id, password } } } - diff --git a/crates/rocie-client/src/models/password_hash.rs b/crates/rocie-client/src/models/password_hash.rs index 31413bf..b73a944 100644 --- a/crates/rocie-client/src/models/password_hash.rs +++ b/crates/rocie-client/src/models/password_hash.rs @@ -21,9 +21,6 @@ pub struct PasswordHash { impl PasswordHash { /// This is stored as an PHC password string. This type corresponds to the string representation of a PHC string as described in the [PHC string format specification][1]. PHC strings have the following format: ```text $<id>[$v=<version>][$<param>=<value>(,<param>=<value>)*][$<salt>[$<hash>]] ``` pub fn new(value: String) -> PasswordHash { - PasswordHash { - value, - } + PasswordHash { value } } } - diff --git a/crates/rocie-client/src/models/product.rs b/crates/rocie-client/src/models/product.rs index 2ab9445..e2546e0 100644 --- a/crates/rocie-client/src/models/product.rs +++ b/crates/rocie-client/src/models/product.rs @@ -36,7 +36,12 @@ pub struct Product { impl Product { /// The base of rocie. Products can be bought and consumed and represent, what you actually have in storage. Not every product is bought, as some can also be obtained by cooking a recipe. - pub fn new(associated_bar_codes: Vec<models::Barcode>, id: models::ProductId, name: String, unit_property: models::UnitPropertyId) -> Product { + pub fn new( + associated_bar_codes: Vec<models::Barcode>, + id: models::ProductId, + name: String, + unit_property: models::UnitPropertyId, + ) -> Product { Product { associated_bar_codes, description: None, @@ -47,4 +52,3 @@ impl Product { } } } - diff --git a/crates/rocie-client/src/models/product_amount.rs b/crates/rocie-client/src/models/product_amount.rs index 43ab725..66e967b 100644 --- a/crates/rocie-client/src/models/product_amount.rs +++ b/crates/rocie-client/src/models/product_amount.rs @@ -21,10 +21,6 @@ pub struct ProductAmount { impl ProductAmount { pub fn new(amount: models::UnitAmount, product_id: models::ProductId) -> ProductAmount { - ProductAmount { - amount, - product_id, - } + ProductAmount { amount, product_id } } } - diff --git a/crates/rocie-client/src/models/product_id.rs b/crates/rocie-client/src/models/product_id.rs index 0f65bb8..0f0c3db 100644 --- a/crates/rocie-client/src/models/product_id.rs +++ b/crates/rocie-client/src/models/product_id.rs @@ -19,9 +19,6 @@ pub struct ProductId { impl ProductId { pub fn new(value: uuid::Uuid) -> ProductId { - ProductId { - value, - } + ProductId { value } } } - diff --git a/crates/rocie-client/src/models/product_one_of.rs b/crates/rocie-client/src/models/product_one_of.rs index 399c06b..e8763d6 100644 --- a/crates/rocie-client/src/models/product_one_of.rs +++ b/crates/rocie-client/src/models/product_one_of.rs @@ -19,9 +19,6 @@ pub struct ProductOneOf { impl ProductOneOf { pub fn new(mass: i64) -> ProductOneOf { - ProductOneOf { - mass, - } + ProductOneOf { mass } } } - diff --git a/crates/rocie-client/src/models/product_one_of_1.rs b/crates/rocie-client/src/models/product_one_of_1.rs index 58e033f..cc7a865 100644 --- a/crates/rocie-client/src/models/product_one_of_1.rs +++ b/crates/rocie-client/src/models/product_one_of_1.rs @@ -19,9 +19,6 @@ pub struct ProductOneOf1 { impl ProductOneOf1 { pub fn new(volume: i64) -> ProductOneOf1 { - ProductOneOf1 { - volume, - } + ProductOneOf1 { volume } } } - diff --git a/crates/rocie-client/src/models/product_parent.rs b/crates/rocie-client/src/models/product_parent.rs index 7ce26c9..79aec15 100644 --- a/crates/rocie-client/src/models/product_parent.rs +++ b/crates/rocie-client/src/models/product_parent.rs @@ -39,4 +39,3 @@ impl ProductParent { } } } - diff --git a/crates/rocie-client/src/models/product_parent_id.rs b/crates/rocie-client/src/models/product_parent_id.rs index 1305117..9701ab3 100644 --- a/crates/rocie-client/src/models/product_parent_id.rs +++ b/crates/rocie-client/src/models/product_parent_id.rs @@ -19,9 +19,6 @@ pub struct ProductParentId { impl ProductParentId { pub fn new(value: uuid::Uuid) -> ProductParentId { - ProductParentId { - value, - } + ProductParentId { value } } } - diff --git a/crates/rocie-client/src/models/product_parent_stub.rs b/crates/rocie-client/src/models/product_parent_stub.rs index a874502..878762e 100644 --- a/crates/rocie-client/src/models/product_parent_stub.rs +++ b/crates/rocie-client/src/models/product_parent_stub.rs @@ -33,4 +33,3 @@ impl ProductParentStub { } } } - diff --git a/crates/rocie-client/src/models/product_stub.rs b/crates/rocie-client/src/models/product_stub.rs index 76bc086..2332d0f 100644 --- a/crates/rocie-client/src/models/product_stub.rs +++ b/crates/rocie-client/src/models/product_stub.rs @@ -37,4 +37,3 @@ impl ProductStub { } } } - diff --git a/crates/rocie-client/src/models/recipe.rs b/crates/rocie-client/src/models/recipe.rs index 81cb6bd..e3b9d56 100644 --- a/crates/rocie-client/src/models/recipe.rs +++ b/crates/rocie-client/src/models/recipe.rs @@ -23,11 +23,6 @@ pub struct Recipe { impl Recipe { pub fn new(content: String, id: models::RecipeId, path: String) -> Recipe { - Recipe { - content, - id, - path, - } + Recipe { content, id, path } } } - diff --git a/crates/rocie-client/src/models/recipe_id.rs b/crates/rocie-client/src/models/recipe_id.rs index 7d13aed..f08b956 100644 --- a/crates/rocie-client/src/models/recipe_id.rs +++ b/crates/rocie-client/src/models/recipe_id.rs @@ -19,9 +19,6 @@ pub struct RecipeId { impl RecipeId { pub fn new(value: uuid::Uuid) -> RecipeId { - RecipeId { - value, - } + RecipeId { value } } } - diff --git a/crates/rocie-client/src/models/recipe_stub.rs b/crates/rocie-client/src/models/recipe_stub.rs index e8e9c63..205faa6 100644 --- a/crates/rocie-client/src/models/recipe_stub.rs +++ b/crates/rocie-client/src/models/recipe_stub.rs @@ -23,10 +23,6 @@ pub struct RecipeStub { impl RecipeStub { pub fn new(content: String, path: String) -> RecipeStub { - RecipeStub { - content, - path, - } + RecipeStub { content, path } } } - diff --git a/crates/rocie-client/src/models/unit.rs b/crates/rocie-client/src/models/unit.rs index 873cb33..229866d 100644 --- a/crates/rocie-client/src/models/unit.rs +++ b/crates/rocie-client/src/models/unit.rs @@ -34,7 +34,13 @@ pub struct Unit { } impl Unit { - pub fn new(full_name_plural: String, full_name_singular: String, id: models::UnitId, short_name: String, unit_property: models::UnitPropertyId) -> Unit { + pub fn new( + full_name_plural: String, + full_name_singular: String, + id: models::UnitId, + short_name: String, + unit_property: models::UnitPropertyId, + ) -> Unit { Unit { description: None, full_name_plural, @@ -45,4 +51,3 @@ impl Unit { } } } - diff --git a/crates/rocie-client/src/models/unit_amount.rs b/crates/rocie-client/src/models/unit_amount.rs index e4b1a54..a8e4254 100644 --- a/crates/rocie-client/src/models/unit_amount.rs +++ b/crates/rocie-client/src/models/unit_amount.rs @@ -21,10 +21,6 @@ pub struct UnitAmount { impl UnitAmount { pub fn new(unit: models::UnitId, value: u32) -> UnitAmount { - UnitAmount { - unit, - value, - } + UnitAmount { unit, value } } } - diff --git a/crates/rocie-client/src/models/unit_id.rs b/crates/rocie-client/src/models/unit_id.rs index 8b08d95..5a09994 100644 --- a/crates/rocie-client/src/models/unit_id.rs +++ b/crates/rocie-client/src/models/unit_id.rs @@ -19,9 +19,6 @@ pub struct UnitId { impl UnitId { pub fn new(value: uuid::Uuid) -> UnitId { - UnitId { - value, - } + UnitId { value } } } - diff --git a/crates/rocie-client/src/models/unit_property.rs b/crates/rocie-client/src/models/unit_property.rs index b4dfbe1..bfe5d9c 100644 --- a/crates/rocie-client/src/models/unit_property.rs +++ b/crates/rocie-client/src/models/unit_property.rs @@ -30,7 +30,11 @@ pub struct UnitProperty { impl UnitProperty { /// An unit property describes a property that can be measured by units. For example velocity, mass or volume. - pub fn new(id: models::UnitPropertyId, name: String, units: Vec<models::UnitId>) -> UnitProperty { + pub fn new( + id: models::UnitPropertyId, + name: String, + units: Vec<models::UnitId>, + ) -> UnitProperty { UnitProperty { description: None, id, @@ -39,4 +43,3 @@ impl UnitProperty { } } } - diff --git a/crates/rocie-client/src/models/unit_property_id.rs b/crates/rocie-client/src/models/unit_property_id.rs index aca567c..6e9e50e 100644 --- a/crates/rocie-client/src/models/unit_property_id.rs +++ b/crates/rocie-client/src/models/unit_property_id.rs @@ -19,9 +19,6 @@ pub struct UnitPropertyId { impl UnitPropertyId { pub fn new(value: uuid::Uuid) -> UnitPropertyId { - UnitPropertyId { - value, - } + UnitPropertyId { value } } } - diff --git a/crates/rocie-client/src/models/unit_property_stub.rs b/crates/rocie-client/src/models/unit_property_stub.rs index c43d91e..37ccb64 100644 --- a/crates/rocie-client/src/models/unit_property_stub.rs +++ b/crates/rocie-client/src/models/unit_property_stub.rs @@ -29,4 +29,3 @@ impl UnitPropertyStub { } } } - diff --git a/crates/rocie-client/src/models/unit_stub.rs b/crates/rocie-client/src/models/unit_stub.rs index 162674f..accad53 100644 --- a/crates/rocie-client/src/models/unit_stub.rs +++ b/crates/rocie-client/src/models/unit_stub.rs @@ -26,7 +26,12 @@ pub struct UnitStub { } impl UnitStub { - pub fn new(full_name_plural: String, full_name_singular: String, short_name: String, unit_property: models::UnitPropertyId) -> UnitStub { + pub fn new( + full_name_plural: String, + full_name_singular: String, + short_name: String, + unit_property: models::UnitPropertyId, + ) -> UnitStub { UnitStub { description: None, full_name_plural, @@ -36,4 +41,3 @@ impl UnitStub { } } } - diff --git a/crates/rocie-client/src/models/user.rs b/crates/rocie-client/src/models/user.rs index 7397275..d7bdb99 100644 --- a/crates/rocie-client/src/models/user.rs +++ b/crates/rocie-client/src/models/user.rs @@ -39,4 +39,3 @@ impl User { } } } - diff --git a/crates/rocie-client/src/models/user_id.rs b/crates/rocie-client/src/models/user_id.rs index 3a67fd6..677fb37 100644 --- a/crates/rocie-client/src/models/user_id.rs +++ b/crates/rocie-client/src/models/user_id.rs @@ -19,9 +19,6 @@ pub struct UserId { impl UserId { pub fn new(value: uuid::Uuid) -> UserId { - UserId { - value, - } + UserId { value } } } - diff --git a/crates/rocie-client/src/models/user_stub.rs b/crates/rocie-client/src/models/user_stub.rs index 8f620db..e49b034 100644 --- a/crates/rocie-client/src/models/user_stub.rs +++ b/crates/rocie-client/src/models/user_stub.rs @@ -33,4 +33,3 @@ impl UserStub { } } } - |
