46 lines
1.2 KiB
Rust
46 lines
1.2 KiB
Rust
use crate::schema::{invites, users, channels};
|
|
#[derive(Insertable, Serialize, Deserialize, Queryable, Debug)]
|
|
#[table_name = "invites"]
|
|
pub struct Invite {
|
|
pub id: u64,
|
|
pub expires: u64,
|
|
pub uses: i32,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Queryable, Insertable, Debug)]
|
|
#[table_name = "users"]
|
|
pub struct User {
|
|
pub userid: u64,
|
|
pub username: String,
|
|
pub key: String,
|
|
pub date: u64,
|
|
pub status: i32,
|
|
}
|
|
|
|
pub const USER_OFFLINE: i32 = 1;
|
|
pub const USER_ONLINE: i32 = 2;
|
|
pub const _USER_AWAY: i32 = 3;
|
|
pub const _USER_DO_NOT_DISTRUB: i32 = 4;
|
|
|
|
// These are to be use specifically for discerning between channel types
|
|
pub const VOICE_CHANNEL: i32 = 1;
|
|
pub const TEXT_CHANNEL: i32 = 2;
|
|
|
|
#[derive(Serialize, Deserialize, Queryable, Insertable)]
|
|
#[table_name = "channels" ]
|
|
pub struct Channel {
|
|
pub id: i32,
|
|
pub name: String,
|
|
pub permissions: i32,
|
|
pub limit: i32, // <= 0 means there is no limit
|
|
pub type_: i32, // 1 for voice 2 for text
|
|
}
|
|
|
|
#[derive(Insertable)]
|
|
#[table_name = "channels"]
|
|
pub struct InsertableChannel {
|
|
pub name: String,
|
|
pub permissions: i32,
|
|
pub limit: i32, // <= 0 means there is no limit
|
|
pub type_: i32, // 1 for voice 2 for text
|
|
} |