refactor: use same function to get img location
This commit is contained in:
parent
712a0952dd
commit
1cea8830d6
1 changed files with 6 additions and 2 deletions
|
|
@ -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,
|
||||
),
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue