Skip to content

Commit

Permalink
chore(core/models): add cfg_attr where necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
insertish committed Aug 1, 2023
1 parent a516c7a commit 7318ec6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions crates/core/models/src/v0/bots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ auto_derived!(
/// Public Bot
pub struct PublicBot {
/// Bot Id
#[serde(rename = "_id")]
#[cfg_attr(feature = "serde", serde(rename = "_id"))]
pub id: String,

/// Bot Username
pub username: String,
/// Profile Avatar
#[serde(skip_serializing_if = "String::is_empty")]
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "String::is_empty"))]
pub avatar: String,
/// Profile Description
#[serde(skip_serializing_if = "String::is_empty")]
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "String::is_empty"))]
pub description: String,
}

Expand Down
16 changes: 8 additions & 8 deletions crates/core/models/src/v0/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ auto_derived!(
/// File
pub struct File {
/// Unique Id
#[serde(rename = "_id")]
#[cfg_attr(feature = "serde", serde(rename = "_id"))]
pub id: String,
/// Tag / bucket this file was uploaded to
pub tag: String,
Expand All @@ -16,29 +16,29 @@ auto_derived!(
pub size: isize,

/// 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>,
/// 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>,

// TODO: migrate this mess to having:
// - author_id
// - 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>,
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
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>,

/// 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>,
}

/// Metadata associated with a file
#[serde(tag = "type")]
#[cfg_attr(feature = "serde", serde(tag = "type"))]
#[derive(Default)]
pub enum Metadata {
/// File is just a generic uncategorised file
Expand Down

0 comments on commit 7318ec6

Please sign in to comment.