feat(admin): unify system data management and aggregate import/export

This commit is contained in:
fawney19
2026-05-16 02:09:01 +08:00
parent 48da062251
commit f59cf1090d
16 changed files with 872 additions and 206 deletions

View File

@@ -259,6 +259,7 @@ fn admin_system_owns_system_route_helpers() {
"build_admin_api_formats_payload",
"build_admin_system_config_export_payload",
"build_admin_system_users_export_payload",
"build_admin_system_data_export_payload",
"build_admin_system_configs_payload",
"build_admin_system_config_detail_payload",
"apply_admin_system_config_update",
@@ -287,6 +288,7 @@ fn admin_system_owns_system_route_helpers() {
"build_admin_api_formats_payload",
"build_admin_system_config_export_payload",
"build_admin_system_users_export_payload",
"build_admin_system_data_export_payload",
"build_admin_system_configs_payload",
"build_admin_system_config_detail_payload",
"apply_admin_system_config_update",
@@ -315,6 +317,7 @@ fn admin_system_owns_system_route_helpers() {
"pub(crate) async fn build_admin_system_settings_payload",
"pub(crate) async fn build_admin_system_config_export_payload",
"pub(crate) async fn build_admin_system_users_export_payload",
"pub(crate) async fn build_admin_system_data_export_payload",
"pub(crate) fn build_admin_system_configs_payload",
"pub(crate) async fn build_admin_system_config_detail_payload",
"pub(crate) async fn apply_admin_system_config_update",
@@ -447,6 +450,7 @@ fn admin_system_owns_system_route_helpers() {
"pub(crate) async fn reset_admin_email_template",
"pub(crate) async fn build_admin_system_config_export_payload",
"pub(crate) async fn build_admin_system_users_export_payload",
"pub(crate) async fn build_admin_system_data_export_payload",
] {
assert!(
request_system.contains(pattern),
@@ -511,6 +515,7 @@ fn admin_system_shared_configs_split_export_owners() {
for pattern in [
"pub(crate) async fn build_admin_system_config_export_payload(",
"pub(crate) async fn build_admin_system_users_export_payload(",
"pub(crate) async fn build_admin_system_data_export_payload(",
] {
assert!(
request_system.contains(pattern),

View File

@@ -839,6 +839,7 @@ async fn gateway_handles_admin_system_unavailable_write_routes_locally_with_trus
let unavailable_paths = [
"/api/admin/system/config/import",
"/api/admin/system/users/import",
"/api/admin/system/data/import",
];
let local_paths = [
"/api/admin/system/cleanup",
@@ -862,7 +863,11 @@ async fn gateway_handles_admin_system_unavailable_write_routes_locally_with_trus
.await
.expect("request should succeed");
assert_eq!(response.status(), StatusCode::SERVICE_UNAVAILABLE);
assert_eq!(
response.status(),
StatusCode::SERVICE_UNAVAILABLE,
"path={path}"
);
let payload: serde_json::Value = response.json().await.expect("json body should parse");
assert_eq!(payload["detail"], DETAIL, "path={path}");
}