style: 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-07-10 15:37:45 +02:00
parent e8b8b49643
commit e8a9857e19
13 changed files with 87 additions and 41 deletions

View file

@ -13,11 +13,11 @@ use crate::{
/// requires auth: kinda, needs refresh token set but no access token is technically required
///
/// ### Responses
///
///
/// 200 Logged out
///
///
/// 404 Refresh token is invalid
///
///
/// 401 Unauthorized (no refresh token found)
///
#[get("/logout")]
@ -38,7 +38,9 @@ pub async fn res(req: HttpRequest, data: web::Data<Data>) -> Result<HttpResponse
refresh_token_cookie.make_removal();
if deleted == 0 {
return Ok(HttpResponse::NotFound().cookie(refresh_token_cookie).finish())
return Ok(HttpResponse::NotFound()
.cookie(refresh_token_cookie)
.finish());
}
Ok(HttpResponse::Ok().cookie(refresh_token_cookie).finish())

View file

@ -26,13 +26,13 @@ struct Query {
///
/// ### Responses
/// 200 Success
///
///
/// 204 Already verified
///
///
/// 410 Token Expired
///
///
/// 404 Not Found
///
///
/// 401 Unauthorized
///
#[get("/verify-email")]
@ -74,11 +74,11 @@ pub async fn get(
///
/// ### Responses
/// 200 Email sent
///
///
/// 204 Already verified
///
///
/// 429 Too Many Requests
///
///
/// 401 Unauthorized
///
#[post("/verify-email")]

View file

@ -83,7 +83,9 @@ pub async fn ws(
let message_body: MessageBody = serde_json::from_str(&text)?;
let message = channel.new_message(&data, uuid, message_body.message, message_body.reply_to).await?;
let message = channel
.new_message(&data, uuid, message_body.message, message_body.reply_to)
.await?;
redis::cmd("PUBLISH")
.arg(&[channel_uuid.to_string(), serde_json::to_string(&message)?])

View file

@ -1,5 +1,9 @@
use crate::{
api::v1::auth::check_access_token, error::Error, objects::{Me, Member}, utils::{get_auth_header, global_checks}, Data
Data,
api::v1::auth::check_access_token,
error::Error,
objects::{Me, Member},
utils::{get_auth_header, global_checks},
};
use ::uuid::Uuid;
use actix_web::{HttpRequest, HttpResponse, get, web};

View file

@ -1,6 +1,6 @@
use ::uuid::Uuid;
use actix_web::{HttpRequest, HttpResponse, get, post, web};
use serde::Deserialize;
use ::uuid::Uuid;
pub mod uuid;
@ -51,13 +51,17 @@ struct UserReq {
///
/// ### Responses
/// 200 Success
///
///
/// 404 Not Found
///
///
/// 400 Bad Request (usually means users are already friends)
///
#[post("/friends")]
pub async fn post(req: HttpRequest, json: web::Json<UserReq>, data: web::Data<Data>) -> Result<HttpResponse, Error> {
pub async fn post(
req: HttpRequest,
json: web::Json<UserReq>,
data: web::Data<Data>,
) -> Result<HttpResponse, Error> {
let headers = req.headers();
let auth_header = get_auth_header(headers)?;

View file

@ -10,7 +10,11 @@ use crate::{
};
#[delete("/friends/{uuid}")]
pub async fn delete(req: HttpRequest, path: web::Path<(Uuid,)>, data: web::Data<Data>) -> Result<HttpResponse, Error> {
pub async fn delete(
req: HttpRequest,
path: web::Path<(Uuid,)>,
data: web::Data<Data>,
) -> Result<HttpResponse, Error> {
let headers = req.headers();
let auth_header = get_auth_header(headers)?;

View file

@ -10,8 +10,8 @@ use crate::{
utils::{get_auth_header, global_checks},
};
mod guilds;
mod friends;
mod guilds;
pub fn web() -> Scope {
web::scope("/me")

View file

@ -4,7 +4,11 @@ use actix_web::{HttpRequest, HttpResponse, get, web};
use uuid::Uuid;
use crate::{
api::v1::auth::check_access_token, error::Error, objects::{Me, User}, utils::{get_auth_header, global_checks}, Data
Data,
api::v1::auth::check_access_token,
error::Error,
objects::{Me, User},
utils::{get_auth_header, global_checks},
};
/// `GET /api/v1/users/{uuid}` Returns user with the given UUID