| 1 | import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; |
| 2 | import express from 'express |
| 3 | |
| 4 | import { |
| 5 | AVATAR_CONTENT_TYPES, |
| 6 | AVATAR_MAX_BYTES, |
| 7 | } from '../../lib/avatars/avatar.constants.js'; |
| 8 | import { AvatarsModule } |
| 9 | import { UsersService } |
| 10 | import { |
| 11 | OrganizationInvitationsController, |
| 12 | OrganizationsController, |
| 13 | UserOrganizationsController, |
| 14 | } from './organizations.controller.js'; |
| 15 | import { OrganizationsService } |
| 16 | import { OrganizationTeamsController } |
| 17 | import { TeamsService } |
| 18 | |
| 19 | @Module({ |
| 20 | imports: [AvatarsModule], |
| 21 | controllers: [ |
| 22 | OrganizationsController, |
| 23 | UserOrganizationsController, |
| 24 | OrganizationInvitationsController, |
| 25 | OrganizationTeamsController, |
| 26 | ], |
| 27 | providers: [OrganizationsService, |
| 28 | }) |
| 29 | export class OrganizationsModule |
| 30 | // Logo uploads arrive as raw image bytes, the way avatars do. |
| 31 | configure(consumer: |
| 32 | consumer |
| 33 | .apply( |
| 34 | express.raw({ |
| 35 | type: Object.keys |
| 36 | limit: AVATAR_MAX_BYTES, |
| 37 | }), |
| 38 | ) |
| 39 | .forRoutes(OrganizationsController); |
| 40 | } |
| 41 | } |