implemented use of auth on single room endpoint

This commit is contained in:
2025-09-25 06:00:09 +02:00
parent f315ffbe7b
commit 7828d4f515
6 changed files with 50 additions and 30 deletions

View File

@@ -1,15 +0,0 @@
use axum::{
routing::{get, //post
},
Router,
};
pub fn inventory_routes() -> Router {
Router::new()
.route("/", get(hi_inventory) )
}
async fn hi_inventory() -> &'static str {
"Hiii from inventory.rs route module"
}

View File

@@ -7,19 +7,26 @@ use r2d2::{Pool};
use crate::rooms::routes::rooms_routes;
use crate::utils::routes::utils_routes;
pub mod inventory;
use crate::utils::db_pool::{AppState};
//TODO: add secret fomr dotenv here
/*
Function to build our main router
that regroup all feature centered router
*/
pub fn create_router(state: AppState) -> Router {
Router::new()
.nest("/auth", utils_routes())
.with_state(state) // 👈 hotel_db is passed in as argument
.nest("/auth", utils_routes().with_state(state.clone()))
.nest("/rooms", rooms_routes().with_state(state.clone()))
.with_state(state)
}