api duplicate รูปภาพโปรไฟล์

This commit is contained in:
Bright 2025-07-11 10:50:05 +07:00
parent 56241eda4f
commit 30ac106894
2 changed files with 60 additions and 0 deletions

View file

@ -145,4 +145,18 @@ export async function s3DownloadFile(...pathname: string[]) {
};
}
export async function duplicateAvatarFile(refId: string, prefix: string, fileName: string) {
try {
await minio.statObject(MINIO_BUCKET, refId);
const avatar = `${prefix}/${fileName}`;
await minio.copyObject(
MINIO_BUCKET,
avatar,
`/${MINIO_BUCKET}/${refId}`
);
} catch (error) {
exception(error);
}
}
export const fileLocation = (...path: string[]) => path.join("/");