removing legacy code
This commit is contained in:
parent
351a9ba30c
commit
677d0a3b36
@ -1,61 +0,0 @@
|
|||||||
use crate::schema::{invites, users, channels, sessions};
|
|
||||||
#[derive(Insertable, Serialize, Deserialize, Queryable, Debug)]
|
|
||||||
#[table_name = "invites"]
|
|
||||||
pub struct Invite {
|
|
||||||
pub id: u64,
|
|
||||||
pub expires: u64,
|
|
||||||
pub uses: i32,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Insertable)]
|
|
||||||
#[table_name = "users"]
|
|
||||||
pub struct InsertableUser {
|
|
||||||
pub name: String,
|
|
||||||
pub secret: String,
|
|
||||||
pub date: u64,
|
|
||||||
pub status: i32,
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: Insertable is the only rls stop complaining at us about `table_name` not being found in scope
|
|
||||||
// its dumb but its how we're going to compile this, with some dead code
|
|
||||||
#[derive(Insertable, Serialize, Deserialize, Queryable, Debug)]
|
|
||||||
#[table_name = "users"]
|
|
||||||
pub struct User {
|
|
||||||
pub id: u64,
|
|
||||||
pub name: String,
|
|
||||||
pub secret: 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;
|
|
||||||
|
|
||||||
#[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
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Insertable)]
|
|
||||||
#[table_name = "sessions"]
|
|
||||||
pub struct InsertableSession {
|
|
||||||
pub secret: String,
|
|
||||||
pub expires: u64,
|
|
||||||
}
|
|
@ -1,39 +0,0 @@
|
|||||||
/* Module containg various structure which we use to pass back
|
|
||||||
* and forth from client/server as auth tokens
|
|
||||||
*/
|
|
||||||
|
|
||||||
// This structure allows us to provide some critical data for the client to reconnect to
|
|
||||||
// the server without having to go through a sign in process everytime
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
|
||||||
pub struct NewUserResponse {
|
|
||||||
pub id: u64,
|
|
||||||
pub secret: String,
|
|
||||||
pub discriminator: i32,
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is basically anyone that's online at the moment
|
|
||||||
#[derive(Serialize, Debug)]
|
|
||||||
pub struct OnlineUser {
|
|
||||||
pub id: u64,
|
|
||||||
pub username: String,
|
|
||||||
status: i32,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
|
||||||
pub struct ChannelIndexed {
|
|
||||||
pub name: String,
|
|
||||||
pub ctype: i32,
|
|
||||||
}
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
|
||||||
pub struct VoiceChannel {
|
|
||||||
pub id: i32,
|
|
||||||
pub name: String,
|
|
||||||
pub usercount: i32, // how many people are in the channel at that moment
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
|
||||||
pub struct TextChannel {
|
|
||||||
pub id: i32,
|
|
||||||
pub name: String,
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
table! {
|
|
||||||
channels (id) {
|
|
||||||
id -> Integer,
|
|
||||||
name -> Varchar,
|
|
||||||
permissions -> Integer,
|
|
||||||
limit -> Integer,
|
|
||||||
#[sql_name = "type"]
|
|
||||||
type_ -> Integer,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
table! {
|
|
||||||
invites (id) {
|
|
||||||
id -> Unsigned<Bigint>,
|
|
||||||
expires -> Unsigned<Bigint>,
|
|
||||||
uses -> Integer,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
table! {
|
|
||||||
sessions (secret) {
|
|
||||||
secret -> Varchar,
|
|
||||||
expires -> Unsigned<Bigint>,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
table! {
|
|
||||||
users (id) {
|
|
||||||
id -> Unsigned<Bigint>,
|
|
||||||
name -> Varchar,
|
|
||||||
secret -> Varchar,
|
|
||||||
date -> Unsigned<Bigint>,
|
|
||||||
status -> Integer,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
allow_tables_to_appear_in_same_query!(
|
|
||||||
channels,
|
|
||||||
invites,
|
|
||||||
sessions,
|
|
||||||
users,
|
|
||||||
);
|
|
Loading…
Reference in New Issue
Block a user