fix: set editState when onchange steps

This commit is contained in:
Takeshi Kimata
2024-07-07 21:38:54 +09:00
parent 82f76bcbb6
commit 908400eb86
4 changed files with 14 additions and 18 deletions

View File

@@ -19,21 +19,10 @@ module.exports = function (sequelize) {
return res.status(404).send('Case not found');
}
// if Case has Steps, update Steps as well
if (updateCase.Steps) {
// Delete existing steps
const steps = updateCase.Steps;
await Promise.all(
steps.map(async (step) => {
const existingStep = await Step.findByPk(step.id);
if (existingStep) {
await existingStep.update(step);
}
})
);
delete updateCase.Steps;
}
delete updateCase.Steps;
await testcase.update(updateCase);
res.json(testcase);
} catch (error) {