aboutsummaryrefslogtreecommitdiff
path: root/controllers/albumsController.js
diff options
context:
space:
mode:
authorPitu <[email protected]>2017-01-18 03:29:46 -0300
committerPitu <[email protected]>2017-01-18 03:29:46 -0300
commitcf98005c4f68956813c61bf6a9b6a0fe02807bad (patch)
tree929bce1f1077253d82aedf3805833c89d462fce9 /controllers/albumsController.js
parentadded admin auth for uploading to an album (diff)
downloadhost.fuwn.me-cf98005c4f68956813c61bf6a9b6a0fe02807bad.tar.xz
host.fuwn.me-cf98005c4f68956813c61bf6a9b6a0fe02807bad.zip
Better tables and showing album on upload view
Diffstat (limited to 'controllers/albumsController.js')
-rw-r--r--controllers/albumsController.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/controllers/albumsController.js b/controllers/albumsController.js
index 1f2d695..72c8177 100644
--- a/controllers/albumsController.js
+++ b/controllers/albumsController.js
@@ -14,14 +14,18 @@ albumsController.list = function(req, res, next){
fields.push('timestamp')
db.table('albums').select(fields).then((albums) => {
+
+ let ids = []
+ for(let album of albums){
+ album.date = new Date(album.timestamp * 1000)
+ album.date = album.date.getFullYear() + '-' + album.date.getMonth() + '-' + album.date.getDate() + ' ' + (album.date.getHours() < 10 ? '0' : '') + album.date.getHours() + ':' + (album.date.getMinutes() < 10 ? '0' : '') + album.date.getMinutes() + ':' + (album.date.getSeconds() < 10 ? '0' : '') + album.date.getSeconds()
+
+ ids.push(album.id)
+ }
if(req.headers.extended === undefined)
return res.json({ success: true, albums })
- let ids = []
- for(let album of albums)
- ids.push(album.id)
-
db.table('files').whereIn('albumid', ids).select('albumid').then((files) => {
let albumsCount = {}