feat: add signature endpoints
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s

This commit is contained in:
Methapon2001 2025-03-26 15:17:50 +07:00
parent 1091b93805
commit 4c47b0b7d1
2 changed files with 47 additions and 0 deletions

View file

@ -35,6 +35,12 @@ export async function setFile(path: string, exp = 6 * 60 * 60) {
return await minio.presignedPutObject(MINIO_BUCKET, path, exp);
}
export async function uploadFile(path: string, buffer: Buffer, contentType?: string) {
await minio.putObject(MINIO_BUCKET, path, buffer, Buffer.byteLength(buffer), {
["Content-Type"]: contentType,
});
}
export async function deleteFile(path: string) {
await minio.removeObject(MINIO_BUCKET, path, { forceDelete: true });
}
@ -70,6 +76,7 @@ export const fileLocation = {
`${ROOT}/user/profile-image-${userId}/${name || ""}`,
attachment: (userId: string, name?: string) =>
`${ROOT}/user/attachment-${userId}/${name || ""}`,
signature: (userId: string) => `${ROOT}/user/signature-${userId}`,
},
customer: {
img: (customerId: string, name?: string) => `${ROOT}/customer/img-${customerId}/${name || ""}`,