wip/kick #36

Merged
radical merged 9 commits from wip/kick into main 2025-07-22 16:56:37 +00:00
3 changed files with 4 additions and 5 deletions
Showing only changes of commit 31596c6bfe - Show all commits

View file

@ -10,9 +10,8 @@ use crate::{AppState, api::v1::auth::CurrentUser};
mod uuid; mod uuid;
pub fn router(app_state: Arc<AppState>) -> Router<Arc<AppState>> { pub fn router() -> Router<Arc<AppState>> {
Router::new() Router::new()
.route("/{uuid}", get(uuid::get)) .route("/{uuid}", get(uuid::get))
.route("/{uuid}", delete(uuid::delete)) .route("/{uuid}", delete(uuid::delete))
.layer(from_fn_with_state(app_state, CurrentUser::check_auth_layer))
} }

View file

@ -13,7 +13,7 @@ mod invites;
mod me; mod me;
mod stats; mod stats;
mod users; mod users;
mod member; mod members;
pub fn router(app_state: Arc<AppState>) -> Router<Arc<AppState>> { pub fn router(app_state: Arc<AppState>) -> Router<Arc<AppState>> {
let router_with_auth = Router::new() let router_with_auth = Router::new()
@ -29,7 +29,7 @@ pub fn router(app_state: Arc<AppState>) -> Router<Arc<AppState>> {
Router::new() Router::new()
.route("/stats", get(stats::res)) .route("/stats", get(stats::res))
.nest("/auth", auth::router(app_state.clone())) .nest("/auth", auth::router(app_state.clone()))
.nest("/channels", channels::router(app_state.clone())) .nest("/channels", channels::router(app_state))
.nest("/member", member::router(app_state)) .nest("/members", members::router())
radical marked this conversation as resolved Outdated

this should be moved to the router_with_auth instead as all endpoints inside /members needs auth, also it should be /members plural and not /member singular. This also goes for the folder/module name

this should be moved to the router_with_auth instead as all endpoints inside /members needs auth, also it should be `/members` plural and not `/member` singular. This also goes for the folder/module name

why plural, we are only accessing a single member

why plural, we are only accessing a single member

@baaboe wrote in #36 (comment):

why plural, we are only accessing a single member

Because it’s accessing a singular resource from the members resource collection. It’s a REST API thing.

@baaboe wrote in https://git.gorb.app/gorb/backend/pulls/36#issuecomment-831: > why plural, we are only accessing a single member Because it’s accessing a singular resource from the `members` resource *collection*. It’s a REST API thing.

/members contains all members, even though you're only accessing one, think of it like a folder tree with /members containing all of the members of every guild out there but you only have access to a subset of them

`/members` contains *all* members, even though you're only accessing one, think of it like a folder tree with /members containing all of the members of every guild out there but you only have access to a subset of them
.merge(router_with_auth) .merge(router_with_auth)
} }