style: cargo clippy && cargo fmt
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/push/publish-docs Pipeline was successful

This commit is contained in:
Radical 2025-05-30 21:17:30 +02:00
parent c9a3e8c6c4
commit d615f1392e
31 changed files with 288 additions and 181 deletions

View file

@ -1,7 +1,11 @@
//! `/api/v1/channels/{uuid}/messages` Endpoints related to channel messages
use crate::{
api::v1::auth::check_access_token, error::Error, structs::{Channel, Member}, utils::{get_auth_header, global_checks}, Data
Data,
api::v1::auth::check_access_token,
error::Error,
structs::{Channel, Member},
utils::{get_auth_header, global_checks},
};
use ::uuid::Uuid;
use actix_web::{HttpRequest, HttpResponse, get, web};
@ -14,11 +18,11 @@ struct MessageRequest {
}
/// `GET /api/v1/channels/{uuid}/messages` Returns user with the given UUID
///
///
/// requires auth: yes
///
///
/// requires relation: yes
///
///
/// ### Request Example
/// ```
/// json!({
@ -26,7 +30,7 @@ struct MessageRequest {
/// "offset": 0
/// })
/// ```
///
///
/// ### Response Example
/// ```
/// json!({
@ -42,7 +46,7 @@ struct MessageRequest {
/// }
/// });
/// ```
///
///
#[get("/{uuid}/messages")]
pub async fn get(
req: HttpRequest,

View file

@ -2,7 +2,11 @@ pub mod messages;
pub mod socket;
use crate::{
api::v1::auth::check_access_token, error::Error, structs::{Channel, Member}, utils::{get_auth_header, global_checks}, Data
Data,
api::v1::auth::check_access_token,
error::Error,
structs::{Channel, Member},
utils::{get_auth_header, global_checks},
};
use actix_web::{HttpRequest, HttpResponse, delete, get, web};
use uuid::Uuid;

View file

@ -8,7 +8,10 @@ use futures_util::StreamExt as _;
use uuid::Uuid;
use crate::{
api::v1::auth::check_access_token, structs::{Channel, Member}, utils::{get_ws_protocol_header, global_checks}, Data
Data,
api::v1::auth::check_access_token,
structs::{Channel, Member},
utils::{get_ws_protocol_header, global_checks},
};
#[get("/{uuid}/socket")]
@ -71,9 +74,7 @@ pub async fn ws(
Ok(AggregatedMessage::Text(text)) => {
let mut conn = data.cache_pool.get_multiplexed_tokio_connection().await?;
let message = channel
.new_message(&data, uuid, text.to_string())
.await?;
let message = channel.new_message(&data, uuid, text.to_string()).await?;
redis::cmd("PUBLISH")
.arg(&[channel_uuid.to_string(), serde_json::to_string(&message)?])