From d9c81a7cca12a5c99b6ddd57dc26cb4e9dcb23cf Mon Sep 17 00:00:00 2001 From: Saiyan Abhishek <74703491+geeky-abhishek@users.noreply.github.com> Date: Tue, 17 Oct 2023 17:49:55 +0530 Subject: [PATCH] chore: get media link endpoint added --- packages/bff/src/upload/upload.controller.ts | 8 ++++++++ packages/bff/src/upload/upload.service.ts | 7 +++++++ 2 files changed, 15 insertions(+) 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, + ); + } }