feat: handle replace

This commit is contained in:
Methapon2001 2025-01-15 13:31:42 +07:00
parent a6295586f8
commit 6306e0266d
2 changed files with 23 additions and 15 deletions

View file

@ -192,7 +192,7 @@ export class FileController extends Controller {
const ret = await Promise.all(
body.fileList.map(async ({ fileName }) => [
fileName,
await s3UploadFile(...path, fileName),
await s3UploadFile(!!body.replace, ...path, fileName),
]),
);
return Object.fromEntries(ret);
@ -519,7 +519,13 @@ export class SubFileController extends Controller {
const path = [name, group, id, subId];
if (name !== "ระบบประเมิน") {
return await s3ListFile(name, group, id, subId);
const ret = await Promise.all(
body.fileList.map(async ({ fileName }) => [
fileName,
await s3UploadFile(!!body.replace, ...path, fileName),
]),
);
return Object.fromEntries(ret);
}
if (!(await createFolder(path.slice(0, -1), subId, true))) {