Skip to content

Commit

Permalink
feat(photos): look up hardcoded tags ID using PHOTO_METADATA_IDS map
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans Kristian Flaatten committed Jun 10, 2016
1 parent 755a3a7 commit 7c9f4ec
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 7c9f4ec

Please sign in to comment.