2015-12-10 03:17:45 +08:00
|
|
|
'use strict';
|
|
|
|
|
2015-12-16 22:57:58 +08:00
|
|
|
function JobService(userDatabaseMetadataService, job) {
|
|
|
|
this.userDatabaseMetadataService = userDatabaseMetadataService;
|
|
|
|
this.job = job;
|
2015-12-10 03:17:45 +08:00
|
|
|
}
|
|
|
|
|
2015-12-16 22:57:58 +08:00
|
|
|
JobService.prototype.run = function (username, callback) {
|
2015-12-10 03:17:45 +08:00
|
|
|
var self = this;
|
|
|
|
|
2015-12-16 22:57:58 +08:00
|
|
|
this.userDatabaseMetadataService.getUserMetadata(username, function (err, userDatabaseMetadata) {
|
2015-12-10 03:17:45 +08:00
|
|
|
if (err) {
|
|
|
|
return callback(err);
|
|
|
|
}
|
|
|
|
|
2015-12-16 22:57:58 +08:00
|
|
|
self.job.run(userDatabaseMetadata, callback);
|
2015-12-10 03:17:45 +08:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2015-12-16 22:57:58 +08:00
|
|
|
module.exports = JobService;
|