feat(models): adding models for sqlx in rust

This commit is contained in:
Raphael 2026-02-12 23:20:54 +01:00
parent d746e95b9e
commit 49eb9f5964
No known key found for this signature in database
4 changed files with 74 additions and 0 deletions

9
src/models/bot.rs Normal file
View file

@ -0,0 +1,9 @@
use sqlx::FromRow;
#[derive(Debug, FromRow)]
pub struct Bot {
pub id: i32,
pub status: String,
pub activity_type: String,
pub presence: String,
}

38
src/models/guild.rs Normal file
View file

@ -0,0 +1,38 @@
use sqlx::FromRow;
#[derive(Debug, FromRow)]
pub struct Guild {
pub guild_id: String,
// Logs
pub log_enable: bool,
pub log_category: Option<String>,
pub log_bot: Option<String>,
pub log_channels: Option<String>,
pub log_member: Option<String>,
pub log_mod: Option<String>,
pub log_msg: Option<String>,
pub log_server: Option<String>,
// Join/Leave
pub join_enabled: bool,
pub join_message: String,
pub join_channel: Option<String>,
pub leave_enabled: bool,
pub leave_message: String,
pub leave_channel: Option<String>,
// Protection
pub protect_enabled: bool,
pub protect_anti_channel: bool,
pub protect_anti_rank: bool,
pub protect_anti_perm: bool,
pub protect_anti_massban: bool,
pub protect_anti_mass_mention: bool,
pub protect_anti_bot: bool,
// Apparence
pub footer: String,
pub color: i32,
}

15
src/models/guild_user.rs Normal file
View file

@ -0,0 +1,15 @@
use sqlx::FromRow;
#[derive(Debug, FromRow)]
pub struct GuildUser {
pub id: i32,
pub user_id: String,
pub guild_id: String,
pub xp: i32,
pub level: i32,
pub is_wl_user: bool,
pub invitation_count: i32,
pub invited_by: Option<String>,
}

12
src/models/user.rs Normal file
View file

@ -0,0 +1,12 @@
use sqlx::FromRow;
#[derive(Debug, FromRow)]
pub struct User {
pub user_id: String,
pub is_owner: bool,
pub is_buyer: bool,
pub is_dev: bool,
pub is_enium: bool,
pub is_pwn: bool,
}