| 1 | import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; |
| 2 | import express from 'express |
| 3 | |
| 4 | import { AvatarsModule } |
| 5 | import { |
| 6 | AVATAR_CONTENT_TYPES, |
| 7 | AVATAR_MAX_BYTES, |
| 8 | } from '../../lib/avatars/avatar.constants.js'; |
| 9 | import { |
| 10 | OauthAppsController, |
| 11 | OrganizationOauthAppsController, |
| 12 | } from './oauth-apps.controller.js'; |
| 13 | import { OauthAppsService } |
| 14 | |
| 15 | @Module({ |
| 16 | imports: [AvatarsModule], |
| 17 | controllers: [OauthAppsController, |
| 18 | providers: [OauthAppsService], |
| 19 | }) |
| 20 | export class OauthAppsModule |
| 21 | // Logo uploads arrive as raw image bytes, the way avatars do. |
| 22 | configure(consumer: |
| 23 | consumer |
| 24 | .apply( |
| 25 | express.raw({ |
| 26 | type: Object.keys |
| 27 | limit: AVATAR_MAX_BYTES, |
| 28 | }), |
| 29 | ) |
| 30 | .forRoutes(OauthAppsController); |
| 31 | } |
| 32 | } |