Update fields for backend/sqlx compatibility.

This commit is contained in:
Quat3rnion 2024-06-04 22:24:03 -04:00
parent 133b03f1c8
commit 450aa9f440
1 changed files with 16 additions and 6 deletions

View File

@ -5,7 +5,7 @@
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use crate::types::{Snowflake, WelcomeScreenObject, Shared};
use crate::types::{Snowflake, WelcomeScreenObject, Shared, InviteFlags, InviteType, InviteTargetType};
use super::guild::GuildScheduledEvent;
use super::{Application, Channel, GuildMember, NSFWLevel, User};
@ -13,25 +13,35 @@ use super::{Application, Channel, GuildMember, NSFWLevel, User};
/// Represents a code that when used, adds a user to a guild or group DM channel, or creates a relationship between two users.
/// See <https://discord-userdoccers.vercel.app/resources/invite#invite-object>
#[derive(Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "sqlx", derive(sqlx::FromRow))]
pub struct Invite {
pub approximate_member_count: Option<i32>,
pub approximate_presence_count: Option<i32>,
#[cfg_attr(feature = "sqlx", sqlx(skip))]
pub channel: Option<Channel>,
pub code: String,
pub created_at: Option<DateTime<Utc>>,
pub expires_at: Option<DateTime<Utc>>,
pub flags: Option<i32>,
pub flags: Option<InviteFlags>,
#[cfg_attr(feature = "sqlx", sqlx(skip))]
pub guild: Option<InviteGuild>,
pub guild_id: Option<Snowflake>,
#[cfg_attr(feature = "sqlx", sqlx(skip))]
pub guild_scheduled_event: Option<Shared<GuildScheduledEvent>>,
#[serde(rename = "type")]
pub invite_type: Option<i32>,
#[cfg_attr(feature = "sqlx", sqlx(rename = "type"))]
pub invite_type: Option<InviteType>,
#[cfg_attr(feature = "sqlx", sqlx(skip))]
pub inviter: Option<User>,
pub max_age: Option<i32>,
pub max_uses: Option<i32>,
pub max_age: Option<u32>,
pub max_uses: Option<u8>,
#[cfg_attr(feature = "sqlx", sqlx(skip))]
pub stage_instance: Option<InviteStageInstance>,
#[cfg_attr(feature = "sqlx", sqlx(skip))]
pub target_application: Option<Application>,
pub target_type: Option<i32>,
#[cfg_attr(feature = "sqlx", sqlx(rename = "target_user_type"))]
pub target_type: Option<InviteTargetType>,
#[cfg_attr(feature = "sqlx", sqlx(skip))]
pub target_user: Option<User>,
pub temporary: Option<bool>,
pub uses: Option<i32>,