feat(portal-data): use internals.resolveCb

This commit is contained in:
Sérgio Ramos 2017-06-28 00:11:19 +01:00 committed by Judit Greskovits
parent e8f05282fa
commit 3aa88141d4

View File

@ -260,7 +260,7 @@ module.exports = class Data extends EventEmitter {
args.deploymentGroupId = deploymentGroup.id; args.deploymentGroupId = deploymentGroup.id;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.getServices(args, resolveCb(resolve, reject)); this.getServices(args, internals.resolveCb(resolve, reject));
}); });
}; };
@ -270,7 +270,7 @@ module.exports = class Data extends EventEmitter {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
return deploymentGroup.version_id ? return deploymentGroup.version_id ?
this.getVersion(args, resolveCb(resolve, reject)) : this.getVersion(args, internals.resolveCb(resolve, reject)) :
resolve(null); resolve(null);
}); });
}; };
@ -291,17 +291,6 @@ module.exports = class Data extends EventEmitter {
return cb(null, []); return cb(null, []);
} }
const getServices = (deploymentGroupId) => {
return (args) => {
args = args || {};
args.deploymentGroupId = deploymentGroupId;
return new Promise((resolve, reject) => {
this.getServices(args, internals.resolveCb(resolve, reject));
});
};
};
// todo getHistory // todo getHistory
cb(null, deploymentGroups.map((dg) => { return Transform.fromDeploymentGroup(this._getDeploymentGroupVersion(dg)); })); cb(null, deploymentGroups.map((dg) => { return Transform.fromDeploymentGroup(this._getDeploymentGroupVersion(dg)); }));
@ -346,7 +335,7 @@ module.exports = class Data extends EventEmitter {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
return this.getManifest({ return this.getManifest({
id: version.manifest_id id: version.manifest_id
}, resolveCb(resolve, reject)); }, internals.resolveCb(resolve, reject));
}); });
} }
}); });