fix: resolve remaining clippy warnings and improve workflow frontend

- Collapse nested if-let in user_service.rs search filter
- Suppress dead_code warning on ApiDoc struct
- Refactor server routing: nest all routes under /api/v1 prefix
- Simplify health check route path
- Improve workflow ProcessDesigner with edit mode and loading states
- Update workflow pages with enhanced UX
- Add Phase 2 implementation plan document
This commit is contained in:
iven
2026-04-11 12:59:43 +08:00
parent 184034ff6b
commit 97d3c9026b
12 changed files with 832 additions and 274 deletions

View File

@@ -136,13 +136,11 @@ impl UserService {
.filter(user::Column::TenantId.eq(tenant_id))
.filter(user::Column::DeletedAt.is_null());
if let Some(term) = search {
if !term.is_empty() {
use sea_orm::sea_query::Expr;
query = query.filter(
Expr::col(user::Column::Username).like(format!("%{}%", term)),
);
}
if let Some(term) = search && !term.is_empty() {
use sea_orm::sea_query::Expr;
query = query.filter(
Expr::col(user::Column::Username).like(format!("%{}%", term)),
);
}
let paginator = query.paginate(db, pagination.limit());

View File

@@ -13,7 +13,7 @@ pub struct HealthResponse {
pub modules: Vec<String>,
}
/// GET /api/v1/health
/// GET /health
///
/// 服务健康检查,返回运行状态和已注册模块列表
pub async fn health_check(State(state): State<AppState>) -> Json<HealthResponse> {
@@ -32,5 +32,5 @@ pub async fn health_check(State(state): State<AppState>) -> Json<HealthResponse>
}
pub fn health_check_router() -> Router<AppState> {
Router::new().route("/api/v1/health", get(health_check))
Router::new().route("/health", get(health_check))
}

View File

@@ -12,11 +12,11 @@ mod state;
description = "ERP 平台底座 REST API 文档"
)
)]
#[allow(dead_code)]
struct ApiDoc;
use axum::Router;
use axum::middleware;
use axum::response::Json;
use config::AppConfig;
use erp_auth::middleware::jwt_auth_middleware_fn;
use state::AppState;
@@ -168,9 +168,6 @@ async fn main() -> anyhow::Result<()> {
let public_routes = Router::new()
.merge(handlers::health::health_check_router())
.merge(erp_auth::AuthModule::public_routes())
.route("/api/docs/openapi.json", axum::routing::get(|| async {
Json(ApiDoc::openapi())
}))
.with_state(state.clone());
// Protected routes (JWT authentication required)
@@ -185,10 +182,10 @@ async fn main() -> anyhow::Result<()> {
.with_state(state.clone());
// Merge public + protected into the final application router
// All API routes are nested under /api/v1
let cors = build_cors_layer(&state.config.cors.allowed_origins);
let app = Router::new()
.merge(public_routes)
.merge(protected_routes)
.nest("/api/v1", public_routes.merge(protected_routes))
.layer(cors);
let addr = format!("{}:{}", host, port);