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
Some checks failed
Deploy to Production / test (push) Failing after 38s
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user