Skipping serialization of fields in Contact (#20)
Release Tagging / release (push) Successful in 40s
Rust Build / Test Suite (push) Successful in 26s
Rust Build / Check (push) Successful in 1m28s
Rust Build / Rustfmt (push) Successful in 26s
Rust Build / Clippy (push) Successful in 40s
Rust Build / build (push) Successful in 1m11s
Release Tagging / release (push) Successful in 40s
Rust Build / Test Suite (push) Successful in 26s
Rust Build / Check (push) Successful in 1m28s
Rust Build / Rustfmt (push) Successful in 26s
Rust Build / Clippy (push) Successful in 40s
Rust Build / build (push) Successful in 1m11s
Reviewed-on: phoenix/textsender-models#20
This commit was merged in pull request #20.
This commit is contained in:
+10
-5
@@ -2,14 +2,19 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
pub struct Contact {
|
pub struct Contact {
|
||||||
pub id: uuid::Uuid,
|
#[serde(skip_serializing_if = "crate::init::is_uuid_nil")]
|
||||||
|
pub id: Option<uuid::Uuid>,
|
||||||
// empty?
|
// empty?
|
||||||
pub firstname: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub firstname: Option<String>,
|
||||||
// empty?
|
// empty?
|
||||||
pub lastname: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub lastname: Option<String>,
|
||||||
// empty?
|
// empty?
|
||||||
pub nickname: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub nickname: Option<String>,
|
||||||
pub phone_number: String,
|
pub phone_number: String,
|
||||||
// empty
|
// empty
|
||||||
pub user_id: uuid::Uuid,
|
#[serde(skip_serializing_if = "crate::init::is_uuid_nil")]
|
||||||
|
pub user_id: Option<uuid::Uuid>,
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-2
@@ -6,7 +6,10 @@ pub mod token;
|
|||||||
pub mod user;
|
pub mod user;
|
||||||
|
|
||||||
pub mod init {
|
pub mod init {
|
||||||
pub fn is_uuid_nil(uuid: &uuid::Uuid) -> bool {
|
pub fn is_uuid_nil(uuid: &Option<uuid::Uuid>) -> bool {
|
||||||
uuid.is_nil()
|
match uuid {
|
||||||
|
Some(id) => id.is_nil(),
|
||||||
|
None => true,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -71,7 +71,7 @@ pub struct UserProfile {
|
|||||||
|
|
||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
pub struct Salt {
|
pub struct Salt {
|
||||||
#[serde(skip_serializing_if = "crate::init::is_uuid_nil")]
|
// #[serde(skip_serializing_if = "crate::init::is_uuid_nil")]
|
||||||
pub id: uuid::Uuid,
|
pub id: uuid::Uuid,
|
||||||
#[serde(skip_serializing_if = "String::is_empty")]
|
#[serde(skip_serializing_if = "String::is_empty")]
|
||||||
pub salt: String,
|
pub salt: String,
|
||||||
|
|||||||
Reference in New Issue
Block a user