const app = require('vn-loopback/server/server'); module.exports = Self => { Self.getSynchronizer = async function() { return await Self.findOne({fields: ['id']}); }; Object.assign(Self.prototype, { async syncUser(userName, info, password) { if (!info.hasAccount || !password) return; await app.models.Account.rawSql('CALL pbx.sip_setPassword(?, ?)', [info.user.id, password] ); } }); };