diff options
Diffstat (limited to 'crates/rocie-client/src/models')
| -rw-r--r-- | crates/rocie-client/src/models/login_info.rs | 32 | ||||
| -rw-r--r-- | crates/rocie-client/src/models/mod.rs | 10 | ||||
| -rw-r--r-- | crates/rocie-client/src/models/password_hash.rs | 29 | ||||
| -rw-r--r-- | crates/rocie-client/src/models/user.rs | 42 | ||||
| -rw-r--r-- | crates/rocie-client/src/models/user_id.rs | 27 | ||||
| -rw-r--r-- | crates/rocie-client/src/models/user_stub.rs | 36 |
6 files changed, 176 insertions, 0 deletions
diff --git a/crates/rocie-client/src/models/login_info.rs b/crates/rocie-client/src/models/login_info.rs new file mode 100644 index 0000000..5aef74e --- /dev/null +++ b/crates/rocie-client/src/models/login_info.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 LoginInfo { + /// The id of the user. + #[serde(rename = "id")] + pub id: models::UserId, + /// The password of the user. + #[serde(rename = "password")] + pub password: String, +} + +impl LoginInfo { + pub fn new(id: models::UserId, password: String) -> LoginInfo { + LoginInfo { + id, + password, + } + } +} + diff --git a/crates/rocie-client/src/models/mod.rs b/crates/rocie-client/src/models/mod.rs index e053411..135d612 100644 --- a/crates/rocie-client/src/models/mod.rs +++ b/crates/rocie-client/src/models/mod.rs @@ -2,6 +2,10 @@ pub mod barcode; pub use self::barcode::Barcode; pub mod barcode_id; pub use self::barcode_id::BarcodeId; +pub mod login_info; +pub use self::login_info::LoginInfo; +pub mod password_hash; +pub use self::password_hash::PasswordHash; pub mod product; pub use self::product::Product; pub mod product_amount; @@ -36,3 +40,9 @@ pub mod unit_property_stub; pub use self::unit_property_stub::UnitPropertyStub; pub mod unit_stub; pub use self::unit_stub::UnitStub; +pub mod user; +pub use self::user::User; +pub mod user_id; +pub use self::user_id::UserId; +pub mod user_stub; +pub use self::user_stub::UserStub; diff --git a/crates/rocie-client/src/models/password_hash.rs b/crates/rocie-client/src/models/password_hash.rs new file mode 100644 index 0000000..31413bf --- /dev/null +++ b/crates/rocie-client/src/models/password_hash.rs @@ -0,0 +1,29 @@ +/* + * 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}; + +/// 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>]] ``` +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct PasswordHash { + #[serde(rename = "value")] + pub value: String, +} + +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, + } + } +} + diff --git a/crates/rocie-client/src/models/user.rs b/crates/rocie-client/src/models/user.rs new file mode 100644 index 0000000..7397275 --- /dev/null +++ b/crates/rocie-client/src/models/user.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}; + +/// User : The definition of an rocie user. +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct User { + /// An description of this user. + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option<String>, + /// The unique ID for this user. + #[serde(rename = "id")] + pub id: models::UserId, + /// The user-displayed name of this user. + #[serde(rename = "name")] + pub name: String, + /// The hash of the user's password. + #[serde(rename = "password_hash")] + pub password_hash: models::PasswordHash, +} + +impl User { + /// The definition of an rocie user. + pub fn new(id: models::UserId, name: String, password_hash: models::PasswordHash) -> User { + User { + description: None, + id, + name, + password_hash, + } + } +} + diff --git a/crates/rocie-client/src/models/user_id.rs b/crates/rocie-client/src/models/user_id.rs new file mode 100644 index 0000000..3a67fd6 --- /dev/null +++ b/crates/rocie-client/src/models/user_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 UserId { + #[serde(rename = "value")] + pub value: uuid::Uuid, +} + +impl UserId { + pub fn new(value: uuid::Uuid) -> UserId { + UserId { + value, + } + } +} + diff --git a/crates/rocie-client/src/models/user_stub.rs b/crates/rocie-client/src/models/user_stub.rs new file mode 100644 index 0000000..8f620db --- /dev/null +++ b/crates/rocie-client/src/models/user_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 UserStub { + /// An optional description of the new user. + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option<String>, + /// The name of the new user. + #[serde(rename = "name")] + pub name: String, + /// The password of the new user. + #[serde(rename = "password")] + pub password: String, +} + +impl UserStub { + pub fn new(name: String, password: String) -> UserStub { + UserStub { + description: None, + name, + password, + } + } +} + |
