Skip to content

Commit

Permalink
feat(albums): add full URL to preview image
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans Kristian Flaatten committed Jun 9, 2016
1 parent 9831f96 commit 801901c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ app.get('/v1/albums', (req, res, next) => {
const id = data.split('/')[4];
const photosUrl = `${req.fullUrl}/v1/albums/${id}/photos`;

const posterImages = posterImagesOrg.map(preview => {
preview.href = [fotoweb.BASE_URL, preview.href].join('');
return preview;
});

return {
id,
name,
Expand All @@ -143,7 +148,7 @@ app.get('/v1/albums', (req, res, next) => {
deleted,
archived,
photosUrl,
posterImages: posterImagesOrg,
posterImages,
color,
};
});
Expand Down
10 changes: 8 additions & 2 deletions test/integration/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('server', () => {
size: Joi.number().integer(),
width: Joi.number().integer(),
height: Joi.number().integer(),
href: Joi.string(),
href: Joi.string().uri({ scheme: ['http'] }),
square: Joi.boolean(),
})),
color: Joi.string(),
Expand Down Expand Up @@ -115,7 +115,13 @@ describe('server', () => {
filename: Joi.string(),
filesize: Joi.number().integer(),
doctype: Joi.string().valid('image'),
previews: Joi.array(),
previews: Joi.array().items(Joi.object().keys({
size: Joi.number().integer(),
width: Joi.number().integer(),
height: Joi.number().integer(),
href: Joi.string().uri({ scheme: ['http'] }),
square: Joi.boolean(),
})),
attributes: Joi.object().keys({
imageattributes: Joi.object().keys({
pixelwidth: Joi.number().integer(),
Expand Down

0 comments on commit 801901c

Please sign in to comment.