fix(saas): 清理 role/mod.rs 重复路由定义

移除重复的 routes() 函数,将 get_role_permissions 路由指向 handlers_ext
This commit is contained in:
iven
2026-03-29 19:23:40 +08:00
parent 8b9d506893
commit 77374121dd

View File

@@ -3,7 +3,6 @@
pub mod types; pub mod types;
pub mod service; pub mod service;
pub mod handlers; pub mod handlers;
pub mod handlers_ext; pub mod handlers_ext;
use axum::routing::{get, post}; use axum::routing::{get, post};
@@ -16,16 +15,5 @@ pub fn routes() -> axum::Router<AppState> {
.route("/api/v1/permission-templates", get(handlers::list_templates).post(handlers::create_template)) .route("/api/v1/permission-templates", get(handlers::list_templates).post(handlers::create_template))
.route("/api/v1/permission-templates/:id", get(handlers::get_template).delete(handlers::delete_template)) .route("/api/v1/permission-templates/:id", get(handlers::get_template).delete(handlers::delete_template))
.route("/api/v1/permission-templates/:id/apply", post(handlers::apply_template)) .route("/api/v1/permission-templates/:id/apply", post(handlers::apply_template))
.route("/api/v1/roles/:id/permissions", get(handlers::get_role_permissions)) .route("/api/v1/roles/:id/permissions", get(handlers_ext::get_role_permissions))
handlers
}use axum::routing::{get, post};
use crate::state::AppState;
pub fn routes() -> axum::Router<AppState> {
axum::Router::new()
.route("/api/v1/roles", get(handlers::list_roles).post(handlers::create_role))
.route("/api/v1/roles/:id", get(handlers::get_role).put(handlers::update_role).delete(handlers::delete_role))
.route("/api/v1/permission-templates", get(handlers::list_templates).post(handlers::create_template))
.route("/api/v1/permission-templates/:id", get(handlers::get_template).delete(handlers::delete_template))
.route("/api/v1/permission-templates/:id/apply", post(handlers::apply_template))
} }