CartoDB-SQL-API/lib/batch/user-database-metadata-service.js
Daniel García Aubert 5a96dbb59c Run eslint --fix
2019-12-23 18:19:08 +01:00

32 lines
873 B
JavaScript

'use strict';
function UserDatabaseMetadataService (metadataBackend) {
this.metadataBackend = metadataBackend;
}
UserDatabaseMetadataService.prototype.getUserMetadata = function (username, callback) {
var self = this;
this.metadataBackend.getAllUserDBParams(username, function (err, userDatabaseMetadata) {
if (err) {
return callback(err);
}
callback(null, self.parseMetadataToDatabase(userDatabaseMetadata));
});
};
UserDatabaseMetadataService.prototype.parseMetadataToDatabase = function (userDatabaseMetadata) {
var dbParams = userDatabaseMetadata;
var dbopts = {};
dbopts.port = dbParams.dbport || global.settings.db_batch_port || global.settings.db_port;
dbopts.host = dbParams.dbhost;
dbopts.dbname = dbParams.dbname;
return dbopts;
};
module.exports = UserDatabaseMetadataService;