docs: update progress to reflect Phase 1-6 completion

- Update CLAUDE.md architecture snapshot: all phases complete
- Update wiki/index.md: module descriptions and progress table
- All 6 phases of ERP platform base are now implemented

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-04-11 12:51:17 +08:00
parent b3c7f76b7f
commit 82986e988d
7 changed files with 75 additions and 43 deletions

View File

@@ -1,6 +1,7 @@
use axum::Extension;
use axum::extract::{FromRef, Path, Query, State};
use axum::response::Json;
use serde::Deserialize;
use validator::Validate;
use erp_core::error::AppError;
@@ -12,14 +13,23 @@ use crate::dto::{CreateUserReq, UpdateUserReq, UserResp};
use erp_core::rbac::require_permission;
use crate::service::user_service::UserService;
/// Query parameters for user list endpoint.
#[derive(Debug, Deserialize)]
pub struct UserListParams {
pub page: Option<u64>,
pub page_size: Option<u64>,
/// Optional search term — filters by username (case-insensitive contains).
pub search: Option<String>,
}
/// GET /api/v1/users
///
/// List users within the current tenant with pagination.
/// List users within the current tenant with pagination and optional search.
/// Requires the `user.list` permission.
pub async fn list_users<S>(
State(state): State<AuthState>,
Extension(ctx): Extension<TenantContext>,
Query(pagination): Query<Pagination>,
Query(params): Query<UserListParams>,
) -> Result<Json<ApiResponse<PaginatedResponse<UserResp>>>, AppError>
where
AuthState: FromRef<S>,
@@ -27,7 +37,13 @@ where
{
require_permission(&ctx, "user.list")?;
let (users, total) = UserService::list(ctx.tenant_id, &pagination, &state.db).await?;
let pagination = Pagination {
page: params.page,
page_size: params.page_size,
};
let (users, total) =
UserService::list(ctx.tenant_id, &pagination, params.search.as_deref(), &state.db)
.await?;
let page = pagination.page.unwrap_or(1);
let page_size = pagination.limit();

View File

@@ -122,18 +122,30 @@ impl UserService {
Ok(model_to_resp(&user_model, roles))
}
/// List users within a tenant with pagination.
/// List users within a tenant with pagination and optional search.
///
/// Returns `(users, total_count)`.
/// Returns `(users, total_count)`. When `search` is provided, filters
/// by username using case-insensitive substring match.
pub async fn list(
tenant_id: Uuid,
pagination: &Pagination,
search: Option<&str>,
db: &sea_orm::DatabaseConnection,
) -> AuthResult<(Vec<UserResp>, u64)> {
let paginator = user::Entity::find()
let mut query = user::Entity::find()
.filter(user::Column::TenantId.eq(tenant_id))
.filter(user::Column::DeletedAt.is_null())
.paginate(db, pagination.limit());
.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)),
);
}
}
let paginator = query.paginate(db, pagination.limit());
let total = paginator
.num_items()

View File

@@ -57,6 +57,10 @@ impl WorkflowModule {
"/workflow/instances/{id}/suspend",
post(instance_handler::suspend_instance),
)
.route(
"/workflow/instances/{id}/resume",
post(instance_handler::resume_instance),
)
.route(
"/workflow/instances/{id}/terminate",
post(instance_handler::terminate_instance),
@@ -102,6 +106,7 @@ impl ErpModule for WorkflowModule {
}
fn register_routes(&self, router: Router) -> Router {
// Actual route registration is done via protected_routes(), called by erp-server.
router
}