fix(worker): register I18nModule and CacheModule in the worker composition root

الجيوفنس جرّ الإشعارات إلى شجرة الـworker لأول مرة، والإشعارات (و
UsersService خلفها) تحقن I18nService و CacheService. الوحدات @Global
تُسجَّل فقط إن استوردها أحد في الشجرة — وما يسجّله AppModule لا يصل
إلى جذر تجميع آخر.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hamza-Ayed
2026-07-18 19:37:21 +03:00
co-authored by Claude Opus 4.8
parent ba7c99a05b
commit 9bc52dbb9e
+8
View File
@@ -3,11 +3,17 @@ import { ConfigModule, ConfigService } from '@nestjs/config';
import { TypeOrmModule } from '@nestjs/typeorm'; import { TypeOrmModule } from '@nestjs/typeorm';
import configuration from './config/configuration'; import configuration from './config/configuration';
import { RedisModule } from './common/redis/redis.module'; import { RedisModule } from './common/redis/redis.module';
import { I18nModule } from './common/i18n/i18n.module';
import { CacheModule } from './common/cache/cache.module';
import { LocationsModule } from './modules/locations/locations.module'; import { LocationsModule } from './modules/locations/locations.module';
/** /**
* وحدة الـworker — عملية منفصلة (`node dist/worker.js`) لا تخدم HTTP. * وحدة الـworker — عملية منفصلة (`node dist/worker.js`) لا تخدم HTTP.
* تحمل ما يحتاجه العمل الدوري فقط: قاعدة + Redis + المواقع. * تحمل ما يحتاجه العمل الدوري فقط: قاعدة + Redis + المواقع.
*
* جذر تجميع ثانٍ مستقل عن AppModule: الوحدات `@Global` تُسجَّل فقط إن
* استوردها أحدٌ في الشجرة، فما يسجّله AppModule لا يصل إلى هنا مجّاناً.
* المواقع تجرّ الجيوفنس ← الإشعارات ← i18n + cache (وعبر المستخدمين أيضاً).
*/ */
@Module({ @Module({
imports: [ imports: [
@@ -29,6 +35,8 @@ import { LocationsModule } from './modules/locations/locations.module';
}), }),
}), }),
RedisModule, RedisModule,
I18nModule, // عالمي — نصوص إشعارات الجيوفنس
CacheModule, // عالمي — يحقنه UsersService خلف الإشعارات
LocationsModule, LocationsModule,
], ],
}) })