feat: setup the attachment to the passenger api

This commit is contained in:
Nathnael
2026-07-18 09:44:14 +00:00
parent 4f043ea4bf
commit bdcd5e957e
12 changed files with 781 additions and 116 deletions

View File

@@ -0,0 +1,20 @@
import { SUPPORT_ATTACHMENT_MAX_BYTES, SUPPORT_ATTACHMENT_MAX_PER_MESSAGE } from '@edr/types';
import { MulterOptions } from '@nestjs/platform-express/multer/interfaces/multer-options.interface';
/** Multipart field name carrying chat files. */
export const SUPPORT_ATTACHMENT_FIELD = 'attachments';
/**
* Multer-level caps for the chat send routes.
*
* These duplicate `SupportService.assertSendable` on purpose and don't replace
* it: Multer stops reading the socket once a part exceeds `fileSize`, so an
* oversized upload is cut off mid-stream rather than buffered into memory and
* rejected afterwards. The service check produces the readable error.
*/
export const supportAttachmentMulterOptions: MulterOptions = {
limits: {
fileSize: SUPPORT_ATTACHMENT_MAX_BYTES,
files: SUPPORT_ATTACHMENT_MAX_PER_MESSAGE,
},
};