2023-01-12 03:34:36 +01:00
|
|
|
import { DynamicModule, Global, Module, ModuleMetadata, Provider } from '@nestjs/common';
|
2023-01-18 15:40:15 +01:00
|
|
|
import { APIKeyService } from './api-key';
|
2023-01-24 05:13:42 +01:00
|
|
|
import { AuthService } from './auth';
|
2023-02-01 21:55:06 +01:00
|
|
|
import { DeviceInfoService } from './device-info';
|
2023-01-28 06:57:37 +01:00
|
|
|
import { JobService } from './job';
|
2023-01-24 05:13:42 +01:00
|
|
|
import { OAuthService } from './oauth';
|
2023-01-28 06:57:37 +01:00
|
|
|
import { ShareService } from './share';
|
2023-01-24 05:13:42 +01:00
|
|
|
import { INITIAL_SYSTEM_CONFIG, SystemConfigService } from './system-config';
|
2023-01-12 03:34:36 +01:00
|
|
|
import { UserService } from './user';
|
|
|
|
|
|
|
|
const providers: Provider[] = [
|
2023-01-18 15:40:15 +01:00
|
|
|
APIKeyService,
|
2023-01-24 05:13:42 +01:00
|
|
|
AuthService,
|
2023-02-01 21:55:06 +01:00
|
|
|
DeviceInfoService,
|
2023-01-28 06:57:37 +01:00
|
|
|
JobService,
|
2023-01-24 05:13:42 +01:00
|
|
|
OAuthService,
|
2023-01-21 17:11:55 +01:00
|
|
|
SystemConfigService,
|
2023-01-12 03:34:36 +01:00
|
|
|
UserService,
|
2023-01-25 17:35:28 +01:00
|
|
|
ShareService,
|
2023-01-21 17:11:55 +01:00
|
|
|
{
|
|
|
|
provide: INITIAL_SYSTEM_CONFIG,
|
|
|
|
inject: [SystemConfigService],
|
|
|
|
useFactory: async (configService: SystemConfigService) => {
|
|
|
|
return configService.getConfig();
|
|
|
|
},
|
|
|
|
},
|
2023-01-12 03:34:36 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
@Global()
|
|
|
|
@Module({})
|
|
|
|
export class DomainModule {
|
|
|
|
static register(options: Pick<ModuleMetadata, 'imports'>): DynamicModule {
|
|
|
|
return {
|
|
|
|
module: DomainModule,
|
|
|
|
imports: options.imports,
|
|
|
|
providers: [...providers],
|
|
|
|
exports: [...providers],
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|