import { Module } from '@nestjs/common' ; import { DalService , UserRepository , OrganizationRepository , ApplicationRepository , NotificationTemplateRepository , SubscriberRepository , NotificationRepository , MessageRepository , MemberRepository , } from '@notifire/dal' ; import { JwtModule } from '@nestjs/jwt' ; import { QueueService } from './queue' ; const DAL_MODELS = [ UserRepository , OrganizationRepository , ApplicationRepository , NotificationTemplateRepository , SubscriberRepository , NotificationRepository , MessageRepository , MemberRepository , ] ; const dalService = new DalService ( ) ; const PROVIDERS = [ { provide : QueueService , useFactory : ( ) => { return new QueueService ( ) ; } , } , { provide : DalService , useFactory : async ( ) => { await dalService . connect ( process . env . MONGO_URL ) ; return dalService ; } , } , ... DAL_MODELS , ] ; @ Module ( { imports : [ JwtModule . register ( { secretOrKeyProvider : ( ) => process . env . JWT_SECRET as string , signOptions : { expiresIn : 360000 , } , } ) , ] , providers : [ ... PROVIDERS ] , exports : [ ... PROVIDERS , JwtModule ] , } ) export class SharedModule { }