diff --git a/src/controllers/03-customer-controller.ts b/src/controllers/03-customer-controller.ts index 56b96ca..0bfdbc4 100644 --- a/src/controllers/03-customer-controller.ts +++ b/src/controllers/03-customer-controller.ts @@ -4,6 +4,7 @@ import { Controller, Delete, Get, + Head, Path, Post, Put, @@ -24,7 +25,15 @@ import { createPermCondition, } from "../services/permission"; import { filterStatus } from "../services/prisma"; -import { deleteFile, deleteFolder, fileLocation, getFile, listFile, setFile } from "../utils/minio"; +import { + deleteFile, + deleteFolder, + fileLocation, + getFile, + getPresigned, + listFile, + setFile, +} from "../utils/minio"; import { isUsedError, notFoundError, relationError } from "../utils/error"; import { connectOrNot } from "../utils/relation"; @@ -488,6 +497,17 @@ export class CustomerImageController extends Controller { ); } + @Head("{name}") + async headImage( + @Request() req: RequestWithUser, + @Path() customerId: string, + @Path() name: string, + ) { + return req.res?.redirect( + await getPresigned("head", fileLocation.customer.img(customerId, name), 12 * 60 * 60), + ); + } + @Put("{name}") @Security("keycloak") async putImage(