wip/kick #36

Merged
radical merged 9 commits from wip/kick into main 2025-07-22 16:56:37 +00:00
Showing only changes of commit 0468d1adca - Show all commits

View file

@ -11,11 +11,8 @@ use crate::{AppState, api::v1::auth::CurrentUser};
mod uuid;
pub fn router(app_state: Arc<AppState>) -> Router<Arc<AppState>> {
radical marked this conversation as resolved Outdated

this router should not have a layer and merging it with an empty router is pointless here, function body should be written as:

Router::new()
        .route("/{uuid}", get(uuid::get))
        .route("/{uuid}", delete(uuid::delete))

and the function should not need the app_state parameter

this router should not have a layer and merging it with an empty router is pointless here, function body should be written as: ```rs Router::new() .route("/{uuid}", get(uuid::get)) .route("/{uuid}", delete(uuid::delete)) ``` and the function should not need the `app_state` parameter
let router_with_auth = Router::new()
Router::new()
.route("/{uuid}", get(uuid::get))
.route("/{uuid}", delete(uuid::delete))
.layer(from_fn_with_state(app_state, CurrentUser::check_auth_layer));
Router::new()
.merge(router_with_auth)
.layer(from_fn_with_state(app_state, CurrentUser::check_auth_layer))
}