From 015c119d3f469da8cd9b3d7bc7f2729446693d9c Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Fri, 6 Sep 2024 14:13:00 +0700 Subject: [PATCH] fix: backward compat --- src/controllers/02-user-controller.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/controllers/02-user-controller.ts b/src/controllers/02-user-controller.ts index 5f3c8b1..4d8de86 100644 --- a/src/controllers/02-user-controller.ts +++ b/src/controllers/02-user-controller.ts @@ -856,7 +856,17 @@ export class UserAttachmentController extends Controller { throw new HttpError(HttpStatus.NOT_FOUND, "User cannot be found.", "userNotFound"); } - return await listFile(fileLocation.user.attachment(userId)); + const list = await listFile(fileLocation.user.attachment(userId)); + return await Promise.all( + list.map(async (v) => ({ + name: v, + url: await minio.presignedGetObject( + MINIO_BUCKET, + fileLocation.user.attachment(userId, v), + 12 * 60 * 60, + ), + })), + ); } @Post()