Skip to content

Commit

Permalink
bump lib versions and fixing lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Signorini committed Sep 24, 2019
1 parent 7f8a7a5 commit f756942
Show file tree
Hide file tree
Showing 11 changed files with 2,754 additions and 3,943 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Expand Up @@ -4,3 +4,5 @@ node_module/*
tasks/*
test/*
coverage/*
docs/*
.nyc_output/*
14 changes: 7 additions & 7 deletions app/audit/applications/persistenceAudit.js
Expand Up @@ -14,7 +14,7 @@ const AuditTrack = require('audit/services/auditTrack');
const ApplicationAudit = (EntityStorage) => (Entity, PersistenceServices = DPersistenceServices) => {

const AuditTrackCharged = AuditTrack(PersistenceServices(Entity));
const dUser = "MaestroServer"
const dUser = "MaestroServer";

return {
find(req, res, next) {
Expand Down Expand Up @@ -42,7 +42,7 @@ const ApplicationAudit = (EntityStorage) => (Entity, PersistenceServices = DPers
params = transfID(params, 'id');
const {id:entity_id, entity, user} = _.defaults(params, {user: dUser});

let tmp = _.assign({body}, {entity, entity_id})
let tmp = _.assign({body}, {entity, entity_id});

Promise.all([
PersistenceServices(EntityStorage).create(tmp),
Expand All @@ -61,12 +61,12 @@ const ApplicationAudit = (EntityStorage) => (Entity, PersistenceServices = DPers
PersistenceServices(EntityStorage)
.findOne({entity_id})
.then(base => {
let tmp = _.assign({body}, {entity, entity_id})
let tmp = _.assign({body}, {entity, entity_id});

return Promise.all([
PersistenceServices(EntityStorage).update(entity_id, tmp),
AuditTrackCharged({entity, entity_id, user}).update(_.get(base, 'body', {}), body)
])
]);
})
.then(e => res.status(204).json(e))
.catch(next);
Expand All @@ -75,18 +75,18 @@ const ApplicationAudit = (EntityStorage) => (Entity, PersistenceServices = DPers
patch(req, res, next) {
let {body, params} = req;

params = transfID(params, 'id')
params = transfID(params, 'id');
const {id:entity_id, entity, user} = _.defaults(params, {user: dUser});

PersistenceServices(EntityStorage)
.findOne({entity_id})
.then(base => {
let tmp = _.assign({body}, {entity, entity_id})
let tmp = _.assign({body}, {entity, entity_id});

return Promise.all([
PersistenceServices(EntityStorage).patch(entity_id, tmp),
AuditTrackCharged({entity, entity_id, user}).patch(_.get(base, 'body', {}), body)
])
]);
})
.then(e => res.status(201).json(e))
.catch(next);
Expand Down
3 changes: 1 addition & 2 deletions app/audit/config/auth_conector_private.js
@@ -1,6 +1,5 @@
'use strict';

const _ = require('lodash');
const {Passport} = require('passport');

const {Strategy} = require('passport-jwt');
Expand All @@ -15,7 +14,7 @@ module.exports = function () {
const {noauth} = payload;

if (noauth) {
const slfnoauth = process.env.MAESTRO_NOAUTH || "defaultSecretNoAuthToken"
const slfnoauth = process.env.MAESTRO_NOAUTH || "defaultSecretNoAuthToken";

if (noauth === slfnoauth) {
return done(null, payload);
Expand Down
2 changes: 1 addition & 1 deletion app/audit/config/private_token.js
Expand Up @@ -12,6 +12,6 @@ const genToken = () => {
};
const tk = jwt.encode(body, token);
return `JWT ${tk}`;
}
};

module.exports.token = genToken();
12 changes: 6 additions & 6 deletions app/audit/services/auditTrack.js
Expand Up @@ -7,25 +7,25 @@ const diffRightHand = require('./libs/diffRightHand');

const AuditTrack = (PersistenceStorage) => ({entity, entity_id, user}) => {

const recordTrackCharged = recordTrack(PersistenceStorage)
const recordTrackCharged = recordTrack(PersistenceStorage);

return {
update(odata, ndata) {
const created = _.isEmpty(odata)
const body = diff(odata, ndata)
const created = _.isEmpty(odata);
const body = diff(odata, ndata);
return recordTrackCharged(body, entity, entity_id, user, created);
},

patch(odata, ndata) {
const body = diffRightHand(ndata, odata)
const body = diffRightHand(ndata, odata);
return recordTrackCharged(body, entity, entity_id, user);
},

remove() {
const removed = true;
return recordTrackCharged({removed}, entity, entity_id, user);
}
}
};

}
};
module.exports = AuditTrack;
6 changes: 3 additions & 3 deletions app/audit/services/libs/activeHooks.js
Expand Up @@ -8,10 +8,10 @@ module.exports = (data, entity_id) => (rules, key) => {
if (_.has(data, key)) {

for (let rule in rules) {
const {command} = rules[rule]
commands[command](data, entity_id, rules[rule])
const {command} = rules[rule];
commands[command](data, entity_id, rules[rule]);
}

}

}
};
4 changes: 2 additions & 2 deletions app/audit/services/libs/commands.js
Expand Up @@ -8,7 +8,7 @@ const requestData = (post) => {
.create(`/sync`, post)
.then(console.info)
.catch(console.error);
}
};

module.exports = {
'sync': (data, entity_id, {foreign, field, filter}) => {
Expand Down Expand Up @@ -37,4 +37,4 @@ module.exports = {
}

}
}
};
4 changes: 2 additions & 2 deletions app/audit/services/libs/hookChanged.js
Expand Up @@ -9,9 +9,9 @@ const HookChanged = ({entity, entity_id, body}) => {
return new Promise((resolve) => {

if (_.has(Rules, entity))
_.forEach(Rules[entity], activeHooks(body, entity_id))
_.forEach(Rules[entity], activeHooks(body, entity_id));

resolve()
resolve();
});
};

Expand Down
2 changes: 1 addition & 1 deletion app/audit/services/libs/recordTrack.js
Expand Up @@ -21,7 +21,7 @@ module.exports = (PersistenceStorage) => (body, entity, entity_id, user, created
.catch(reject);

} else {
resolve()
resolve();
}
});
};

0 comments on commit f756942

Please sign in to comment.