fix: revert changes

This commit is contained in:
karishmas6
2024-10-21 21:03:42 +05:30
parent adaf9d0247
commit 4bf496fcd4

View File

@@ -29,9 +29,7 @@ router.all('/', requireSignIn, (req, res, next) => {
*/ */
router.get('/recordings', requireSignIn, async (req, res) => { router.get('/recordings', requireSignIn, async (req, res) => {
try { try {
const data = await Robot.findAll({ const data = await Robot.findAll();
where: { userId: req.user.id },
});
return res.send(data); return res.send(data);
} catch (e) { } catch (e) {
logger.log('info', 'Error while reading recordings'); logger.log('info', 'Error while reading recordings');
@@ -45,7 +43,7 @@ router.get('/recordings', requireSignIn, async (req, res) => {
router.get('/recordings/:id', requireSignIn, async (req, res) => { router.get('/recordings/:id', requireSignIn, async (req, res) => {
try { try {
const data = await Robot.findOne({ const data = await Robot.findOne({
where: { 'recording_meta.id': req.params.id, userId: req.user.id }, where: { 'recording_meta.id': req.params.id },
raw: true raw: true
} }
); );
@@ -62,7 +60,7 @@ router.get('/recordings/:id', requireSignIn, async (req, res) => {
router.delete('/recordings/:id', requireSignIn, async (req, res) => { router.delete('/recordings/:id', requireSignIn, async (req, res) => {
try { try {
await Robot.destroy({ await Robot.destroy({
where: { 'recording_meta.id': req.params.id, userId: req.user.id } where: { 'recording_meta.id': req.params.id }
}); });
return res.send(true); return res.send(true);
} catch (e) { } catch (e) {
@@ -107,8 +105,7 @@ router.put('/runs/:id', requireSignIn, async (req, res) => {
try { try {
const recording = await Robot.findOne({ const recording = await Robot.findOne({
where: { where: {
'recording_meta.id': req.params.id, 'recording_meta.id': req.params.id
userId: req.user.id,
}, },
raw: true raw: true
}); });
@@ -200,7 +197,7 @@ router.post('/runs/run/:id', requireSignIn, async (req, res) => {
const plainRun = run.toJSON(); const plainRun = run.toJSON();
const recording = await Robot.findOne({ where: { 'recording_meta.id': plainRun.robotMetaId, userId: req.user.id }, raw: true }); const recording = await Robot.findOne({ where: { 'recording_meta.id': plainRun.robotMetaId }, raw: true });
if (!recording) { if (!recording) {
return res.status(404).send(false); return res.status(404).send(false);
} }