From 17135be8cf53167bdffe6a4b507551687ef96010 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Thu, 18 Apr 2024 14:37:01 +0700 Subject: [PATCH] fix: wrong structure return --- src/controllers/branch-controller.ts | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/controllers/branch-controller.ts b/src/controllers/branch-controller.ts index b4dc67c..4e3f4ac 100644 --- a/src/controllers/branch-controller.ts +++ b/src/controllers/branch-controller.ts @@ -197,19 +197,10 @@ export class BranchController extends Controller { throw new HttpError(HttpStatus.NOT_FOUND, "Branch cannot be found.", "data_not_found"); } - return { - ...record, - contact: record.contact - ? await Promise.all( - record.contact.map(async (v) => - Object.assign(v, { - imageUrl: await minio.presignedGetObject(MINIO_BUCKET, branchImageLoc(v.id)), - qrCodeImageUrl: await minio.presignedGetObject(MINIO_BUCKET, lineImageLoc(v.id)), - }), - ), - ) - : undefined, - }; + return Object.assign(record, { + imageUrl: await minio.presignedGetObject(MINIO_BUCKET, branchImageLoc(record.id)), + qrCodeImageUrl: await minio.presignedGetObject(MINIO_BUCKET, lineImageLoc(record.id)), + }); } @Post()