From 7fb6dd17150412e73dc22e28b0427ee1684a8462 Mon Sep 17 00:00:00 2001 From: Joshua Higgins Date: Sat, 27 Jul 2024 13:40:49 -0400 Subject: [PATCH] Switch types to match DB --- server/src/server.rs | 4 ++-- server/src/types.rs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/src/server.rs b/server/src/server.rs index 32017a1..927b111 100644 --- a/server/src/server.rs +++ b/server/src/server.rs @@ -15,7 +15,7 @@ pub struct RealmChatServer { pub server_id: String, pub socket: SocketAddr, pub db_pool: Pool, - pub typing_users: Vec<(u32, u32)> //NOTE: userid, roomid + pub typing_users: Vec<(i64, i64)> //NOTE: userid, roomid } //TODO: Cache for auth impl RealmChat for RealmChatServer { @@ -77,7 +77,7 @@ impl RealmChat for RealmChatServer { todo!() } - async fn get_message_from_id(self, _: Context, auth_token: String, id: u32) -> Result { + async fn get_message_from_id(self, _: Context, auth_token: String, id: i64) -> Result { //TODO: Auth for admin room let result = sqlx::query("SELECT message.*, room.id AS 'room_id', room.roomid AS 'room_roomid', room.name AS 'room_name', room.admin_only_send AS 'room_admin_only_send', room.admin_only_view AS 'room_admin_only_view', diff --git a/server/src/types.rs b/server/src/types.rs index 3d84df8..55864aa 100644 --- a/server/src/types.rs +++ b/server/src/types.rs @@ -18,7 +18,7 @@ pub trait RealmChat { async fn keep_typing(auth_token: String) -> ErrorCode; //NOTE: If a keep alive hasn't been received in 5 seconds, stop typing //NOTE: Any user can call, if they are in the server - async fn get_message_from_id(auth_token: String, id: u32) -> Result; + async fn get_message_from_id(auth_token: String, id: i64) -> Result; async fn get_messages_since(auth_token: String, time: DateTime) -> Result, ErrorCode>; async fn get_rooms(auth_token: String) -> Result, ErrorCode>; async fn get_room(auth_token: String, roomid: String) -> Result; @@ -106,25 +106,25 @@ pub struct Attachment { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Reply { - pub referencing_id: u32, + pub referencing_id: i64, pub text: String, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Edit { - pub referencing_id: u32, + pub referencing_id: i64, pub text: String, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Reaction { - pub referencing_id: u32, + pub referencing_id: i64, pub emoji: String } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Redaction { - pub referencing_id: u32, + pub referencing_id: i64, } #[derive(Debug, Clone, Serialize, Deserialize, FromRow)]