feat: add signature endpoints
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s
This commit is contained in:
parent
1091b93805
commit
4c47b0b7d1
2 changed files with 47 additions and 0 deletions
|
|
@ -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 || ""}`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue