diff --git a/index.js b/index.js index c216a18..d86aee4 100644 --- a/index.js +++ b/index.js @@ -118,11 +118,34 @@ app.get('/v1/albums', (req, res, next) => { return next(new HttpError('Fotoweb API returned no data', 502)); } - body.data = body.data.map(album => { - album.id = album.data.split('/')[4]; - album.photosUrl = `${req.fullUrl}/v1/albums/${album.id}/photos`; + body.data = body.data.map(({ + name, + data, + description, + type, + created, + modified, + deleted, + archived, + posterImages: posterImagesOrg, + color, + }) => { + const id = data.split('/')[4]; + const photosUrl = `${req.fullUrl}/v1/albums/${id}/photos`; - return album; + return { + id, + name, + description, + type, + created, + modified, + deleted, + archived, + photosUrl, + posterImages: posterImagesOrg, + color, + }; }); /* Rewrite Fotoweb API paging URLs to API wrapper URLs */ diff --git a/test/integration/server.js b/test/integration/server.js index eb44a7b..3f61f68 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -70,55 +70,12 @@ describe('server', () => { id: Joi.string().regex(/^[\d]+\.[\w-]+$/), name: Joi.string(), description: Joi.string().allow(''), - photosUrl: Joi.string().regex(/\/v1\/albums\/[^\/]+\/photos$/), - href: Joi.string(), - data: Joi.string(), type: Joi.string().valid('archive'), created: Joi.date().iso(), modified: Joi.date().iso(), deleted: Joi.date().iso().allow(null), archived: Joi.date().iso().allow(null), - metadataEditor: Joi.object().keys({ - name: Joi.string(), - href: Joi.string(), - }), - searchURL: Joi.string(), - originalURL: Joi.string().allow(''), - searchString: Joi.string().allow(''), - taxonomies: Joi.array().items(Joi.object().keys({ - field: Joi.number().integer(), - value: Joi.string(), - label: Joi.string(), - description: Joi.string().allow(''), - href: Joi.string(), - langAlts: Joi.array(), - hasChildren: Joi.boolean(), - acl: Joi.string().allow(null), - detailsHref: Joi.string(), - taxonomyHref: Joi.string(), - taxonomyTitle: Joi.string(), - synonyms: Joi.array(), - sameAs: Joi.array(), - linkedFields: Joi.array(), - items: Joi.array(), - broaderTerms: Joi.array(), - })), - canHaveChildren: Joi.boolean(), - isSearchable: Joi.boolean(), - isSelectable: Joi.boolean(), - isLinkCollection: Joi.boolean(), - hasChildren: Joi.boolean(), - canCopyTo: Joi.boolean(), - canMoveTo: Joi.boolean(), - canUploadTo: Joi.boolean(), - canCreateFolders: Joi.boolean(), - canIngestToChildren: Joi.boolean(), - canBeDeleted: Joi.boolean(), - canBeArchived: Joi.boolean(), - canCreateAlerts: Joi.boolean(), - isFolderNavigationEnabled: Joi.boolean(), - canSelect: Joi.boolean(), - permissions: Joi.array().items(Joi.string()), + photosUrl: Joi.string().regex(/\/v1\/albums\/[^\/]+\/photos$/), posterImages: Joi.array().items(Joi.object().keys({ size: Joi.number().integer(), width: Joi.number().integer(), @@ -126,16 +83,6 @@ describe('server', () => { href: Joi.string(), square: Joi.boolean(), })), - posterAsset: Joi.string().allow(null), - props: Joi.object().keys({ - owner: Joi.string().allow(null), - shares: Joi.object(), - comments: Joi.object(), - facebookComments: Joi.boolean(), - annotations: Joi.object(), - tags: Joi.array(), - }), - iconCharacter: Joi.string(), color: Joi.string(), })), paging: Joi.object().allow(null),