From 7c9f4ec7ca594215486ec7799469ca7442296740 Mon Sep 17 00:00:00 2001 From: Hans Kristian Flaatten Date: Fri, 10 Jun 2016 11:23:25 +0200 Subject: [PATCH] feat(photos): look up hardcoded tags ID using PHOTO_METADATA_IDS map --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 73bdd36..1956411 100644 --- a/index.js +++ b/index.js @@ -80,7 +80,7 @@ app.get('/v1/tags', (req, res, next) => { } return body.forEach(data => { - if (data.field === 25) { + if (data.field === parseInt(fotoweb.PHOTO_METADATA_IDS.get('tags'), 10)) { res.json(data.items.map(item => ({ key: encodeURIComponent(item.value.toLowerCase()), val: item.value, @@ -184,7 +184,8 @@ app.get('/v1/albums/:album/photos', (req, res, next) => { } if (req.query.tags) { - req.query.tags.split(',').forEach(tag => qs.push(`25=${tag}`)); + const key = fotoweb.PHOTO_METADATA_IDS.get('tags'); + req.query.tags.split(',').forEach(tag => qs.push(`${key}=${tag}`)); } if (qs.length) {