22 lines
696 B
TypeScript
22 lines
696 B
TypeScript
import { z } from 'zod';
|
|
import { pageSchema } from '../identity/identity.schemas';
|
|
|
|
export const materialTransferSchema = z
|
|
.object({
|
|
materialId: z.uuid(),
|
|
fromWarehouseId: z.uuid(),
|
|
toWarehouseId: z.uuid(),
|
|
quantity: z.string().regex(/^(?:0\.(?!000)\d{3}|[1-9]\d{0,8}\.\d{3})$/),
|
|
idempotencyKey: z.uuid(),
|
|
})
|
|
.strict();
|
|
export const materialTransferQuery = pageSchema
|
|
.extend({
|
|
materialId: z.uuid().optional(),
|
|
fromWarehouseId: z.uuid().optional(),
|
|
toWarehouseId: z.uuid().optional(),
|
|
})
|
|
.strict();
|
|
export type MaterialTransferInput = z.infer<typeof materialTransferSchema>;
|
|
export type MaterialTransferQuery = z.infer<typeof materialTransferQuery>;
|