fix: validate the s3 configures exist (#482)

This commit is contained in:
Ahmed Bouhuolia
2024-06-04 15:11:21 +02:00
committed by GitHub
parent f241e2bede
commit bbba54c08e
4 changed files with 34 additions and 16 deletions

View File

@@ -4,12 +4,16 @@ import { Router, Response, NextFunction, Request } from 'express';
import { body, param } from 'express-validator';
import BaseController from '@/api/controllers/BaseController';
import { AttachmentsApplication } from '@/services/Attachments/AttachmentsApplication';
import { AttachmentUploadPipeline } from '@/services/Attachments/S3UploadPipeline';
@Service()
export class AttachmentsController extends BaseController {
@Inject()
private attachmentsApplication: AttachmentsApplication;
@Inject()
private uploadPipelineService: AttachmentUploadPipeline;
/**
* Router constructor.
*/
@@ -18,7 +22,8 @@ export class AttachmentsController extends BaseController {
router.post(
'/',
this.attachmentsApplication.uploadPipeline.single('file'),
this.uploadPipelineService.validateS3Configured,
this.uploadPipelineService.uploadPipeline().single('file'),
this.validateUploadedFileExistance,
this.uploadAttachment.bind(this)
);