Refactor for global error type

This commit is contained in:
2024-07-22 18:36:48 -04:00
Unverified
parent 4bd3112816
commit cb63e7d538
9 changed files with 48 additions and 37 deletions

View File

@@ -1,10 +1,11 @@
use chrono::{DateTime, TimeZone, Utc};
use tarpc::serde::{Deserialize, Serialize};
use realm_shared::types::ErrorCode;
#[tarpc::service]
pub trait RealmChat {
async fn test(name: String) -> String;
//TODO: Any user authorized as themselves
async fn send_message(auth_token: String, message: Message) -> Result<Message, ErrorCode>;
async fn start_typing(auth_token: String) -> ErrorCode;
@@ -28,15 +29,6 @@ pub trait RealmChat {
// unban user
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ErrorCode {
None,
Error,
Unauthorized,
NotFound,
FailedToUnwrapDB,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Message {
pub id: u32,