import { DynamicModule, Module, Type } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { MulterModule } from '@nestjs/platform-express'; import './graphql/enums'; import { CommentResolver } from './graphql/comment.resolver'; import { NotificationResolver } from './graphql/notification.resolver'; import { IssueResolver } from './graphql/issue.resolver'; import { ProjectResolver } from './graphql/project.resolver'; import { ReleaseResolver } from './graphql/release.resolver'; import { SubscriptionResolver } from './graphql/subscription.resolver'; import { AttachmentsController } from './http/attachments.controller'; import { CommentsController } from './http/comments.controller'; import { IssuesController } from './http/issues.controller'; import { ExploreController } from './http/explore.controller'; import { ProjectsController } from './http/projects.controller'; import { Refs } from './http/refs'; import { ReleasesController } from './http/releases.controller'; import { NotificationsController } from './http/notifications.controller'; import { SavedFiltersController } from './http/saved-filters.controller'; import { SavedFilterResolver } from './graphql/saved-filter.resolver'; import { SprintResolver } from './graphql/sprint.resolver'; import { SprintsController } from './http/sprints.controller'; import { GitController } from './http/git.controller'; import { GitResolver } from './graphql/git.resolver'; import { WebhookResolver } from './graphql/webhook.resolver'; import { WebhooksController } from './http/webhooks.controller'; /** * Driving adapters of the tracker context: GraphQL (queries, mutations, * subscriptions) and REST with OpenAPI for other apps. Both call the same * application services. */ @Module({ imports: [ // Uploads stay in memory until the command stores them; the size limit // is enforced here, before a byte reaches the application. MulterModule.registerAsync({ inject: [ConfigService], useFactory: (config: ConfigService) => ({ limits: { fileSize: (config.get('ATTACHMENTS_MAX_MB') ?? 25) * 1024 * 1024, files: 1, }, }), }), ], controllers: [ ProjectsController, IssuesController, AttachmentsController, CommentsController, ReleasesController, ExploreController, NotificationsController, SavedFiltersController, SprintsController, GitController, WebhooksController, ], providers: [ Refs, ProjectResolver, IssueResolver, CommentResolver, ReleaseResolver, SubscriptionResolver, NotificationResolver, SavedFilterResolver, SprintResolver, GitResolver, WebhookResolver, ], }) export class TrackerPresentersModule { static withApplication( applicationModule: Type | DynamicModule, ): DynamicModule { return { module: TrackerPresentersModule, imports: [applicationModule], }; } }