feat(catalog): prevent and repair Arcturus emulator data errors
Block invalid catalog_items writes at the API level (points currency allowlist, non-negative prices, positive amount, limited stack >= sold count, unique sibling order numbers) and auto-assign unique order numbers on bulk create. Add a catalog-maintenance scan + transactional repair that fixes pre-existing rows: resets unsupported points_type, clamps negative costs, sets amount to 1, raises limited_stack, renumbers duplicate orders and deletes offers with missing page/item references. Surface the issue count and a fix button in the admin maintenance panel. Also: add enabled/retired flag to clone sources, classify poster and currency furniture in item-kind, and remove the obsolete update-Nitrov3.sh.
This commit is contained in:
@@ -49,3 +49,22 @@ it("rejects fractional set/add prices, accepts percentage discounts", () => {
|
||||
.costPoints,
|
||||
).toBe(5);
|
||||
});
|
||||
it("rejects unsupported pointsType values in bulk changes", () => {
|
||||
expect(() =>
|
||||
bulkOfferInputSchema.parse({
|
||||
ids: [1],
|
||||
changes: { pointsType: 101 },
|
||||
}),
|
||||
).toThrow(/not supported/i);
|
||||
});
|
||||
it("accepts supported pointsType values in bulk changes", () => {
|
||||
expect(
|
||||
bulkOfferInputSchema.parse({
|
||||
ids: [1],
|
||||
changes: { pointsType: 5 },
|
||||
}),
|
||||
).toEqual({
|
||||
ids: [1],
|
||||
changes: { pointsType: 5 },
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user