From f343f6d252d2392c68348f46f502cf8c4fed9c2b Mon Sep 17 00:00:00 2001 From: shockrah Date: Tue, 17 Mar 2020 21:34:32 -0700 Subject: [PATCH] new field for online status of users new short structure describing online users --- server/migrations/2020-02-04-083551_users/up.sql | 1 + server/src/models.rs | 6 ++++++ server/src/payload.rs | 1 + server/src/schema.rs | 1 + 4 files changed, 9 insertions(+) diff --git a/server/migrations/2020-02-04-083551_users/up.sql b/server/migrations/2020-02-04-083551_users/up.sql index fafecad..8e416ee 100644 --- a/server/migrations/2020-02-04-083551_users/up.sql +++ b/server/migrations/2020-02-04-083551_users/up.sql @@ -8,5 +8,6 @@ CREATE TABLE IF NOT EXISTS `users` ( `username` varchar(255) NOT NULL, `key` varchar(255) NOT NULL, `date` bigint UNSIGNED NOT NULL, + `status` int NOT NULL, PRIMARY KEY( `userid` ) ); \ No newline at end of file diff --git a/server/src/models.rs b/server/src/models.rs index b9f0e74..3062344 100644 --- a/server/src/models.rs +++ b/server/src/models.rs @@ -14,8 +14,14 @@ pub struct User { 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; diff --git a/server/src/payload.rs b/server/src/payload.rs index b20c898..7e6b4c2 100644 --- a/server/src/payload.rs +++ b/server/src/payload.rs @@ -15,6 +15,7 @@ pub struct NewUserResponse { } // This is basically anyone that's online at the moment +#[derive(Serialize, Debug)] pub struct OnlineUser { pub id: u64, pub username: String, diff --git a/server/src/schema.rs b/server/src/schema.rs index 58b6e9c..22bc4e5 100644 --- a/server/src/schema.rs +++ b/server/src/schema.rs @@ -23,6 +23,7 @@ table! { username -> Varchar, key -> Varchar, date -> Unsigned, + status -> Integer, } }