Skip to content

Commit

Permalink
Merge branch 'feature/new-structure' of https://github.com/labbsr0x/g…
Browse files Browse the repository at this point in the history
…ithunter-bind-starws into feature/new-structure

* 'feature/new-structure' of https://github.com/labbsr0x/githunter-bind-starws:
  Add mapper for new node comments. refs #6

# Conflicts:
#	controller/metrics.controller.js
#	controller/publish.controller.js
#	utils/index.js
  • Loading branch information
rafamarts committed Dec 17, 2020
2 parents 87971bf + e354f04 commit f8b8c74
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controller/metrics.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
27 changes: 27 additions & 0 deletions mapper/inbound.mapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f8b8c74

Please sign in to comment.