Files
pokemon-inventory/packages/validation/inventory.js
T
fragginwagon 099ec2fe72
Quality / test (push) Canceled after 0s
feat: add bulk pricing refresh
2026-09-10 00:07:29 -04:00

29 lines
751 B
JavaScript

import { z } from 'zod';
export const createInventoryItemSchema = z
.object({
productId: z.uuid(),
conditionId: z.uuid(),
notes: z.string().trim().max(10000).optional(),
})
.strict();
export const bulkArchiveInventorySchema = z
.object({
action: z.literal('ARCHIVE'),
inventoryItemIds: z.array(z.uuid()).min(1).max(100),
})
.strict();
export const bulkPricingRefreshInventorySchema = z
.object({
action: z.literal('PRICING_REFRESH'),
inventoryItemIds: z.array(z.uuid()).min(1).max(100),
providerId: z.string().trim().min(1).max(100).optional(),
})
.strict();
export const bulkInventorySchema = z.discriminatedUnion('action', [
bulkArchiveInventorySchema,
bulkPricingRefreshInventorySchema,
]);