Added initial authorization layer.

This commit is contained in:
2026-10-09 17:22:46 +02:00
parent 7fb3abc93d
commit 1f6de34e5b
16 changed files with 184 additions and 64 deletions
+5 -1
View File
@@ -7,7 +7,7 @@ use uuid::Uuid;
use super::{
dtos::transaction::{TransactionRequest, TransactionResponse},
extractors::{json::Json, path::Path, query::Query},
extractors::{auth::Auth, json::Json, path::Path, query::Query},
};
use crate::{
domain,
@@ -35,6 +35,7 @@ pub struct QueryParams {
#[axum::debug_handler]
#[tracing::instrument(skip(pool))]
async fn list_transactions(
Auth(auth): Auth,
State(pool): State<PgPool>,
Query(query): Query<QueryParams>,
) -> Result<Json<Vec<TransactionResponse>>, AppError> {
@@ -59,6 +60,7 @@ async fn list_transactions(
#[axum::debug_handler]
#[tracing::instrument(skip(pool))]
async fn get_transaction(
Auth(auth): Auth,
State(pool): State<PgPool>,
Path(id): Path<Uuid>,
) -> Result<Json<TransactionResponse>, AppError> {
@@ -76,6 +78,7 @@ async fn get_transaction(
#[axum::debug_handler]
#[tracing::instrument(skip(pool, transaction))]
async fn upsert_transaction(
Auth(auth): Auth,
State(pool): State<PgPool>,
Path(id): Path<Uuid>,
Json(transaction): Json<TransactionRequest>,
@@ -100,6 +103,7 @@ async fn upsert_transaction(
#[axum::debug_handler]
#[tracing::instrument(skip(pool))]
async fn delete_transaction(
Auth(auth): Auth,
Path(id): Path<Uuid>,
State(pool): State<PgPool>,
) -> Result<StatusCode, AppError> {