diff --git a/src/controllers/branch-contact-controller.ts b/src/controllers/branch-contact-controller.ts index 1f8a473..450ca55 100644 --- a/src/controllers/branch-contact-controller.ts +++ b/src/controllers/branch-contact-controller.ts @@ -26,19 +26,13 @@ if (!process.env.MINIO_BUCKET) { const MINIO_BUCKET = process.env.MINIO_BUCKET; type BranchContactCreate = { - lineId: string; telephoneNo: string; }; type BranchContactUpdate = { - lineId?: string; telephoneNo?: string; }; -function imageLocation(id: string) { - return `branch/contact-${id}`; -} - @Route("api/branch/{branchId}/contact") @Tags("Branch Contact") @Security("keycloak") @@ -60,16 +54,7 @@ export class BranchContactController extends Controller { ]); return { - result: await Promise.all( - result.map(async (v) => ({ - ...v, - qrCodeImageUrl: await minio.presignedGetObject( - MINIO_BUCKET, - imageLocation(v.id), - 12 * 60 * 60, - ), - })), - ), + result, page, pageSize, total, @@ -88,9 +73,7 @@ export class BranchContactController extends Controller { ); } - return Object.assign(record, { - qrCodeImageUrl: await minio.presignedGetObject(MINIO_BUCKET, imageLocation(record.id)), - }); + return record; } @Post() @@ -112,18 +95,7 @@ export class BranchContactController extends Controller { this.setStatus(HttpStatus.CREATED); - return Object.assign(record, { - qrCodeImageUrl: await minio.presignedGetObject( - MINIO_BUCKET, - imageLocation(record.id), - 12 * 60 * 60, - ), - qrCodeImageUploadUrl: await minio.presignedPutObject( - MINIO_BUCKET, - imageLocation(record.id), - 12 * 60 * 60, - ), - }); + return record; } @Put("{contactId}") @@ -150,18 +122,7 @@ export class BranchContactController extends Controller { where: { id: contactId, branchId }, }); - return Object.assign(record, { - qrCodeImageUrl: await minio.presignedGetObject( - MINIO_BUCKET, - imageLocation(record.id), - 12 * 60 * 60, - ), - qrCodeImageUploadUrl: await minio.presignedPutObject( - MINIO_BUCKET, - imageLocation(record.id), - 12 * 60 * 60, - ), - }); + return record; } @Delete("{contactId}") @@ -174,8 +135,5 @@ export class BranchContactController extends Controller { "data_not_found", ); } - await minio.removeObject(MINIO_BUCKET, imageLocation(contactId), { - forceDelete: true, - }); } }