feat: 素材处理管线——自动处理、审核流程、6状态机
This commit is contained in:
@@ -21,14 +21,15 @@ export function handleListMaterials(req: Request, db: Database, mode: RuntimeMod
|
||||
const pagination = validatePagination(pageParam, pageSizeParam, mode);
|
||||
if (pagination instanceof Response) return pagination;
|
||||
|
||||
if (statusParam && statusParam !== "pending" && statusParam !== "approved" && statusParam !== "discarded") {
|
||||
const ALLOWED_STATUSES = ["pending", "processing", "review", "approved", "discarded", "failed"] as const;
|
||||
if (statusParam && !(ALLOWED_STATUSES as readonly string[]).includes(statusParam)) {
|
||||
return jsonResponse(createApiError("Invalid status parameter", 400), { mode, status: 400 });
|
||||
}
|
||||
|
||||
const result = listMaterials(db, validated.id, {
|
||||
page: pagination.page,
|
||||
pageSize: pagination.pageSize,
|
||||
status: (statusParam as "approved" | "discarded" | "pending") ?? undefined,
|
||||
status: (statusParam as (typeof ALLOWED_STATUSES)[number]) ?? undefined,
|
||||
});
|
||||
|
||||
return jsonResponse(result, { mode });
|
||||
|
||||
Reference in New Issue
Block a user