feat(customer-image): add head endpoint
This commit is contained in:
parent
21e5467f55
commit
09dbac1aa2
1 changed files with 21 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ import {
|
||||||
Controller,
|
Controller,
|
||||||
Delete,
|
Delete,
|
||||||
Get,
|
Get,
|
||||||
|
Head,
|
||||||
Path,
|
Path,
|
||||||
Post,
|
Post,
|
||||||
Put,
|
Put,
|
||||||
|
|
@ -24,7 +25,15 @@ import {
|
||||||
createPermCondition,
|
createPermCondition,
|
||||||
} from "../services/permission";
|
} from "../services/permission";
|
||||||
import { filterStatus } from "../services/prisma";
|
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 { isUsedError, notFoundError, relationError } from "../utils/error";
|
||||||
import { connectOrNot } from "../utils/relation";
|
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}")
|
@Put("{name}")
|
||||||
@Security("keycloak")
|
@Security("keycloak")
|
||||||
async putImage(
|
async putImage(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue