discord/src/models.rs
pavel 33da605c03
All checks were successful
/ upload (release) Successful in 27s
soundboard
2026-02-24 01:41:24 +01:00

97 lines
2.3 KiB
Rust

use sea_orm::prelude::DateTimeWithTimeZone;
use serde::Serialize;
use uuid::Uuid;
#[derive(Debug, Clone, Serialize)]
pub struct User {
pub id: Uuid,
pub oidc_sub: String,
pub email: Option<String>,
pub display_name: String,
pub avatar_url: Option<String>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
}
#[derive(Debug, Clone, Serialize)]
pub struct Guild {
pub id: Uuid,
pub name: String,
pub owner_user_id: Uuid,
pub created_at: DateTimeWithTimeZone,
}
#[derive(Debug, Clone, Serialize)]
pub struct Channel {
pub id: Uuid,
pub guild_id: Uuid,
pub name: String,
pub kind: String,
pub created_at: DateTimeWithTimeZone,
}
#[derive(Debug, Clone, Serialize)]
pub struct Message {
pub id: Uuid,
pub channel_id: Uuid,
pub author_user_id: Uuid,
pub body: String,
pub created_at: DateTimeWithTimeZone,
}
#[derive(Debug, Clone, Serialize)]
pub struct BasicUser {
pub id: Uuid,
pub display_name: String,
pub avatar_url: Option<String>,
}
#[derive(Debug, Clone, Serialize, sea_orm::FromQueryResult)]
pub struct MessageWithAuthor {
pub id: Uuid,
pub channel_id: Uuid,
pub author_user_id: Uuid,
pub author_display_name: String,
pub body: String,
pub created_at: DateTimeWithTimeZone,
}
#[derive(Debug, Clone, Serialize)]
pub struct DmConversation {
pub user_id: Uuid,
pub display_name: String,
pub avatar_url: Option<String>,
pub last_message_at: DateTimeWithTimeZone,
}
#[derive(Debug, Clone, Serialize)]
pub struct DmMessageWithAuthor {
pub id: Uuid,
pub author_user_id: Uuid,
pub recipient_user_id: Uuid,
pub author_display_name: String,
pub body: String,
pub created_at: DateTimeWithTimeZone,
}
#[derive(Debug, Clone, Serialize)]
pub struct Invite {
pub code: String,
pub guild_id: Uuid,
pub created_by_user_id: Uuid,
pub created_at: DateTimeWithTimeZone,
pub expires_at: Option<DateTimeWithTimeZone>,
pub max_uses: Option<i32>,
pub use_count: i32,
}
#[derive(Debug, Clone, Serialize)]
pub struct SoundboardSound {
pub id: Uuid,
pub guild_id: Uuid,
pub name: String,
pub icon: String,
pub file_path: String,
pub created_by_user_id: Uuid,
pub created_at: DateTimeWithTimeZone,
}