Reordered state extractors.

This commit is contained in:
2026-10-12 18:19:15 +02:00
parent 2b37fd6ebc
commit 51a1b85429
7 changed files with 30 additions and 29 deletions
+9 -8
View File
@@ -32,9 +32,9 @@ pub struct QueryParams {
#[tracing::instrument(skip(pool))]
async fn list_account_members(
Auth(auth): Auth,
State(pool): State<PgPool>,
Path(account_id): Path<Uuid>,
Query(query): Query<QueryParams>,
State(pool): State<PgPool>,
) -> Result<Json<Vec<AccountMemberResponse>>, AppError> {
let user_id = auth.user_id();
@@ -63,13 +63,14 @@ async fn list_account_members(
#[tracing::instrument(skip(pool))]
async fn get_account_member(
Auth(auth): Auth,
State(pool): State<PgPool>,
Path((account_id, member_id)): Path<(Uuid, Uuid)>,
State(pool): State<PgPool>,
) -> Result<Json<AccountMemberResponse>, AppError> {
let member =
repository::account_members::get_by_id(&pool, auth.user_id(), account_id, member_id)
.await?
.ok_or(AppError::NotFound)?;
let user_id = auth.user_id();
let member = repository::account_members::get_by_id(&pool, user_id, account_id, member_id)
.await?
.ok_or(AppError::NotFound)?;
let users = repository::users::get_by_id(&pool, member.user_id)
.await?
.map(|user| HashMap::from([(user.id, user)]))
@@ -82,8 +83,8 @@ async fn get_account_member(
#[tracing::instrument(skip(pool, member))]
async fn upsert_account_member(
Auth(auth): Auth,
State(pool): State<PgPool>,
Path((account_id, member_id)): Path<(Uuid, Uuid)>,
State(pool): State<PgPool>,
Json(member): Json<AccountMemberRequest>,
) -> Result<(StatusCode, Json<AccountMemberResponse>), AppError> {
let user_id = auth.user_id();
@@ -115,8 +116,8 @@ async fn upsert_account_member(
#[tracing::instrument(skip(pool))]
async fn delete_account_member(
Auth(auth): Auth,
State(pool): State<PgPool>,
Path((account_id, member_id)): Path<(Uuid, Uuid)>,
State(pool): State<PgPool>,
) -> Result<StatusCode, AppError> {
let user_id = auth.user_id();