diff --git a/src/database/models.rs b/src/database/models.rs index 7fe6194..b380bc3 100644 --- a/src/database/models.rs +++ b/src/database/models.rs @@ -2,6 +2,7 @@ #![allow(dead_code)] +use mongodb::bson::oid::ObjectId; use serde::{Deserialize, Serialize}; pub const COLLECTIONS_NAMES: [&str; 2] = ["guilds", "tags"]; @@ -20,6 +21,8 @@ pub struct GuildSettings { /// Server infos #[derive(Debug, Serialize, Deserialize)] pub struct Guild { + #[serde(rename = "_id", skip_serializing_if = "Option::is_none")] + id: Option, discord_guild_id: String, bot_settings: GuildSettings, } @@ -27,6 +30,8 @@ pub struct Guild { /// Tags #[derive(Debug, Serialize, Deserialize)] pub struct Tag { + #[serde(rename = "_id", skip_serializing_if = "Option::is_none")] + id: Option, name: String, guild: String, is_nsfw: bool,