style: cargo fmt & clippy fixes
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
This commit is contained in:
parent
969b517e18
commit
a602c2624f
29 changed files with 216 additions and 86 deletions
|
@ -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)))
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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::{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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::{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue