feat: Add axum-extra dependency and implement typed headers

feat: Define unique index on users table for email and fix minor syntax error

refactor: Update permissions_guard to use claims from JWT and improve user retrieval

refactor: Modify user-related service methods to accept user details directly

fix: Update token generation functions to include user ID and permissions

test: Update Google OAuth flow tests to reflect changes in token generation
This commit is contained in:
MythEclipse
2025-08-14 22:46:42 +07:00
parent 89ef48a57e
commit 199d0c885e
17 changed files with 305 additions and 234 deletions
@@ -25,13 +25,13 @@ pub async fn get_detail_gacha_claim(
Path(id): Path<String>,
) -> impl IntoResponse {
match permissions_guard(
&headers,
state.clone(),
headers,
Extension(state),
vec![PermissionsEnum::ReadDetailGachaClaims],
)
.await
{
Ok(_) => GachaClaimService::get_gacha_claim_by_id(&state, id).await,
Ok((_user, state)) => GachaClaimService::get_gacha_claim_by_id(&state, id).await,
Err(response) => response,
}
}
@@ -54,13 +54,13 @@ pub async fn post_create_gacha_claim(
Json(payload): Json<GachaClaimRequestDto>,
) -> impl IntoResponse {
match permissions_guard(
&headers,
state.clone(),
headers,
Extension(state),
vec![PermissionsEnum::CreateGachaClaims],
)
.await
{
Ok(_) => GachaClaimService::create_gacha_claim(&state, payload).await,
Ok((_user, state)) => GachaClaimService::create_gacha_claim(&state, payload).await,
Err(response) => response,
}
}