(feat) auth
This commit is contained in:
parent
15b92ba3a4
commit
0977d47ec2
17 changed files with 711 additions and 58 deletions
34
src/route.rs
34
src/route.rs
|
|
@ -1,24 +1,30 @@
|
|||
// src/route.rs
|
||||
// Почему это здесь?
|
||||
// - Это центр управления всеми HTTP маршрутами (роутами)
|
||||
// - Здесь объявляются все подмодули (handlers, будущие сервисы и т.д.)
|
||||
// - Здесь собирается финальный Router для Axum
|
||||
// src/route.rs
|
||||
|
||||
pub mod handlers; // Объявляем подмодуль handlers
|
||||
pub mod handlers;
|
||||
|
||||
use axum::{routing::get, Router};
|
||||
use axum::{routing::{get, post}, Router};
|
||||
use crate::state::AppState;
|
||||
|
||||
/// Создаёт и возвращает Router со всеми сконфигурированными роутами
|
||||
/// Функция принимает AppState и передаёт его всем handlers'ам
|
||||
pub fn router(app_state: AppState) -> Router {
|
||||
Router::new()
|
||||
// GET /api/health — health-check эндпоинт
|
||||
// Health check
|
||||
.route("/api/health", get(handlers::health_handler))
|
||||
.route("/api/test-token", get(handlers::test_token_handler))
|
||||
// Сюда добавим новые роуты по мере разработки:
|
||||
// .route("/api/accounts", get(handlers::accounts::get_accounts))
|
||||
// .route("/api/payments", post(handlers::payments::create_payment))
|
||||
|
||||
// Consent management
|
||||
.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)
|
||||
)
|
||||
|
||||
.with_state(app_state)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue