mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-13 07:56:23 +00:00
Album delete WIP
This commit is contained in:
parent
a8121f5d7c
commit
bb0f746598
@ -48,7 +48,7 @@ albumsController.create = function(req, res, next){
|
|||||||
if(name === undefined || name === '')
|
if(name === undefined || name === '')
|
||||||
return res.json({ success: false, description: 'No album name specified' })
|
return res.json({ success: false, description: 'No album name specified' })
|
||||||
|
|
||||||
db.table('albums').where('name', name).then((album) => {
|
db.table('albums').where('name', name).where('enabled', 1).then((album) => {
|
||||||
if(album.length !== 0) return res.json({ success: false, description: 'There\'s already an album with that name' })
|
if(album.length !== 0) return res.json({ success: false, description: 'There\'s already an album with that name' })
|
||||||
|
|
||||||
db.table('albums').insert({
|
db.table('albums').insert({
|
||||||
@ -61,5 +61,18 @@ albumsController.create = function(req, res, next){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
albumsController.delete = function(req, res, next){
|
||||||
|
if(req.headers.auth !== config.adminToken)
|
||||||
|
return res.status(401).json({ success: false, description: 'not-authorized'})
|
||||||
|
|
||||||
|
let id = req.body.id
|
||||||
|
if(id === undefined || id === '')
|
||||||
|
return res.json({ success: false, description: 'No album specified' })
|
||||||
|
|
||||||
|
db.table('albums').where('id', id).update({ enabled: 0 }).then(() => {
|
||||||
|
return res.json({ success: true })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
module.exports = albumsController
|
module.exports = albumsController
|
@ -123,7 +123,6 @@ uploadsController.list = function(req, res){
|
|||||||
|
|
||||||
for(let file of files){
|
for(let file of files){
|
||||||
file.file = 'http://' + basedomain + '/' + file.name
|
file.file = 'http://' + basedomain + '/' + file.name
|
||||||
//file.file = config.basedomain + config.uploads.prefix + file.name
|
|
||||||
file.date = new Date(file.timestamp * 1000)
|
file.date = new Date(file.timestamp * 1000)
|
||||||
file.date = file.date.getFullYear() + '-' + (file.date.getMonth() + 1) + '-' + file.date.getDate() + ' ' + (file.date.getHours() < 10 ? '0' : '') + file.date.getHours() + ':' + (file.date.getMinutes() < 10 ? '0' : '') + file.date.getMinutes() + ':' + (file.date.getSeconds() < 10 ? '0' : '') + file.date.getSeconds()
|
file.date = file.date.getFullYear() + '-' + (file.date.getMonth() + 1) + '-' + file.date.getDate() + ' ' + (file.date.getHours() < 10 ? '0' : '') + file.date.getHours() + ':' + (file.date.getMinutes() < 10 ? '0' : '') + file.date.getMinutes() + ':' + (file.date.getSeconds() < 10 ? '0' : '') + file.date.getSeconds()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user