diff --git a/index.js b/index.js index d86aee4..25bcec6 100644 --- a/index.js +++ b/index.js @@ -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, @@ -143,7 +148,7 @@ app.get('/v1/albums', (req, res, next) => { deleted, archived, photosUrl, - posterImages: posterImagesOrg, + posterImages, color, }; }); diff --git a/test/integration/server.js b/test/integration/server.js index 3f61f68..5d089d9 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -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(), @@ -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(),