This commit is contained in:
pavel 2026-02-13 17:45:29 +01:00
commit c7a592933e
32 changed files with 7871 additions and 0 deletions

86
src/models.rs Normal file
View file

@ -0,0 +1,86 @@
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,
}