refactor: Implement Zod schema validation for inventory effect payloads and enhance item route DTO type safety.
Some checks failed
Deploy to Production / test (push) Failing after 38s

This commit is contained in:
syntaxbullet
2026-02-13 14:12:46 +01:00
parent bf20c61190
commit 0c67a8754f
5 changed files with 112 additions and 23 deletions

View File

@@ -171,17 +171,11 @@ export const inventoryService = {
const results: any[] = [];
// 2. Apply Effects
const { effectHandlers } = await import("@/modules/inventory/effect.registry");
const { validateAndExecuteEffect } = await import("@/modules/inventory/effect.registry");
for (const effect of usageData.effects) {
const handler = effectHandlers[effect.type];
if (handler) {
const result = await handler(userId, effect, txFn);
results.push(result);
} else {
console.warn(`No handler found for effect type: ${effect.type}`);
results.push(`Effect ${effect.type} applied (no description)`);
}
const result = await validateAndExecuteEffect(effect, userId, txFn);
results.push(result);
}
// 3. Consume