add protection for job dedup

This commit is contained in:
timothycarambat
2023-10-03 13:32:26 -07:00
parent 4f0ba7a824
commit aca52ea1c7
+10 -4
View File
@@ -69,10 +69,16 @@ function toolEndpoints(app) {
status: "pending",
organization_id: destinationOrg.id,
});
//TODO - uncomment if (!!existingJobForOrg || !!existingJobForDestinationOrg) {
// response.status(200).json({ success: false, message: "There is an existing migration job already running for these organizations." });
// return;
// }
if (!!existingJobForOrg || !!existingJobForDestinationOrg) {
response
.status(200)
.json({
success: false,
message:
"There is an existing migration job already running for these organizations.",
});
return;
}
await organizationMigrationJob(organization, destinationOrg, user);
response