diff --git a/controller/metrics.controller.js b/controller/metrics.controller.js index 15aa2d6..97a1bfb 100644 --- a/controller/metrics.controller.js +++ b/controller/metrics.controller.js @@ -33,6 +33,11 @@ const metrics = async (req, res) => { return false; } + if (starwsResp.status && starwsResp.status != 200) { + res.status(starwsResp.status).send({ message: 'Unknown error' }); + return false; + } + const maker = nodeMapper[node]; if (!maker) { diff --git a/mapper/inbound.mapper.js b/mapper/inbound.mapper.js index 242982e..5e18354 100644 --- a/mapper/inbound.mapper.js +++ b/mapper/inbound.mapper.js @@ -156,6 +156,33 @@ const comments = JM.makeConverter({ tags: {}, }); +const comments = JM.makeConverter({ + dateTime: input => Utils.dateFormat4StarWS(input.createdAt), + fields: { + url: 'url', + createdAt: data => Utils.dateFormat4StarWS(data.createdAt), + author: input => Utils.prepareString4StarWS(`a:${input.author}`), + number: ['number', h.toString], + url: 'url', + id: 'id', + rawData: input => { + if (input.rawData) { + return input.rawData; + } + return `https://datajson/empty`; + }, + dono: input => { + return `o:${input.owner}`; + }, + name: input => { + return `n:${input.name}`; + }, + provider: 'provider', + type: JM.helpers.def('comments'), + }, + tags: {}, +}); + const userStats = JM.makeConverter({ dateTime: input => { if (input.dateTime) {