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

@ -6,7 +6,11 @@ use serde::Deserialize;
mod uuid;
use crate::{
api::v1::auth::check_access_token, error::Error, structs::{Guild, StartAmountQuery}, utils::{get_auth_header, global_checks}, Data
Data,
api::v1::auth::check_access_token,
error::Error,
structs::{Guild, StartAmountQuery},
utils::{get_auth_header, global_checks},
};
#[derive(Deserialize)]
@ -22,16 +26,16 @@ pub fn web() -> Scope {
}
/// `POST /api/v1/guilds` Creates a new guild
///
///
/// requires auth: yes
///
///
/// ### Request Example
/// ```
/// json!({
/// "name": "My new server!"
/// });
/// ```
///
///
/// ### Response Example
/// ```
/// json!({
@ -59,22 +63,17 @@ pub async fn post(
let uuid = check_access_token(auth_header, &mut conn).await?;
let guild = Guild::new(
&mut conn,
guild_info.name.clone(),
uuid,
)
.await?;
let guild = Guild::new(&mut conn, guild_info.name.clone(), uuid).await?;
Ok(HttpResponse::Ok().json(guild))
}
/// `GET /api/v1/servers` Fetches all guilds
///
///
/// requires auth: yes
///
///
/// requires admin: yes
///
///
/// ### Response Example
/// ```
/// json!([

View file

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

View file

@ -5,13 +5,17 @@ use futures_util::StreamExt as _;
use uuid::Uuid;
use crate::{
api::v1::auth::check_access_token, error::Error, structs::{Guild, Member}, utils::{get_auth_header, global_checks}, Data
Data,
api::v1::auth::check_access_token,
error::Error,
structs::{Guild, Member},
utils::{get_auth_header, global_checks},
};
/// `PUT /api/v1/guilds/{uuid}/icon` Icon upload
///
///
/// requires auth: no
///
///
/// put request expects a file and nothing else
#[put("{uuid}/icon")]
pub async fn upload(

View file

@ -3,7 +3,11 @@ use serde::Deserialize;
use uuid::Uuid;
use crate::{
api::v1::auth::check_access_token, error::Error, structs::{Guild, Member}, utils::{get_auth_header, global_checks}, Data
Data,
api::v1::auth::check_access_token,
error::Error,
structs::{Guild, Member},
utils::{get_auth_header, global_checks},
};
#[derive(Deserialize)]

View file

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

View file

@ -6,11 +6,15 @@ use uuid::Uuid;
mod channels;
mod icon;
mod invites;
mod roles;
mod members;
mod roles;
use crate::{
api::v1::auth::check_access_token, error::Error, structs::{Guild, Member}, utils::{get_auth_header, global_checks}, Data
Data,
api::v1::auth::check_access_token,
error::Error,
structs::{Guild, Member},
utils::{get_auth_header, global_checks},
};
pub fn web() -> Scope {
@ -34,9 +38,9 @@ pub fn web() -> Scope {
}
/// `GET /api/v1/guilds/{uuid}` DESCRIPTION
///
///
/// requires auth: yes
///
///
/// ### Response Example
/// ```
/// json!({
@ -65,7 +69,7 @@ pub fn web() -> Scope {
/// ],
/// "member_count": 20
/// });
/// ```
/// ```
#[get("/{uuid}")]
pub async fn get(
req: HttpRequest,

View file

@ -3,7 +3,11 @@ use actix_web::{HttpRequest, HttpResponse, get, post, web};
use serde::Deserialize;
use crate::{
api::v1::auth::check_access_token, error::Error, structs::{Member, Role}, utils::{get_auth_header, global_checks, order_by_is_above}, Data
Data,
api::v1::auth::check_access_token,
error::Error,
structs::{Member, Role},
utils::{get_auth_header, global_checks, order_by_is_above},
};
pub mod uuid;

View file

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