This commit is contained in:
matteo
2019-03-03 20:16:01 +01:00
parent 3a4a0e84c7
commit 12f375afed
+13 -9
View File
@@ -80,17 +80,21 @@ low(new FileAsync(__dirname + '/db.json')) // production
});
const videos = db.get('videos');
if (req.query.prevId) {
let tmp = videos.map(el => el.id.reason.map(el =>
el.reason.map(el2 => {
if (el2.prevId === req.query.prevId) {
return ({ ...el2, 'id': this.id })
let tmp = [];
for (let i = 0; i < videos.lenght; i++) {
for (let j = 0; i < videos[i].reason.lenght; j++) {
if (videos[i].reason[j].prevId === req.query.prevId) {
let tmp2 = {
...videos[i].reason[j],
'id': videos[i].id
}
tmp.push(tmp2);
}
return {}
}, el)));
}
}
res.send(tmp)
}
else {
res.send(videos)
} else {
res.send(videos)
}
});