From 677d0a3b36354d028c1727e315b6388a544d86d3 Mon Sep 17 00:00:00 2001 From: shockrah Date: Wed, 29 Jul 2020 00:26:37 -0700 Subject: [PATCH] removing legacy code --- server/src/models.rs | 61 ------------------------------------------- server/src/payload.rs | 39 --------------------------- server/src/schema.rs | 42 ----------------------------- 3 files changed, 142 deletions(-) delete mode 100644 server/src/models.rs delete mode 100644 server/src/payload.rs delete mode 100644 server/src/schema.rs diff --git a/server/src/models.rs b/server/src/models.rs deleted file mode 100644 index fbe33e9..0000000 --- a/server/src/models.rs +++ /dev/null @@ -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, -} \ No newline at end of file diff --git a/server/src/payload.rs b/server/src/payload.rs deleted file mode 100644 index 3b06924..0000000 --- a/server/src/payload.rs +++ /dev/null @@ -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, -} diff --git a/server/src/schema.rs b/server/src/schema.rs deleted file mode 100644 index 7fc4738..0000000 --- a/server/src/schema.rs +++ /dev/null @@ -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, - expires -> Unsigned, - uses -> Integer, - } -} - -table! { - sessions (secret) { - secret -> Varchar, - expires -> Unsigned, - } -} - -table! { - users (id) { - id -> Unsigned, - name -> Varchar, - secret -> Varchar, - date -> Unsigned, - status -> Integer, - } -} - -allow_tables_to_appear_in_same_query!( - channels, - invites, - sessions, - users, -);