Skip to main content

revolt_database/models/account_invites/
model.rs

1use crate::{if_false, Database};
2use revolt_result::Result;
3
4auto_derived_partial!(
5    /// Account invite ticket
6    pub struct AccountInvite {
7        /// Invite code
8        #[serde(rename = "_id")]
9        pub id: String,
10        /// Whether this invite ticket has been used
11        #[serde(skip_serializing_if = "if_false", default)]
12        pub used: bool,
13        /// User ID that this invite was claimed by
14        #[serde(skip_serializing_if = "Option::is_none")]
15        pub claimed_by: Option<String>,
16    },
17    "PartialAccountInvite"
18);
19
20impl AccountInvite {
21    /// Save model
22    pub async fn save(&self, db: &Database) -> Result<()> {
23        db.save_account_invite(self).await
24    }
25}