tm-authors-api
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -10,3 +10,3 @@ { | ||
"name": "authors-api", | ||
"image": "trinitymirror/authors-api:2.1.1", | ||
"image": "trinitymirror/authors-api:2.1.2", | ||
"essential": "true", | ||
@@ -13,0 +13,0 @@ "memory": 1700, |
{ | ||
"name": "tm-authors-api", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -31,2 +31,8 @@ "use strict"; | ||
}) | ||
.map(res => { | ||
if (R.pathOr(false, ['Item'], res)) { | ||
return R.evolve({Item: httpsImageTransform}, res); | ||
} | ||
return R.evolve({Item: httpsImageTransform}, res); | ||
}) | ||
.toCallback((err, result) => { | ||
@@ -111,2 +117,9 @@ if (err) { | ||
.flatMap(x => db.batchGetStream(x)) | ||
.map(res => { | ||
const table = config.dynamodb.tableName; | ||
if (R.pathOr(false, ['Responses', table], res)) { | ||
return R.assocPath(['Responses', table], R.map(httpsImageTransform, res.Responses[table]), res); | ||
} | ||
return x; | ||
}) | ||
.toCallback((err, result) => { | ||
@@ -129,2 +142,6 @@ if (err) { | ||
function httpsImageTransform(author) { | ||
return R.evolve({imageUrl: R.replace('http://www', 'https://is')}, author); | ||
} | ||
function converId(item) { | ||
@@ -131,0 +148,0 @@ const id = `${item.Source.split("-")[0]}.${item.Id}`; |
@@ -51,3 +51,3 @@ "use strict"; | ||
"name": "Jim Author", | ||
"imageUrl": "www.mirror.co.uk/incoming/article121234.ese/ALTERNATIES/s98/title.png", | ||
"imageUrl": "http://www.mirror.co.uk/incoming/article121234.ese/ALTERNATIES/s98/title.png", | ||
"twitterId": "a_twitter_id" | ||
@@ -73,3 +73,3 @@ }; | ||
assert.deepEqual(res.body.twitterId, 'a_twitter_id'); | ||
assert.deepEqual(res.body.imageUrl, 'www.mirror.co.uk/incoming/article121234.ese/ALTERNATIES/s98/title.png'); | ||
assert.deepEqual(res.body.imageUrl, 'https://is.mirror.co.uk/incoming/article121234.ese/ALTERNATIES/s98/title.png'); | ||
assert.deepEqual(res.body.id, 'nationals.123'); | ||
@@ -150,4 +150,7 @@ const params = getStub.firstCall.args[0]; | ||
assert.equal(res.body[0].url, "www.mirror.co.uk/authors/robbie-s"); | ||
assert.equal(res.body[0].imageUrl, "handsome_robbie"); | ||
assert.equal(res.body[1].url, "www.mirror.co.uk/authors/author-jim"); | ||
assert.equal(res.body[1].imageUrl, "https://is.mirror.co.uk/incoming/article121234.ese/ALTERNATIES/s98/title.png"); | ||
assert.equal(res.body[2].url, "www.mirror.co.uk/authors/kimmy-k"); | ||
assert.equal(res.body[2].imageUrl, "me_brake_internet"); | ||
const params = batchGetStub.firstCall.args[0].RequestItems["AuthorsStateStore-test"].Keys; | ||
@@ -154,0 +157,0 @@ assert.equal(params[1].Id, robbie.Id); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21150
10
531