This commit is contained in:
@@ -15,6 +15,7 @@ export function toAdminProductDto(product) {
|
||||
cardNumber: product.cardNumber ?? null,
|
||||
eventName: product.eventName ?? null,
|
||||
releaseYear: product.releaseYear ?? null,
|
||||
tags: product.tags ?? [],
|
||||
createdAt: toIsoString(product.createdAt),
|
||||
updatedAt: toIsoString(product.updatedAt),
|
||||
};
|
||||
|
||||
@@ -14,6 +14,7 @@ export function toPublicProductDto(product) {
|
||||
cardNumber: product.cardNumber ?? null,
|
||||
eventName: product.eventName ?? null,
|
||||
releaseYear: product.releaseYear ?? null,
|
||||
tags: product.tags ?? [],
|
||||
createdAt: toIsoString(product.createdAt),
|
||||
updatedAt: toIsoString(product.updatedAt),
|
||||
};
|
||||
|
||||
@@ -23,7 +23,21 @@ export const bulkPricingRefreshInventorySchema = z
|
||||
})
|
||||
.strict();
|
||||
|
||||
export const bulkTagInventorySchema = z
|
||||
.object({
|
||||
action: z.literal('TAGS'),
|
||||
inventoryItemIds: z.array(z.uuid()).min(1).max(100),
|
||||
add: z.array(z.string().trim().min(1).max(100)).max(50).optional(),
|
||||
remove: z.array(z.string().trim().min(1).max(100)).max(50).optional(),
|
||||
})
|
||||
.strict()
|
||||
.refine(({ add, remove }) => (add?.length ?? 0) > 0 || (remove?.length ?? 0) > 0, {
|
||||
message: 'Add or remove at least one tag.',
|
||||
path: ['add'],
|
||||
});
|
||||
|
||||
export const bulkInventorySchema = z.discriminatedUnion('action', [
|
||||
bulkArchiveInventorySchema,
|
||||
bulkPricingRefreshInventorySchema,
|
||||
bulkTagInventorySchema,
|
||||
]);
|
||||
@@ -6,5 +6,6 @@ export const createProductSchema = z
|
||||
.object({
|
||||
name: z.string().trim().min(1).max(255),
|
||||
categoryId: identifier,
|
||||
tags: z.array(z.string().trim().min(1).max(100)).max(50).optional(),
|
||||
})
|
||||
.strict();
|
||||
Reference in New Issue
Block a user