fix: delete task order not working
This commit is contained in:
parent
9235175303
commit
fa244a6e82
1 changed files with 12 additions and 1 deletions
|
|
@ -32,7 +32,15 @@ import {
|
||||||
} from "../services/permission";
|
} from "../services/permission";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
import HttpStatus from "../interfaces/http-status";
|
import HttpStatus from "../interfaces/http-status";
|
||||||
import { deleteFile, fileLocation, getFile, getPresigned, listFile, setFile } from "../utils/minio";
|
import {
|
||||||
|
deleteFile,
|
||||||
|
deleteFolder,
|
||||||
|
fileLocation,
|
||||||
|
getFile,
|
||||||
|
getPresigned,
|
||||||
|
listFile,
|
||||||
|
setFile,
|
||||||
|
} from "../utils/minio";
|
||||||
import { queryOrNot } from "../utils/relation";
|
import { queryOrNot } from "../utils/relation";
|
||||||
|
|
||||||
const MANAGE_ROLES = ["system", "head_of_admin", "admin", "document_checker"];
|
const MANAGE_ROLES = ["system", "head_of_admin", "admin", "document_checker"];
|
||||||
|
|
@ -429,6 +437,9 @@ export class TaskController extends Controller {
|
||||||
if (!record) throw notFoundError("Task Order");
|
if (!record) throw notFoundError("Task Order");
|
||||||
|
|
||||||
await permissionCheck(req.user, record.registeredBranch);
|
await permissionCheck(req.user, record.registeredBranch);
|
||||||
|
|
||||||
|
await Promise.all([deleteFolder(fileLocation.task.attachment(taskOrderId))]);
|
||||||
|
await tx.taskOrder.delete({ where: { id: taskOrderId } });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue