diff --git a/packages/bff/src/upload/upload.controller.ts b/packages/bff/src/upload/upload.controller.ts index 3c76bc07..0a447403 100644 --- a/packages/bff/src/upload/upload.controller.ts +++ b/packages/bff/src/upload/upload.controller.ts @@ -2,6 +2,7 @@ import { BadRequestException, Controller, Get, + Param, Post, UploadedFile, UploadedFiles, @@ -60,4 +61,11 @@ export class UploadController { throw error; } } + + @Get(':filename') + async getSubmissionByVillageId( + @Param('filename') filename: string, + ): Promise { + return await this.uploadService.getMediaUrl(filename); + } } diff --git a/packages/bff/src/upload/upload.service.ts b/packages/bff/src/upload/upload.service.ts index 62d50178..adc6032d 100644 --- a/packages/bff/src/upload/upload.service.ts +++ b/packages/bff/src/upload/upload.service.ts @@ -36,4 +36,11 @@ export class UploadService { throw error; } } + + async getMediaUrl(filename: string) { + return await this.minioService.getFileLink( + this.configService.get('MINIO_BUCKET'), + filename, + ); + } }