24 lines
738 B
TypeScript
24 lines
738 B
TypeScript
import { z } from 'zod';
|
|
|
|
/**
|
|
* Schema for CSV/Excel import configuration.
|
|
*/
|
|
export const ColumnMappingSchema = z.object({
|
|
sourceColumn: z.string(),
|
|
targetField: z.string(),
|
|
transform: z.enum(['none', 'trim', 'lowercase', 'uppercase', 'date_dmy', 'date_mdy']).default('none'),
|
|
});
|
|
|
|
export type ColumnMapping = z.infer<typeof ColumnMappingSchema>;
|
|
|
|
export const ImportConfigSchema = z.object({
|
|
moduleId: z.string().uuid(),
|
|
accountId: z.string().uuid(),
|
|
mappings: z.array(ColumnMappingSchema).min(1),
|
|
skipFirstRow: z.boolean().default(true),
|
|
onDuplicate: z.enum(['skip', 'overwrite', 'error']).default('skip'),
|
|
dryRun: z.boolean().default(true),
|
|
});
|
|
|
|
export type ImportConfigInput = z.infer<typeof ImportConfigSchema>;
|