feat: Chat request implementation #14

Manually merged
awiteb merged 55 commits from awiteb/chat-request-and-response into master 2024-07-18 14:21:39 +02:00 AGit
3 changed files with 9 additions and 0 deletions
Showing only changes of commit 6f0b88afb1 - Show all commits

View file

@ -98,6 +98,7 @@ pub trait UsersStatusExt {
}
impl UsersStatusExt for DatabaseConnection {
#[logcall::logcall]
async fn is_whitelisted(
&self,
whitelister: &UserModel,
@ -114,6 +115,7 @@ impl UsersStatusExt for DatabaseConnection {
.map_err(Into::into)
}
#[logcall::logcall]
async fn is_blacklisted(
&self,
blacklister: &UserModel,
@ -130,6 +132,7 @@ impl UsersStatusExt for DatabaseConnection {
.map_err(Into::into)
}
#[logcall::logcall]
async fn add_to_whitelist(
&self,
whitelister: &UserModel,
@ -172,6 +175,7 @@ impl UsersStatusExt for DatabaseConnection {
Ok(())
}
#[logcall::logcall]
async fn add_to_blacklist(
&self,
blacklister: &UserModel,
@ -214,6 +218,7 @@ impl UsersStatusExt for DatabaseConnection {
Ok(())
}
#[logcall::logcall]
async fn remove_from_whitelist(
&self,
whitelister: &UserModel,
@ -232,6 +237,7 @@ impl UsersStatusExt for DatabaseConnection {
Ok(())
}
#[logcall::logcall]
async fn remove_from_blacklist(
&self,
blacklister: &UserModel,

View file

@ -31,6 +31,7 @@ use crate::websocket::errors::WsError;
/// Signed marker, used to indicate that the event is signed
pub struct Signed;
/// Unsigned marker, used to indicate that the event is unsigned
#[derive(Debug)]
pub struct Unsigned;
/// Server websocket event

View file

@ -32,6 +32,7 @@ use crate::{
};
/// Handle a chat request from a user.
#[logcall::logcall]
pub async fn handle_chat_request(
db: &DatabaseConnection,
from: Option<&UserModel>,
@ -78,6 +79,7 @@ pub async fn handle_chat_request(
None
}
#[logcall::logcall]
pub async fn handle_chat_response(
db: &DatabaseConnection,
recipient: Option<&UserModel>,