Added initial authorization layer.
This commit is contained in:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user