Skip to content

Commit

Permalink
Merge pull request #52 from Turistforeningen/fix/standardize-log-resp…
Browse files Browse the repository at this point in the history
…onse

Fix/standardize log response
  • Loading branch information
Håvard Ranum authored Sep 13, 2016
2 parents ef5b2e8 + 1d08824 commit 78dd4ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ router.get('/steder/:sted/logg', (req, res, next) => {
.where('ntb_steder_id').equals(req.params.sted)
.limit(50)
.sort({ timestamp: -1 })
.select('-dnt_user_id -location')
.then(checkins => checkins.map(c => c.anonymize(req.headers['x-user-id'])))
.then(data => res.json({ data }))
.catch(error => next(new HttpError('Database failure', 500, error)));
});
Expand Down
6 changes: 4 additions & 2 deletions test/acceptance/checkin.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,10 @@ describe('GET /steder/:sted/logg', () => {
JSON.parse(JSON.stringify(checkins[1])),
JSON.parse(JSON.stringify(checkins[2])),
].map(c => {
delete c.dnt_user_id;
delete c.location;
if (c.public === false) {
delete c.dnt_user_id;
delete c.location;
}
return c;
});

Expand Down

0 comments on commit 78dd4ad

Please sign in to comment.