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

This commit is contained in:
Radical 2025-07-20 16:30:46 +02:00
parent 969b517e18
commit a602c2624f
29 changed files with 216 additions and 86 deletions

View file

@ -2,16 +2,24 @@
use std::sync::Arc;
use ::uuid::Uuid;
use axum::{
extract::State, http::StatusCode, response::IntoResponse, routing::{get, post}, Extension, Json, Router
Extension, Json, Router,
extract::State,
http::StatusCode,
response::IntoResponse,
routing::{get, post},
};
use serde::Deserialize;
use ::uuid::Uuid;
mod uuid;
use crate::{
api::v1::auth::CurrentUser, error::Error, objects::{Guild, StartAmountQuery}, utils::global_checks, AppState
AppState,
api::v1::auth::CurrentUser,
error::Error,
objects::{Guild, StartAmountQuery},
utils::global_checks,
};
#[derive(Deserialize)]
@ -55,7 +63,12 @@ pub async fn new(
Extension(CurrentUser(uuid)): Extension<CurrentUser<Uuid>>,
Json(guild_info): Json<GuildInfo>,
) -> Result<impl IntoResponse, Error> {
let guild = Guild::new(&mut app_state.pool.get().await?, guild_info.name.clone(), uuid).await?;
let guild = Guild::new(
&mut app_state.pool.get().await?,
guild_info.name.clone(),
uuid,
)
.await?;
Ok((StatusCode::OK, Json(guild)))
}

View file

@ -2,12 +2,19 @@ use std::sync::Arc;
use ::uuid::Uuid;
use axum::{
extract::{Path, State}, http::StatusCode, response::IntoResponse, Extension, Json
Extension, Json,
extract::{Path, State},
http::StatusCode,
response::IntoResponse,
};
use serde::Deserialize;
use crate::{
api::v1::auth::CurrentUser, error::Error, objects::{Channel, Member, Permissions}, utils::{global_checks, order_by_is_above}, AppState
AppState,
api::v1::auth::CurrentUser,
error::Error,
objects::{Channel, Member, Permissions},
utils::{global_checks, order_by_is_above},
};
#[derive(Deserialize)]
@ -55,7 +62,8 @@ pub async fn create(
) -> Result<impl IntoResponse, Error> {
global_checks(&app_state, uuid).await?;
let member = Member::check_membership(&mut app_state.pool.get().await?, uuid, guild_uuid).await?;
let member =
Member::check_membership(&mut app_state.pool.get().await?, uuid, guild_uuid).await?;
member
.check_permission(&app_state, Permissions::ManageChannel)

View file

@ -1,7 +1,10 @@
use std::sync::Arc;
use axum::{
extract::{Path, State}, http::StatusCode, response::IntoResponse, Extension, Json
Extension, Json,
extract::{Path, State},
http::StatusCode,
response::IntoResponse,
};
use serde::Deserialize;
use uuid::Uuid;

View file

@ -2,7 +2,10 @@ use std::sync::Arc;
use ::uuid::Uuid;
use axum::{
extract::{Path, State}, http::StatusCode, response::IntoResponse, Extension, Json
Extension, Json,
extract::{Path, State},
http::StatusCode,
response::IntoResponse,
};
use crate::{

View file

@ -3,7 +3,11 @@
use std::sync::Arc;
use axum::{
extract::{Multipart, Path, State}, http::StatusCode, response::IntoResponse, routing::{get, patch, post}, Extension, Json, Router
Extension, Json, Router,
extract::{Multipart, Path, State},
http::StatusCode,
response::IntoResponse,
routing::{get, patch, post},
};
use bytes::Bytes;
use uuid::Uuid;

View file

@ -2,7 +2,10 @@ use std::sync::Arc;
use ::uuid::Uuid;
use axum::{
extract::{Path, State}, http::StatusCode, response::IntoResponse, Extension, Json
Extension, Json,
extract::{Path, State},
http::StatusCode,
response::IntoResponse,
};
use serde::Deserialize;

View file

@ -2,7 +2,10 @@ use std::sync::Arc;
use ::uuid::Uuid;
use axum::{
extract::{Path, State}, http::StatusCode, response::IntoResponse, Extension, Json
Extension, Json,
extract::{Path, State},
http::StatusCode,
response::IntoResponse,
};
use crate::{