chore(core/models): add cfg_attr where necessary

This commit is contained in:
Paul Makles
2023-08-01 15:54:56 +01:00
parent a516c7adcf
commit 7318ec6ef6
2 changed files with 11 additions and 11 deletions

View File

@@ -65,16 +65,16 @@ auto_derived!(
/// Public Bot /// Public Bot
pub struct PublicBot { pub struct PublicBot {
/// Bot Id /// Bot Id
#[serde(rename = "_id")] #[cfg_attr(feature = "serde", serde(rename = "_id"))]
pub id: String, pub id: String,
/// Bot Username /// Bot Username
pub username: String, pub username: String,
/// Profile Avatar /// Profile Avatar
#[serde(skip_serializing_if = "String::is_empty")] #[cfg_attr(feature = "serde", serde(skip_serializing_if = "String::is_empty"))]
pub avatar: String, pub avatar: String,
/// Profile Description /// Profile Description
#[serde(skip_serializing_if = "String::is_empty")] #[cfg_attr(feature = "serde", serde(skip_serializing_if = "String::is_empty"))]
pub description: String, pub description: String,
} }

View File

@@ -2,7 +2,7 @@ auto_derived!(
/// File /// File
pub struct File { pub struct File {
/// Unique Id /// Unique Id
#[serde(rename = "_id")] #[cfg_attr(feature = "serde", serde(rename = "_id"))]
pub id: String, pub id: String,
/// Tag / bucket this file was uploaded to /// Tag / bucket this file was uploaded to
pub tag: String, pub tag: String,
@@ -16,29 +16,29 @@ auto_derived!(
pub size: isize, pub size: isize,
/// Whether this file was deleted /// Whether this file was deleted
#[serde(skip_serializing_if = "Option::is_none")] #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
pub deleted: Option<bool>, pub deleted: Option<bool>,
/// Whether this file was reported /// Whether this file was reported
#[serde(skip_serializing_if = "Option::is_none")] #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
pub reported: Option<bool>, pub reported: Option<bool>,
// TODO: migrate this mess to having: // TODO: migrate this mess to having:
// - author_id // - author_id
// - parent: Parent { Message(id), User(id), etc } // - parent: Parent { Message(id), User(id), etc }
#[serde(skip_serializing_if = "Option::is_none")] #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
pub message_id: Option<String>, pub message_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")] #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
pub user_id: Option<String>, pub user_id: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")] #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
pub server_id: Option<String>, pub server_id: Option<String>,
/// Id of the object this file is associated with /// Id of the object this file is associated with
#[serde(skip_serializing_if = "Option::is_none")] #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
pub object_id: Option<String>, pub object_id: Option<String>,
} }
/// Metadata associated with a file /// Metadata associated with a file
#[serde(tag = "type")] #[cfg_attr(feature = "serde", serde(tag = "type"))]
#[derive(Default)] #[derive(Default)]
pub enum Metadata { pub enum Metadata {
/// File is just a generic uncategorised file /// File is just a generic uncategorised file