refactor: use same function to get img location

This commit is contained in:
Methapon2001 2024-04-02 14:01:59 +07:00
parent 712a0952dd
commit 1cea8830d6

View file

@ -25,6 +25,10 @@ if (!process.env.MINIO_BUCKET) {
const MINIO_BUCKET = process.env.MINIO_BUCKET;
function imageLocation(id: string) {
return `branch/contact-${id}`;
}
@Route("api/branch/{branchId}/contact")
@Tags("Branch Contact")
@Security("keycloak")
@ -45,12 +49,12 @@ export class BranchContactController extends Controller {
return Object.assign(record, {
qrCodeImageUrl: await minio.presignedGetObject(
MINIO_BUCKET,
`branch/contact-${record.id}`,
imageLocation(record.id),
12 * 60 * 60,
),
qrCodeImageUploadUrl: await minio.presignedPutObject(
MINIO_BUCKET,
`branch/contact-${record.id}`,
imageLocation(record.id),
12 * 60 * 60,
),
});