refactor(inventory): flatten effects directory structure

Move effect handlers from effects/ subdirectory to flat structure:
- effects/handlers.ts → effect.handlers.ts
- effects/registry.ts → effect.registry.ts
- effects/types.ts → effect.types.ts

Update import path in inventory.service.ts from
'@/modules/inventory/effects/registry' to
'@/modules/inventory/effect.registry'.

This reduces directory nesting and follows the convention of
keeping module files flat unless there are 5+ files.
This commit is contained in:
syntaxbullet
2026-02-12 12:15:17 +01:00
parent b0c3baf5b7
commit 8c306fbd23
4 changed files with 4 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
import { levelingService } from "@shared/modules/leveling/leveling.service";
import { economyService } from "@shared/modules/economy/economy.service";
import { userTimers } from "@db/schema";
import type { EffectHandler } from "./types";
import type { EffectHandler } from "./effect.types";
import type { LootTableItem } from "@shared/lib/types";
import { inventoryService } from "@shared/modules/inventory/inventory.service";
import { inventory, items } from "@db/schema";

View File

@@ -6,8 +6,8 @@ import {
handleTempRole,
handleColorRole,
handleLootbox
} from "./handlers";
import type { EffectHandler } from "./types";
} from "./effect.handlers";
import type { EffectHandler } from "./effect.types";
export const effectHandlers: Record<string, EffectHandler> = {
'ADD_XP': handleAddXp,

View File

@@ -1,4 +1,3 @@
import type { Transaction } from "@shared/lib/types";
export type EffectHandler = (userId: string, effect: any, txFn: Transaction) => Promise<any>;

View File

@@ -171,7 +171,7 @@ export const inventoryService = {
const results: any[] = [];
// 2. Apply Effects
const { effectHandlers } = await import("@/modules/inventory/effects/registry");
const { effectHandlers } = await import("@/modules/inventory/effect.registry");
for (const effect of usageData.effects) {
const handler = effectHandlers[effect.type];