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

@ -4,9 +4,16 @@ use std::{
};
use axum::{
extract::{Request, State}, middleware::{from_fn_with_state, Next}, response::IntoResponse, routing::{delete, get, post}, Router
Router,
extract::{Request, State},
middleware::{Next, from_fn_with_state},
response::IntoResponse,
routing::{delete, get, post},
};
use axum_extra::{
TypedHeader,
headers::{Authorization, authorization::Bearer},
};
use axum_extra::{headers::{authorization::Bearer, Authorization}, TypedHeader};
use diesel::{ExpressionMethods, QueryDsl};
use diesel_async::RunQueryDsl;
use serde::Serialize;
@ -23,14 +30,12 @@ mod reset_password;
mod revoke;
mod verify_email;
#[derive(Serialize)]
pub struct Response {
access_token: String,
device_name: String,
}
pub fn router(app_state: Arc<AppState>) -> Router<Arc<AppState>> {
let router_with_auth = Router::new()
.route("/verify-email", get(verify_email::get))
@ -82,9 +87,10 @@ impl CurrentUser<Uuid> {
State(app_state): State<Arc<AppState>>,
TypedHeader(auth): TypedHeader<Authorization<Bearer>>,
mut req: Request,
next: Next
next: Next,
) -> Result<impl IntoResponse, Error> {
let current_user = CurrentUser(check_access_token(auth.token(), &mut app_state.pool.get().await?).await?);
let current_user =
CurrentUser(check_access_token(auth.token(), &mut app_state.pool.get().await?).await?);
req.extensions_mut().insert(current_user);
Ok(next.run(req).await)