11import {
22 Body ,
33 Controller ,
4+ Delete ,
45 Get ,
56 Param ,
67 Post ,
@@ -31,6 +32,10 @@ export class MediaController {
3132 private _subscriptionService : SubscriptionService
3233 ) { }
3334
35+ @Delete ( '/:id' )
36+ deleteMedia ( @GetOrgFromRequest ( ) org : Organization , @Param ( 'id' ) id : string ) {
37+ return this . _mediaService . deleteMedia ( org . id , id ) ;
38+ }
3439 @Post ( '/generate-image' )
3540 async generateImage (
3641 @GetOrgFromRequest ( ) org : Organization ,
@@ -96,15 +101,11 @@ export class MediaController {
96101 }
97102
98103 @Post ( '/:endpoint' )
99- // @UseInterceptors (FileInterceptor('file'))
100- // @UsePipes (new CustomFileValidationPipe())
101104 async uploadFile (
102105 @GetOrgFromRequest ( ) org : Organization ,
103106 @Req ( ) req : Request ,
104107 @Res ( ) res : Response ,
105108 @Param ( 'endpoint' ) endpoint : string
106- // @UploadedFile ('file')
107- // file: Express.Multer.File
108109 ) {
109110 const upload = await handleR2Upload ( endpoint , req , res ) ;
110111 if ( endpoint !== 'complete-multipart-upload' ) {
@@ -122,11 +123,6 @@ export class MediaController {
122123 ) ;
123124
124125 res . status ( 200 ) . json ( { ...upload , saved : saveFile } ) ;
125- // const filePath =
126- // file.path.indexOf('http') === 0
127- // ? file.path
128- // : file.path.replace(process.env.UPLOAD_DIRECTORY, '');
129- // return this._mediaService.saveFile(org.id, file.originalname, filePath);
130126 }
131127
132128 @Get ( '/' )
0 commit comments