This repository has been archived on 2023-09-06. You can view files and clone it, but cannot push or open issues or pull requests.
vn-softphone/views/quickbar/index.js

28 lines
645 B
JavaScript

let path = require('path');
let rootPath = process.cwd();
let db = require(path.join(rootPath, '/database.js'));
module.exports = {
/**
* Init model
*/
init: function(args, cb) {
this.getName(args.id, cb);
},
/**
* Get user data
*/
getName: function(id, cb) {
let sql = `SELECT name, extension FROM
account.user u JOIN pbx.sip s ON s.user_id = u.id WHERE id = ?`;
db.pool.query(sql, [id], (error, result) => {
if (error)
console.log(error);
Object.assign(this, result[0]);
cb();
});
}
}