88 lines
3.6 KiB
TypeScript
88 lines
3.6 KiB
TypeScript
import { Module } from '@nestjs/common';
|
||
import { APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core';
|
||
import { JwtModule } from '@nestjs/jwt';
|
||
import { ScheduleModule } from '@nestjs/schedule';
|
||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||
import { config } from './config';
|
||
import { dataSourceOptions } from './database/data-source';
|
||
import { ENTITIES } from './entities';
|
||
import { AccessService } from './common/access.service';
|
||
import { AuditInterceptor } from './common/audit';
|
||
import { AuthGuard } from './common/auth';
|
||
import { HealthController } from './health.controller';
|
||
import { AuthController } from './modules/auth/auth.controller';
|
||
import { AuthService } from './modules/auth/auth.service';
|
||
import { CompanyRegistry } from './modules/organizations/company-registry';
|
||
import { OrganizationsService } from './modules/organizations/organizations.service';
|
||
import { PlatformController } from './modules/organizations/platform.controller';
|
||
import { UsersController } from './modules/users/users.controller';
|
||
import { UsersService } from './modules/users/users.service';
|
||
import { PeopleService } from './modules/users/people.service';
|
||
import { PassportClient } from './modules/passport/passport.client';
|
||
import { AspansIdClient } from './modules/passport/aspans-id.client';
|
||
import { SitesController } from './modules/sites/sites.controller';
|
||
import { SitesService } from './modules/sites/sites.service';
|
||
import { RoutesController } from './modules/routes/routes.controller';
|
||
import { RoutesService } from './modules/routes/routes.service';
|
||
import { SchedulesController } from './modules/schedules/schedules.controller';
|
||
import { SchedulesService } from './modules/schedules/schedules.service';
|
||
import { GeneratorService } from './modules/rounds/generator.service';
|
||
import { RoundsController } from './modules/rounds/rounds.controller';
|
||
import { RoundsService } from './modules/rounds/rounds.service';
|
||
import { MediaController } from './modules/media/media.controller';
|
||
import { MediaService } from './modules/media/media.service';
|
||
import { StorageService } from './modules/media/storage.service';
|
||
import { ReportsController } from './modules/reports/reports.controller';
|
||
import { ReportsService } from './modules/reports/reports.service';
|
||
import { WebhooksController } from './modules/webhooks/webhooks.controller';
|
||
import { WebhooksService } from './modules/webhooks/webhooks.service';
|
||
import { GeocodeController } from './modules/geocode/geocode.controller';
|
||
import { GeocodeService } from './modules/geocode/geocode.service';
|
||
|
||
// Один модуль на всё: сервис небольшой, а так проще следить за зависимостями.
|
||
@Module({
|
||
imports: [
|
||
TypeOrmModule.forRoot(dataSourceOptions),
|
||
TypeOrmModule.forFeature(ENTITIES),
|
||
JwtModule.register({ global: true, secret: config.jwtSecret }),
|
||
ScheduleModule.forRoot(),
|
||
],
|
||
controllers: [
|
||
HealthController,
|
||
AuthController,
|
||
PlatformController,
|
||
UsersController,
|
||
SitesController,
|
||
RoutesController,
|
||
SchedulesController,
|
||
RoundsController,
|
||
MediaController,
|
||
ReportsController,
|
||
WebhooksController,
|
||
GeocodeController,
|
||
],
|
||
providers: [
|
||
{ provide: APP_GUARD, useClass: AuthGuard },
|
||
{ provide: APP_INTERCEPTOR, useClass: AuditInterceptor },
|
||
AccessService,
|
||
AuthService,
|
||
CompanyRegistry,
|
||
OrganizationsService,
|
||
UsersService,
|
||
PeopleService,
|
||
PassportClient,
|
||
AspansIdClient,
|
||
SitesService,
|
||
RoutesService,
|
||
SchedulesService,
|
||
GeneratorService,
|
||
RoundsService,
|
||
StorageService,
|
||
MediaService,
|
||
ReportsService,
|
||
WebhooksService,
|
||
GeocodeService,
|
||
],
|
||
})
|
||
export class AppModule {}
|