fix: use runByUserId

This commit is contained in:
Karishma Shukla
2025-03-09 00:21:52 +05:30
committed by GitHub
parent 56453f2788
commit 4271b18a45

View File

@@ -903,7 +903,10 @@ router.delete('/schedule/:id', requireSignIn, async (req: AuthenticatedRequest,
router.post('/runs/abort/:id', requireSignIn, async (req: AuthenticatedRequest, res) => {
try {
if (!req.user) { return res.status(401).send({ error: 'Unauthorized' }); }
const run = await Run.findOne({ where: { runId: req.params.id } });
const run = await Run.findOne({ where: {
runId: req.params.id,
runByUserId: req.user.id,
} });
if (!run) {
return res.status(404).send(false);
}
@@ -938,4 +941,4 @@ router.post('/runs/abort/:id', requireSignIn, async (req: AuthenticatedRequest,
logger.log('info', `Error while running a robot with name: ${req.params.fileName}_${req.params.runId}.json`);
return res.send(false);
}
});
});