forked from wangziqi/gongxue-base
refactor: 前端应用骨架迁移至 zustand 并统一路由权限壳
This commit is contained in:
58
apps/admin/src/api/schemas/import-run.ts
Normal file
58
apps/admin/src/api/schemas/import-run.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const importSheetMetaSchema = z
|
||||
.object({
|
||||
name: z.string(),
|
||||
headers: z.array(z.string()),
|
||||
rowCount: z.number(),
|
||||
suggestedStepKey: z.string().nullable(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
export const importStepSummarySchema = z
|
||||
.object({
|
||||
total: z.number(),
|
||||
valid: z.number(),
|
||||
error: z.number(),
|
||||
create: z.number(),
|
||||
update: z.number(),
|
||||
skip: z.number(),
|
||||
})
|
||||
.passthrough()
|
||||
.nullable();
|
||||
|
||||
export const importStepDetailSchema = z
|
||||
.object({
|
||||
id: z.number(),
|
||||
stepKey: z.string(),
|
||||
label: z.string(),
|
||||
sheets: z.array(z.string()),
|
||||
status: z.string(),
|
||||
mapping: z.record(z.string(), z.string()),
|
||||
summary: importStepSummarySchema,
|
||||
committedAt: z.string().nullable(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
export const importRunDetailSchema = z
|
||||
.object({
|
||||
id: z.string(),
|
||||
fileName: z.string(),
|
||||
source: z.enum(['ai', 'manual']),
|
||||
status: z.string(),
|
||||
currentStepKey: z.string().nullable(),
|
||||
createdAt: z.string(),
|
||||
sheets: z.array(importSheetMetaSchema),
|
||||
steps: z.array(importStepDetailSchema),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
export const importRunEnvelopeSchema = z
|
||||
.object({
|
||||
success: z.boolean(),
|
||||
data: importRunDetailSchema,
|
||||
message: z.string().optional(),
|
||||
})
|
||||
.passthrough();
|
||||
|
||||
/** 考勤记录 */
|
||||
Reference in New Issue
Block a user