Added salt model
All checks were successful
Rust Build / Check (pull_request) Successful in 27s
Rust Build / Test Suite (pull_request) Successful in 27s
Rust Build / Rustfmt (pull_request) Successful in 29s
Rust Build / Clippy (pull_request) Successful in 30s
Rust Build / build (pull_request) Successful in 27s
All checks were successful
Rust Build / Check (pull_request) Successful in 27s
Rust Build / Test Suite (pull_request) Successful in 27s
Rust Build / Rustfmt (pull_request) Successful in 29s
Rust Build / Clippy (pull_request) Successful in 30s
Rust Build / build (pull_request) Successful in 27s
This commit is contained in:
26
src/user.rs
26
src/user.rs
@@ -59,3 +59,29 @@ impl User {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub mod salt {
|
||||||
|
use std::default::Default;
|
||||||
|
|
||||||
|
use crate::init;
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
|
pub struct Salt {
|
||||||
|
#[serde(skip_serializing_if = "init::is_uuid_nil")]
|
||||||
|
pub id: uuid::Uuid,
|
||||||
|
#[serde(skip_serializing_if = "String::is_empty")]
|
||||||
|
pub salt: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Salt {
|
||||||
|
pub fn to_json(&self, output_pretty: bool) -> Result<String, serde_json::Error> {
|
||||||
|
if output_pretty {
|
||||||
|
serde_json::to_string_pretty(&self)
|
||||||
|
} else {
|
||||||
|
serde_json::to_string(&self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user