mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-14 08:26:22 +00:00
Added album check to uploads
This commit is contained in:
parent
f8d6cc7db6
commit
80117235f9
@ -62,6 +62,14 @@ uploadsController.upload = function(req, res, next) {
|
||||
album = req.params.albumid
|
||||
}
|
||||
|
||||
db.table('albums').where({ id: album, userid: userid }).then((albums) => {
|
||||
if (albums.length === 0) {
|
||||
return res.json({
|
||||
success: false,
|
||||
description: 'Album doesn\'t exist or it doesn\'t belong to the user'
|
||||
})
|
||||
}
|
||||
|
||||
upload(req, res, function (err) {
|
||||
if (err) {
|
||||
console.error(err)
|
||||
@ -126,6 +134,7 @@ uploadsController.upload = function(req, res, next) {
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}).catch(function(error) { console.log(error); res.json({ success: false, description: 'error' }) })
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user