diff options
| author | Jules <jules@asdf.us> | 2018-04-02 10:17:32 -0400 |
|---|---|---|
| committer | Jules <jules@asdf.us> | 2018-04-02 10:17:32 -0400 |
| commit | f886ab318b4bde2063c4319c49bf98b5146fa639 (patch) | |
| tree | 6cfcb99a775ee36775c203d6a31fcd43d1e68e4b /lib/index.js | |
| parent | 3f408d626fa84d0d571e414932e8ac755e24800d (diff) | |
im_cmd counts api
Diffstat (limited to 'lib/index.js')
| -rw-r--r-- | lib/index.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/index.js b/lib/index.js index 7385d2f..d894b8e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -50,6 +50,17 @@ site.init = function(){ res.json(img) }) }) + app.get("/p/users/", function(req, res){ + db.getLatestByUser().then((latest) => { + var ids = latest.map(row => row.id) + db.getPhotoblasterImages(ids).then(rows => { + var lookup = {} + rows.forEach(row => lookup[row.id] = row) + latest.forEach(row => row.latest = lookup[row.id]) + res.json(latest) + }) + }) + }) app.get("/p/get/", function(req, res){ db.getLatest().then(function(img){ res.json(img) |
