feat: Chat request implementation #14
3 changed files with 9 additions and 0 deletions
|
@ -98,6 +98,7 @@ pub trait UsersStatusExt {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UsersStatusExt for DatabaseConnection {
|
impl UsersStatusExt for DatabaseConnection {
|
||||||
|
#[logcall::logcall]
|
||||||
async fn is_whitelisted(
|
async fn is_whitelisted(
|
||||||
&self,
|
&self,
|
||||||
whitelister: &UserModel,
|
whitelister: &UserModel,
|
||||||
|
@ -114,6 +115,7 @@ impl UsersStatusExt for DatabaseConnection {
|
||||||
.map_err(Into::into)
|
.map_err(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[logcall::logcall]
|
||||||
async fn is_blacklisted(
|
async fn is_blacklisted(
|
||||||
&self,
|
&self,
|
||||||
blacklister: &UserModel,
|
blacklister: &UserModel,
|
||||||
|
@ -130,6 +132,7 @@ impl UsersStatusExt for DatabaseConnection {
|
||||||
.map_err(Into::into)
|
.map_err(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[logcall::logcall]
|
||||||
async fn add_to_whitelist(
|
async fn add_to_whitelist(
|
||||||
&self,
|
&self,
|
||||||
whitelister: &UserModel,
|
whitelister: &UserModel,
|
||||||
|
@ -172,6 +175,7 @@ impl UsersStatusExt for DatabaseConnection {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[logcall::logcall]
|
||||||
async fn add_to_blacklist(
|
async fn add_to_blacklist(
|
||||||
&self,
|
&self,
|
||||||
blacklister: &UserModel,
|
blacklister: &UserModel,
|
||||||
|
@ -214,6 +218,7 @@ impl UsersStatusExt for DatabaseConnection {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[logcall::logcall]
|
||||||
async fn remove_from_whitelist(
|
async fn remove_from_whitelist(
|
||||||
&self,
|
&self,
|
||||||
whitelister: &UserModel,
|
whitelister: &UserModel,
|
||||||
|
@ -232,6 +237,7 @@ impl UsersStatusExt for DatabaseConnection {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[logcall::logcall]
|
||||||
async fn remove_from_blacklist(
|
async fn remove_from_blacklist(
|
||||||
&self,
|
&self,
|
||||||
blacklister: &UserModel,
|
blacklister: &UserModel,
|
||||||
|
|
|
@ -31,6 +31,7 @@ use crate::websocket::errors::WsError;
|
||||||
/// Signed marker, used to indicate that the event is signed
|
/// Signed marker, used to indicate that the event is signed
|
||||||
pub struct Signed;
|
pub struct Signed;
|
||||||
/// Unsigned marker, used to indicate that the event is unsigned
|
/// Unsigned marker, used to indicate that the event is unsigned
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Unsigned;
|
pub struct Unsigned;
|
||||||
|
|
||||||
/// Server websocket event
|
/// Server websocket event
|
||||||
|
|
|
@ -32,6 +32,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Handle a chat request from a user.
|
/// Handle a chat request from a user.
|
||||||
|
#[logcall::logcall]
|
||||||
pub async fn handle_chat_request(
|
pub async fn handle_chat_request(
|
||||||
db: &DatabaseConnection,
|
db: &DatabaseConnection,
|
||||||
from: Option<&UserModel>,
|
from: Option<&UserModel>,
|
||||||
|
@ -78,6 +79,7 @@ pub async fn handle_chat_request(
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[logcall::logcall]
|
||||||
pub async fn handle_chat_response(
|
pub async fn handle_chat_response(
|
||||||
db: &DatabaseConnection,
|
db: &DatabaseConnection,
|
||||||
recipient: Option<&UserModel>,
|
recipient: Option<&UserModel>,
|
||||||
|
|
Loading…
Reference in a new issue