diff options
| author | Pitu <[email protected]> | 2017-01-18 05:07:20 -0300 |
|---|---|---|
| committer | Pitu <[email protected]> | 2017-01-18 05:07:20 -0300 |
| commit | 02be5586836b4505683d1e64d2d20ce84d11eb23 (patch) | |
| tree | 071827ec06d02cf5f35a533741cca4c04bde33c3 /controllers/albumsController.js | |
| parent | Added enabled flag to albums on database (diff) | |
| download | host.fuwn.me-02be5586836b4505683d1e64d2d20ce84d11eb23.tar.xz host.fuwn.me-02be5586836b4505683d1e64d2d20ce84d11eb23.zip | |
Added enabled flag to create/list of albums
Diffstat (limited to 'controllers/albumsController.js')
| -rw-r--r-- | controllers/albumsController.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/controllers/albumsController.js b/controllers/albumsController.js index 76129ec..16efd9c 100644 --- a/controllers/albumsController.js +++ b/controllers/albumsController.js @@ -13,11 +13,11 @@ albumsController.list = function(req, res, next){ if(req.headers.extended !== undefined) fields.push('timestamp') - db.table('albums').select(fields).then((albums) => { + db.table('albums').select(fields).where('enabled', 1).then((albums) => { if(req.headers.extended === undefined) return res.json({ success: true, albums }) - + let ids = [] for(let album of albums){ album.date = new Date(album.timestamp * 1000) @@ -53,6 +53,7 @@ albumsController.create = function(req, res, next){ db.table('albums').insert({ name: name, + enabled: 1, timestamp: Math.floor(Date.now() / 1000) }).then(() => { return res.json({ success: true }) |