(refactor) removed username from logic
This commit is contained in:
parent
0977d47ec2
commit
e4cfc5eee5
15 changed files with 233 additions and 122 deletions
16
src/route.rs
16
src/route.rs
|
|
@ -2,29 +2,29 @@
|
|||
|
||||
pub mod handlers;
|
||||
|
||||
use axum::{routing::{get, post}, Router};
|
||||
use crate::state::AppState;
|
||||
use axum::{middleware, routing::{get, post}, Router};
|
||||
use crate::{state::AppState, auth};
|
||||
|
||||
pub fn router(app_state: AppState) -> Router {
|
||||
Router::new()
|
||||
// Health check
|
||||
// Public routes (no auth required)
|
||||
.route("/api/health", get(handlers::health_handler))
|
||||
.route("/api/auth/register", post(auth::handlers::register_handler))
|
||||
.route("/api/auth/login", post(auth::handlers::login_handler))
|
||||
|
||||
// Consent management
|
||||
// Protected routes (auth required)
|
||||
.route("/api/auth/me", get(auth::handlers::me_handler))
|
||||
.route("/api/consent/:bank/:user_id",
|
||||
post(handlers::create_consent_handler)
|
||||
.get(handlers::get_consent_handler)
|
||||
)
|
||||
|
||||
// Account access
|
||||
.route("/api/accounts/:bank/:user_id",
|
||||
get(handlers::get_accounts_handler)
|
||||
)
|
||||
|
||||
// Transaction access
|
||||
.route("/api/transactions/:bank/:user_id/:account_id",
|
||||
get(handlers::get_transactions_handler)
|
||||
)
|
||||
.layer(middleware::from_fn(auth::auth_middleware))
|
||||
|
||||
.with_state(app_state)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue