const app = require('vn-loopback/server/server'); module.exports = Self => { Self.getLinker = 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.VnUser.rawSql('CALL pbx.sip_setPassword(?, ?)', [info.user.id, password] ); } }); };