diff --git a/Cargo.lock b/Cargo.lock index 5c7adff8d..8fabf9e99 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3398,6 +3398,7 @@ dependencies = [ "lemmy_db_schema_file", "lemmy_utils", "serde", + "serde_with", "serial_test", "tokio", "ts-rs", @@ -3416,6 +3417,7 @@ dependencies = [ "lemmy_db_schema_file", "lemmy_utils", "serde", + "serde_with", "serial_test", "tokio", "ts-rs", diff --git a/crates/db_views_community/Cargo.toml b/crates/db_views_community/Cargo.toml index 7477c5d83..5768e3197 100644 --- a/crates/db_views_community/Cargo.toml +++ b/crates/db_views_community/Cargo.toml @@ -32,6 +32,7 @@ lemmy_db_schema_file = { workspace = true } diesel = { workspace = true, optional = true } diesel-async = { workspace = true, optional = true } serde = { workspace = true } +serde_with = { workspace = true } ts-rs = { workspace = true, optional = true } i-love-jesus = { workspace = true, optional = true } diff --git a/crates/db_views_community/src/lib.rs b/crates/db_views_community/src/lib.rs index 5dadb6254..ad8233e20 100644 --- a/crates/db_views_community/src/lib.rs +++ b/crates/db_views_community/src/lib.rs @@ -4,6 +4,7 @@ use lemmy_db_schema::source::{ tag::TagsView, }; use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; #[cfg(feature = "full")] use { diesel::{Queryable, Selectable}, @@ -14,6 +15,7 @@ use { #[cfg(feature = "full")] pub mod impls; +#[skip_serializing_none] #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable, Selectable))] #[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))] diff --git a/crates/db_views_community_follower/Cargo.toml b/crates/db_views_community_follower/Cargo.toml index 383a2298a..183a3c761 100644 --- a/crates/db_views_community_follower/Cargo.toml +++ b/crates/db_views_community_follower/Cargo.toml @@ -32,6 +32,7 @@ lemmy_db_schema_file = { workspace = true } diesel = { workspace = true, optional = true } diesel-async = { workspace = true, optional = true } serde = { workspace = true } +serde_with = { workspace = true } ts-rs = { workspace = true, optional = true } i-love-jesus = { workspace = true, optional = true } chrono = { workspace = true } diff --git a/crates/db_views_community_follower/src/lib.rs b/crates/db_views_community_follower/src/lib.rs index 6428ab045..d7a272592 100644 --- a/crates/db_views_community_follower/src/lib.rs +++ b/crates/db_views_community_follower/src/lib.rs @@ -1,6 +1,7 @@ use lemmy_db_schema::source::{community::Community, person::Person}; use lemmy_db_schema_file::enums::CommunityFollowerState; use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; #[cfg(feature = "full")] use { diesel::{Queryable, Selectable}, @@ -22,6 +23,7 @@ pub struct CommunityFollowerView { pub follower: Person, } +#[skip_serializing_none] #[derive(Debug, Serialize, Deserialize, Clone)] #[cfg_attr(feature = "full", derive(TS, Queryable))] #[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]