Add id to models
This commit is contained in:
parent
e12c3bfc3e
commit
3bf5008e39
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
use mongodb::bson::oid::ObjectId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
pub const COLLECTIONS_NAMES: [&str; 2] = ["guilds", "tags"];
|
pub const COLLECTIONS_NAMES: [&str; 2] = ["guilds", "tags"];
|
||||||
|
@ -20,6 +21,8 @@ pub struct GuildSettings {
|
||||||
/// Server infos
|
/// Server infos
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct Guild {
|
pub struct Guild {
|
||||||
|
#[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
|
||||||
|
id: Option<ObjectId>,
|
||||||
discord_guild_id: String,
|
discord_guild_id: String,
|
||||||
bot_settings: GuildSettings,
|
bot_settings: GuildSettings,
|
||||||
}
|
}
|
||||||
|
@ -27,6 +30,8 @@ pub struct Guild {
|
||||||
/// Tags
|
/// Tags
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct Tag {
|
pub struct Tag {
|
||||||
|
#[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
|
||||||
|
id: Option<ObjectId>,
|
||||||
name: String,
|
name: String,
|
||||||
guild: String,
|
guild: String,
|
||||||
is_nsfw: bool,
|
is_nsfw: bool,
|
||||||
|
|
Loading…
Reference in a new issue