32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
|
|
import { Module } from '@nestjs/common';
|
|
import { GraphQLModule } from '@nestjs/graphql';
|
|
|
|
import { ConfigService } from '../config/config.service';
|
|
import { SystemSettings } from '../enumerations';
|
|
import { SystemSettingsResolver } from './system-settings.resolver';
|
|
import { PrismaModule } from '../prisma/prisma.module';
|
|
import { ConfigModule } from '../config/config.module';
|
|
|
|
@Module({
|
|
imports: [
|
|
ConfigModule,
|
|
PrismaModule,
|
|
GraphQLModule.forRootAsync<ApolloDriverConfig>({
|
|
driver: ApolloDriver,
|
|
useFactory: async (configService: ConfigService) => ({
|
|
debug: await configService.get(SystemSettings.Graphql.Debug),
|
|
playground: await configService.get(SystemSettings.Graphql.PlaygroundEnabled),
|
|
introspection: await configService.get(SystemSettings.Graphql.IntrospectionEnabled),
|
|
typePaths: ['../../graphql/**/*.graphql'],
|
|
}),
|
|
inject: [ConfigService],
|
|
imports: [ConfigModule],
|
|
})
|
|
],
|
|
providers: [
|
|
SystemSettingsResolver,
|
|
]
|
|
})
|
|
export class GraphqlModule {}
|