mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-09 10:57:03 +08:00
refactor: 拆分 admin handler 大文件为模块目录,消除 shared.rs 反模式
- endpoint_keys/pool/architecture 等大文件拆分为独立模块目录 - 删除 crud/query/strategy/system 中的 shared.rs,内容归位到各自模块 - endpoints_admin/models/oauth/write 等模块拆出 payloads/responses/support 子文件 - system/core 下多个 *_routes.rs 合并到 system_routes.rs - 更新 refactor-execution-plan 文档进度
This commit is contained in:
@@ -1 +0,0 @@
|
||||
pub(super) use crate::handlers::admin::system::maybe_build_local_admin_management_tokens_response as maybe_build_local_admin_core_management_tokens_response;
|
||||
@@ -5,7 +5,6 @@ use axum::{
|
||||
http,
|
||||
response::Response,
|
||||
};
|
||||
|
||||
const ADMIN_AWS_REGIONS: &[&str] = &[
|
||||
"af-south-1",
|
||||
"ap-east-1",
|
||||
@@ -37,10 +36,6 @@ const ADMIN_AWS_REGIONS: &[&str] = &[
|
||||
"us-west-1",
|
||||
"us-west-2",
|
||||
];
|
||||
mod management_tokens_routes;
|
||||
mod model_routes;
|
||||
mod modules_routes;
|
||||
mod oauth_routes;
|
||||
mod system_routes;
|
||||
|
||||
pub(crate) async fn maybe_build_local_admin_core_response(
|
||||
@@ -49,7 +44,7 @@ pub(crate) async fn maybe_build_local_admin_core_response(
|
||||
request_body: Option<&Bytes>,
|
||||
) -> Result<Option<Response<Body>>, GatewayError> {
|
||||
if let Some(response) =
|
||||
management_tokens_routes::maybe_build_local_admin_core_management_tokens_response(
|
||||
crate::handlers::admin::system::maybe_build_local_admin_management_tokens_response(
|
||||
state,
|
||||
request_context,
|
||||
)
|
||||
@@ -57,7 +52,7 @@ pub(crate) async fn maybe_build_local_admin_core_response(
|
||||
{
|
||||
return Ok(Some(response));
|
||||
}
|
||||
if let Some(response) = oauth_routes::maybe_build_local_admin_core_oauth_response(
|
||||
if let Some(response) = crate::handlers::admin::auth::maybe_build_local_admin_oauth_response(
|
||||
state,
|
||||
request_context,
|
||||
request_body,
|
||||
@@ -66,12 +61,13 @@ pub(crate) async fn maybe_build_local_admin_core_response(
|
||||
{
|
||||
return Ok(Some(response));
|
||||
}
|
||||
if let Some(response) = modules_routes::maybe_build_local_admin_core_modules_response(
|
||||
state,
|
||||
request_context,
|
||||
request_body,
|
||||
)
|
||||
.await?
|
||||
if let Some(response) =
|
||||
crate::handlers::admin::system::maybe_build_local_admin_modules_response(
|
||||
state,
|
||||
request_context,
|
||||
request_body,
|
||||
)
|
||||
.await?
|
||||
{
|
||||
return Ok(Some(response));
|
||||
}
|
||||
@@ -85,7 +81,11 @@ pub(crate) async fn maybe_build_local_admin_core_response(
|
||||
return Ok(Some(response));
|
||||
}
|
||||
if let Some(response) =
|
||||
model_routes::maybe_build_local_admin_core_model_response(state, request_context).await?
|
||||
crate::handlers::admin::model::maybe_build_local_admin_model_catalog_response(
|
||||
state,
|
||||
request_context,
|
||||
)
|
||||
.await?
|
||||
{
|
||||
return Ok(Some(response));
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
pub(super) use crate::handlers::admin::model::maybe_build_local_admin_model_catalog_response as maybe_build_local_admin_core_model_response;
|
||||
@@ -1 +0,0 @@
|
||||
pub(super) use crate::handlers::admin::system::maybe_build_local_admin_modules_response as maybe_build_local_admin_core_modules_response;
|
||||
@@ -1 +0,0 @@
|
||||
pub(super) use crate::handlers::admin::auth::maybe_build_local_admin_oauth_response as maybe_build_local_admin_core_oauth_response;
|
||||
@@ -2,18 +2,24 @@ use super::ADMIN_AWS_REGIONS;
|
||||
use crate::control::GatewayPublicRequestContext;
|
||||
use crate::handlers::admin::shared::attach_admin_audit_response;
|
||||
use crate::handlers::admin::shared::build_proxy_error_response;
|
||||
use crate::handlers::admin::system::shared::{
|
||||
use crate::handlers::admin::system::shared::configs::{
|
||||
apply_admin_system_config_update, build_admin_system_config_detail_payload,
|
||||
build_admin_system_config_export_payload, build_admin_system_configs_payload,
|
||||
build_admin_system_users_export_payload, delete_admin_system_config,
|
||||
};
|
||||
use crate::handlers::admin::system::shared::email_templates::{
|
||||
apply_admin_email_template_update, build_admin_email_template_payload,
|
||||
build_admin_email_templates_payload, preview_admin_email_template, reset_admin_email_template,
|
||||
};
|
||||
use crate::handlers::admin::system::shared::paths::{
|
||||
admin_system_config_key_from_path, admin_system_email_template_preview_type_from_path,
|
||||
admin_system_email_template_reset_type_from_path, admin_system_email_template_type_from_path,
|
||||
apply_admin_email_template_update, apply_admin_system_config_update,
|
||||
apply_admin_system_settings_update, build_admin_api_formats_payload,
|
||||
build_admin_email_template_payload, build_admin_email_templates_payload,
|
||||
build_admin_system_check_update_payload, build_admin_system_config_detail_payload,
|
||||
build_admin_system_config_export_payload, build_admin_system_configs_payload,
|
||||
build_admin_system_settings_payload, build_admin_system_stats_payload,
|
||||
build_admin_system_users_export_payload, current_aether_version, delete_admin_system_config,
|
||||
is_admin_system_configs_root, is_admin_system_email_templates_root,
|
||||
preview_admin_email_template, reset_admin_email_template,
|
||||
};
|
||||
use crate::handlers::admin::system::shared::settings::{
|
||||
apply_admin_system_settings_update, build_admin_api_formats_payload,
|
||||
build_admin_system_check_update_payload, build_admin_system_settings_payload,
|
||||
build_admin_system_stats_payload, current_aether_version,
|
||||
};
|
||||
use crate::{AppState, GatewayError};
|
||||
use axum::{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::control::GatewayPublicRequestContext;
|
||||
use crate::handlers::admin::shared::{query_param_optional_bool, query_param_value};
|
||||
use crate::handlers::admin::system::shared::{
|
||||
use crate::handlers::admin::system::shared::paths::{
|
||||
admin_management_token_id_from_path, admin_management_token_status_id_from_path,
|
||||
is_admin_management_tokens_root,
|
||||
};
|
||||
|
||||
@@ -2,7 +2,6 @@ mod adaptive;
|
||||
mod core;
|
||||
mod management_tokens;
|
||||
mod modules;
|
||||
mod pool;
|
||||
mod proxy_nodes;
|
||||
pub(crate) mod shared;
|
||||
|
||||
@@ -10,5 +9,5 @@ pub(crate) use self::adaptive::maybe_build_local_admin_adaptive_response;
|
||||
pub(crate) use self::core::maybe_build_local_admin_core_response;
|
||||
pub(crate) use self::management_tokens::maybe_build_local_admin_management_tokens_response;
|
||||
pub(crate) use self::modules::maybe_build_local_admin_modules_response;
|
||||
pub(crate) use self::pool::maybe_build_local_admin_pool_response;
|
||||
pub(crate) use self::proxy_nodes::maybe_build_local_admin_proxy_nodes_response;
|
||||
pub(crate) use crate::handlers::admin::provider::pool_admin::maybe_build_local_admin_pool_response;
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
use crate::control::GatewayPublicRequestContext;
|
||||
use crate::handlers::admin::system::shared::{
|
||||
use crate::handlers::admin::system::shared::modules::{
|
||||
admin_module_by_name, admin_module_name_from_enabled_path, admin_module_name_from_status_path,
|
||||
build_admin_module_runtime_state, build_admin_module_status_payload,
|
||||
build_admin_module_validation_result, build_admin_modules_status_payload,
|
||||
AdminSetModuleEnabledRequest,
|
||||
};
|
||||
use crate::handlers::admin::system::shared::paths::{
|
||||
is_admin_system_configs_root, is_admin_system_email_templates_root,
|
||||
};
|
||||
use crate::handlers::shared::module_available_from_env;
|
||||
use crate::{AppState, GatewayError};
|
||||
use axum::{
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
pub(crate) use crate::handlers::admin::provider::pool_admin::maybe_build_local_admin_pool_response;
|
||||
@@ -1,14 +1,5 @@
|
||||
mod configs;
|
||||
mod email_templates;
|
||||
mod modules;
|
||||
mod paths;
|
||||
mod settings;
|
||||
|
||||
pub(crate) use self::configs::*;
|
||||
pub(crate) use self::email_templates::{
|
||||
apply_admin_email_template_update, build_admin_email_template_payload,
|
||||
build_admin_email_templates_payload, preview_admin_email_template, reset_admin_email_template,
|
||||
};
|
||||
pub(crate) use self::modules::*;
|
||||
pub(crate) use self::paths::*;
|
||||
pub(crate) use self::settings::*;
|
||||
pub(crate) mod configs;
|
||||
pub(crate) mod email_templates;
|
||||
pub(crate) mod modules;
|
||||
pub(crate) mod paths;
|
||||
pub(crate) mod settings;
|
||||
|
||||
Reference in New Issue
Block a user