diff --git a/src/controllers/01-branch-controller.ts b/src/controllers/01-branch-controller.ts index 9742ebb..b0630f5 100644 --- a/src/controllers/01-branch-controller.ts +++ b/src/controllers/01-branch-controller.ts @@ -648,6 +648,17 @@ export class BranchFileController extends Controller { return req.res?.redirect(await getFile(fileLocation.branch.bank(branchId, bankId))); } + @Head("bank-qr/{bankId}") + async headBankImage( + @Request() req: RequestWithUser, + @Path() branchId: string, + @Path() bankId: string, + ) { + return req.res?.redirect( + await getPresigned("head", fileLocation.branch.bank(branchId, bankId)), + ); + } + @Put("bank-qr/{bankId}") @Security("keycloak") async putBankImage( @@ -678,6 +689,11 @@ export class BranchFileController extends Controller { return req.res?.redirect(await getFile(fileLocation.branch.line(branchId))); } + @Head("line-image") + async headLineImage(@Request() req: RequestWithUser, @Path() branchId: string) { + return req.res?.redirect(await getPresigned("head", fileLocation.branch.line(branchId))); + } + @Put("line-image") @Security("keycloak") async putLineImage(@Request() req: RequestWithUser, @Path() branchId: string) { @@ -708,6 +724,12 @@ export class BranchFileController extends Controller { return await getFile(fileLocation.branch.attachment(branchId, name)); } + @Head("attachment/{name}") + @Security("keycloak") + async headAttachment(@Path() branchId: string, @Path() name: string) { + return await getPresigned("head", fileLocation.branch.attachment(branchId, name)); + } + @Put("attachment/{name}") @Security("keycloak") async putAttachment( diff --git a/src/controllers/02-user-controller.ts b/src/controllers/02-user-controller.ts index 8cebb7f..387ff0e 100644 --- a/src/controllers/02-user-controller.ts +++ b/src/controllers/02-user-controller.ts @@ -11,6 +11,7 @@ import { Route, Security, Tags, + Head, } from "tsoa"; import { Branch, Prisma, Status, User, UserType } from "@prisma/client"; @@ -28,7 +29,15 @@ import { removeUserRoles, } from "../services/keycloak"; import { isSystem } from "../utils/keycloak"; -import { deleteFile, deleteFolder, fileLocation, getFile, listFile, setFile } from "../utils/minio"; +import { + deleteFile, + deleteFolder, + fileLocation, + getFile, + getPresigned, + listFile, + setFile, +} from "../utils/minio"; import { filterStatus } from "../services/prisma"; import { branchRelationPermInclude, @@ -706,6 +715,11 @@ export class UserProfileController extends Controller { return req.res?.redirect(await getFile(fileLocation.user.profile(userId, name))); } + @Head("{name}") + async headImage(@Request() req: RequestWithUser, @Path() userId: string, @Path() name: string) { + return req.res?.redirect(await getPresigned("head", fileLocation.user.profile(userId, name))); + } + @Put("{name}") @Security("keycloak") async putImage(@Request() req: RequestWithUser, @Path() userId: string, @Path() name: string) {