Built motion from commit b0a9a629.|2.6.33
[motion2.git] / server / api / userNotification / userNotification.controller.js
index 74ed7e6..78a4af0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x351f=['hasOwnProperty','text','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','recipients','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','transaction','create','recipient','emit','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','replace','Queue','forEach','push','all','flatten','getAgents','map','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./userNotification.socket','sendStatus','status','end','undefined','limit','count','offset','Content-Range','reject','save','then','stack','name','sendUserNotification','body'];(function(_0x4f2568,_0x39f223){var _0x300894=function(_0x139451){while(--_0x139451){_0x4f2568['push'](_0x4f2568['shift']());}};_0x300894(++_0x39f223);}(_0x351f,0x91));var _0xf351=function(_0x50ebce,_0x313c6f){_0x50ebce=_0x50ebce-0x0;var _0x4a2518=_0x351f[_0x50ebce];return _0x4a2518;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf351('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf351('0x1'));var rp=require(_0xf351('0x2'));var moment=require(_0xf351('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf351('0x4'));var util=require(_0xf351('0x5'));var path=require(_0xf351('0x6'));var sox=require('sox');var csv=require(_0xf351('0x7'));var ejs=require(_0xf351('0x8'));var fs=require('fs');var fs_extra=require(_0xf351('0x9'));var _=require('lodash');var squel=require(_0xf351('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf351('0xb'));var toCsv=require(_0xf351('0x7'));var querystring=require(_0xf351('0xc'));var Papa=require(_0xf351('0xd'));var Redis=require('ioredis');var authService=require(_0xf351('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf351('0xf'));var hardwareService=require(_0xf351('0x10'));var logger=require(_0xf351('0x11'))('api');var utils=require(_0xf351('0x12'));var config=require(_0xf351('0x13'));var licenseUtil=require(_0xf351('0x14'));var db=require(_0xf351('0x15'))['db'];config[_0xf351('0x16')]=_['defaults'](config[_0xf351('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf351('0x16')]));require(_0xf351('0x17'))['register'](socket);function respondWithStatusCode(_0x158cdc,_0x58e8e9){_0x58e8e9=_0x58e8e9||0xcc;return function(_0x37eafe){if(_0x37eafe){return _0x158cdc[_0xf351('0x18')](_0x58e8e9);}return _0x158cdc[_0xf351('0x19')](_0x58e8e9)[_0xf351('0x1a')]();};}function respondWithResult(_0x27b589,_0x2e8949){_0x2e8949=_0x2e8949||0xc8;return function(_0x58ca74){if(_0x58ca74){return _0x27b589[_0xf351('0x19')](_0x2e8949)['json'](_0x58ca74);}};}function respondWithFilteredResult(_0x3cc504,_0x248744){return function(_0x5783f8){if(_0x5783f8){var _0xa507a8=typeof _0x248744['offset']===_0xf351('0x1b')&&typeof _0x248744[_0xf351('0x1c')]===_0xf351('0x1b');var _0x44ad82=_0x5783f8[_0xf351('0x1d')];var _0x10dcf3=_0xa507a8?0x0:_0x248744['offset'];var _0x140408=_0xa507a8?_0x5783f8['count']:_0x248744[_0xf351('0x1e')]+_0x248744[_0xf351('0x1c')];var _0x3b1add;if(_0x140408>=_0x44ad82){_0x140408=_0x44ad82;_0x3b1add=0xc8;}else{_0x3b1add=0xce;}_0x3cc504[_0xf351('0x19')](_0x3b1add);return _0x3cc504['set'](_0xf351('0x1f'),_0x10dcf3+'-'+_0x140408+'/'+_0x44ad82)['json'](_0x5783f8);}return null;};}function patchUpdates(_0x315090){return function(_0x7cedab){try{jsonpatch['apply'](_0x7cedab,_0x315090,!![]);}catch(_0x29b88a){return BPromise[_0xf351('0x20')](_0x29b88a);}return _0x7cedab[_0xf351('0x21')]();};}function saveUpdates(_0x41ce07,_0x331d18){return function(_0x392235){if(_0x392235){return _0x392235['update'](_0x41ce07)[_0xf351('0x22')](function(_0x1fb9a7){return _0x1fb9a7;});}return null;};}function removeEntity(_0x56f87d,_0x199c09){return function(_0x12901d){if(_0x12901d){return _0x12901d['destroy']()['then'](function(){_0x56f87d['status'](0xcc)[_0xf351('0x1a')]();});}};}function handleEntityNotFound(_0x49b7f8,_0x549f79){return function(_0x4670d7){if(!_0x4670d7){_0x49b7f8[_0xf351('0x18')](0x194);}return _0x4670d7;};}function handleError(_0x4fc88a,_0x82e08e){_0x82e08e=_0x82e08e||0x1f4;return function(_0x1b8c28){logger['error'](_0x1b8c28[_0xf351('0x23')]);if(_0x1b8c28['name']){delete _0x1b8c28[_0xf351('0x24')];}_0x4fc88a['status'](_0x82e08e)['send'](_0x1b8c28);};}exports[_0xf351('0x25')]=function(_0x1b7ff6,_0x2996f0,_0x110469){if(!_0x1b7ff6[_0xf351('0x26')][_0xf351('0x27')](_0xf351('0x28'))&&!_0x1b7ff6[_0xf351('0x26')][_0xf351('0x27')](_0xf351('0x29'))){throw new db['Sequelize']['ValidationError'](_0xf351('0x2a'));}else{if(_0x1b7ff6[_0xf351('0x26')][_0xf351('0x27')](_0xf351('0x29'))&&!_0x1b7ff6['body'][_0xf351('0x27')](_0xf351('0x2b'))){throw new db[(_0xf351('0x2c'))][(_0xf351('0x2d'))](_0xf351('0x2e'));}if(!_0x1b7ff6[_0xf351('0x26')][_0xf351('0x27')]('recipients')){throw new db[(_0xf351('0x2c'))][(_0xf351('0x2d'))](_0xf351('0x2f'));}else{try{var _0xddd30e=JSON['parse'](_0x1b7ff6[_0xf351('0x26')][_0xf351('0x30')]);}catch(_0x4e5849){logger[_0xf351('0x31')](_0x4e5849);throw new db[(_0xf351('0x2c'))][(_0xf351('0x2d'))](_0xf351('0x32'));}var _0x189192=[_0xf351('0x33'),_0xf351('0x34'),_0xf351('0x35'),'openchannelqueue',_0xf351('0x36'),_0xf351('0x37'),'whatsappqueue',_0xf351('0x38'),_0xf351('0x39')];if(_[_0xf351('0x3a')](_0xddd30e,function(_0x1544c0){return!_[_0xf351('0x3b')](_0x189192,_0x1544c0[_0xf351('0x3c')][_0xf351('0x3d')]());})){throw new db[(_0xf351('0x2c'))][(_0xf351('0x2d'))](_0xf351('0x3e'));}}}var _0x203efb={};_0x203efb[_0xf351('0x3f')]=_0x1b7ff6[_0xf351('0x26')][_0xf351('0x27')](_0xf351('0x3f'))?_0x1b7ff6[_0xf351('0x26')]['senderName']:_0x1b7ff6[_0xf351('0x39')]['fullname'];_0x203efb[_0xf351('0x40')]=_[_0xf351('0x41')](_0x1b7ff6[_0xf351('0x26')][_0xf351('0x40')])?null:_0x1b7ff6[_0xf351('0x26')][_0xf351('0x40')];_0x203efb[_0xf351('0x42')]=_0x1b7ff6[_0xf351('0x26')][_0xf351('0x42')]||![];_0x203efb[_0xf351('0x43')]=_0x1b7ff6[_0xf351('0x39')]['id'];return getContent(_0x1b7ff6[_0xf351('0x26')])[_0xf351('0x22')](function(_0x5439f4){_0x203efb[_0xf351('0x26')]=_0x5439f4;return getRecipients(_0xddd30e);})['then'](function(_0xb5631c){_0x203efb['recipientsId']=_[_0xf351('0x44')](_0xb5631c)[_0xf351('0x45')](',');return db[_0xf351('0x46')][_0xf351('0x47')](function(_0x394026){return db['UserNotification'][_0xf351('0x48')](_0x203efb,{'raw':!![],'transaction':_0x394026})[_0xf351('0x22')](function(_0xe02fb0){var _0x204597={'sender':_0x203efb[_0xf351('0x3f')],'description':_0x203efb[_0xf351('0x40')],'content':_0x203efb['body'],'beep':_0x203efb[_0xf351('0x42')]};_0xb5631c['forEach'](function(_0x5694df){_0x204597[_0xf351('0x49')]=_0x5694df;socket[_0xf351('0x4a')]('userNotification:send',_0x204597);});return _0xe02fb0;});});})[_0xf351('0x22')](respondWithResult(_0x2996f0,0xc9))[_0xf351('0x4b')](handleError(_0x2996f0,null));};function getContent(_0x25a4f8){return new BPromise(function(_0x4d617f,_0x5b07f9){if(_0x25a4f8['text']){_0x4d617f(_0x25a4f8[_0xf351('0x28')]);return;}return db[_0xf351('0x4c')][_0xf351('0x4d')]({'attributes':[_0xf351('0x4e')],'where':{'id':_0x25a4f8[_0xf351('0x29')]},'raw':!![]})[_0xf351('0x22')](function(_0x3823f8){if(!_0x3823f8)throw new db['Sequelize'][(_0xf351('0x2d'))](_0xf351('0x4f'));var _0x4d500d=Mustache[_0xf351('0x50')](_0x3823f8[_0xf351('0x4e')],_0x25a4f8[_0xf351('0x2b')]);_0x4d617f(_0x4d500d);})['catch'](function(_0xf473cc){_0x5b07f9(_0xf473cc);});});}function getRecipients(_0x1e8d68){return new BPromise(function(_0x3fcb04,_0x4dc06a){var _0x45d8a8=[];var _0x119687=[];_0x1e8d68['forEach'](function(_0x47ced7){var _0x51bbf8=_[_0xf351('0x51')](_0x47ced7['model'][_0xf351('0x3d')]());if(_0x51bbf8===_0xf351('0x52')){_0x45d8a8=_[_0xf351('0x53')](_0x45d8a8,_0x47ced7['ids']);}else{if(_['includes'](_0x51bbf8,'queue'))_0x51bbf8=_0x51bbf8[_0xf351('0x54')]('queue',_0xf351('0x55'));_0x47ced7['ids'][_0xf351('0x56')](function(_0x2e6d6d){_0x119687[_0xf351('0x57')](getAgents(_0x51bbf8,_0x2e6d6d));});}});return BPromise[_0xf351('0x58')](_0x119687)[_0xf351('0x22')](function(_0x4ab790){_0x45d8a8=_[_0xf351('0x53')](_0x45d8a8,_[_0xf351('0x59')](_0x4ab790));_0x3fcb04(_0x45d8a8);})[_0xf351('0x4b')](function(_0x4cc34d){_0x4dc06a(_0x4cc34d);});});}function getAgents(_0xfc8d3c,_0x14e753){return new BPromise(function(_0x2295b0,_0x158cac){return db[_0xfc8d3c][_0xf351('0x4d')]({'where':{'id':_0x14e753}})[_0xf351('0x22')](function(_0x2fa249){return _0x2fa249[_0xf351('0x5a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x18e1be){var _0x1525de=_[_0xf351('0x5b')](_0x18e1be,'id');_0x2295b0(_0x1525de);});})[_0xf351('0x4b')](function(_0x6d2764){_0x158cac(_0x6d2764);});});}
\ No newline at end of file
+var _0x123b=['fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','sendStatus','end','json','offset','undefined','count','status','reject','update','then','error','stack','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','transaction','create','forEach','recipient','emit','userNotification:send','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','catch','User','ids','queue','replace','Queue','push','all','union','flatten','getAgents','map','eml-format','rimraf'];(function(_0x34d07c,_0x4e491e){var _0x132342=function(_0x4b18f0){while(--_0x4b18f0){_0x34d07c['push'](_0x34d07c['shift']());}};_0x132342(++_0x4e491e);}(_0x123b,0x1de));var _0xb123=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x123b[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0xb123('0x0'));var rimraf=require(_0xb123('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb123('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb123('0x3'));var Mustache=require(_0xb123('0x4'));var util=require(_0xb123('0x5'));var path=require(_0xb123('0x6'));var sox=require(_0xb123('0x7'));var csv=require(_0xb123('0x8'));var ejs=require(_0xb123('0x9'));var fs=require('fs');var fs_extra=require(_0xb123('0xa'));var _=require(_0xb123('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb123('0xc'));var toCsv=require(_0xb123('0x8'));var querystring=require('querystring');var Papa=require(_0xb123('0xd'));var Redis=require(_0xb123('0xe'));var authService=require(_0xb123('0xf'));var qs=require(_0xb123('0x10'));var as=require(_0xb123('0x11'));var hardwareService=require(_0xb123('0x12'));var logger=require(_0xb123('0x13'))(_0xb123('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb123('0x15'));var db=require(_0xb123('0x16'))['db'];config[_0xb123('0x17')]=_['defaults'](config[_0xb123('0x17')],{'host':_0xb123('0x18'),'port':0x18eb});var socket=require(_0xb123('0x19'))(new Redis(config[_0xb123('0x17')]));require(_0xb123('0x1a'))['register'](socket);function respondWithStatusCode(_0x562a72,_0x3c6c27){_0x3c6c27=_0x3c6c27||0xcc;return function(_0x241cdb){if(_0x241cdb){return _0x562a72[_0xb123('0x1b')](_0x3c6c27);}return _0x562a72['status'](_0x3c6c27)[_0xb123('0x1c')]();};}function respondWithResult(_0x4beeb1,_0xe85973){_0xe85973=_0xe85973||0xc8;return function(_0x43dd86){if(_0x43dd86){return _0x4beeb1['status'](_0xe85973)[_0xb123('0x1d')](_0x43dd86);}};}function respondWithFilteredResult(_0x7158b3,_0x3d38b4){return function(_0x5444e6){if(_0x5444e6){var _0x15dd23=typeof _0x3d38b4[_0xb123('0x1e')]===_0xb123('0x1f')&&typeof _0x3d38b4['limit']===_0xb123('0x1f');var _0x527541=_0x5444e6[_0xb123('0x20')];var _0x58a42a=_0x15dd23?0x0:_0x3d38b4['offset'];var _0x1dc84a=_0x15dd23?_0x5444e6[_0xb123('0x20')]:_0x3d38b4[_0xb123('0x1e')]+_0x3d38b4['limit'];var _0x27cb04;if(_0x1dc84a>=_0x527541){_0x1dc84a=_0x527541;_0x27cb04=0xc8;}else{_0x27cb04=0xce;}_0x7158b3[_0xb123('0x21')](_0x27cb04);return _0x7158b3['set']('Content-Range',_0x58a42a+'-'+_0x1dc84a+'/'+_0x527541)[_0xb123('0x1d')](_0x5444e6);}return null;};}function patchUpdates(_0x1c6678){return function(_0x14d45f){try{jsonpatch['apply'](_0x14d45f,_0x1c6678,!![]);}catch(_0x31ac72){return BPromise[_0xb123('0x22')](_0x31ac72);}return _0x14d45f['save']();};}function saveUpdates(_0x1078d5,_0x23581c){return function(_0x2dabfc){if(_0x2dabfc){return _0x2dabfc[_0xb123('0x23')](_0x1078d5)['then'](function(_0x331765){return _0x331765;});}return null;};}function removeEntity(_0x3504d8,_0x502509){return function(_0x7ef348){if(_0x7ef348){return _0x7ef348['destroy']()[_0xb123('0x24')](function(){_0x3504d8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c2e99,_0x5805cc){return function(_0x528d64){if(!_0x528d64){_0x4c2e99[_0xb123('0x1b')](0x194);}return _0x528d64;};}function handleError(_0xfe740d,_0x2f010c){_0x2f010c=_0x2f010c||0x1f4;return function(_0x19df71){logger[_0xb123('0x25')](_0x19df71[_0xb123('0x26')]);if(_0x19df71['name']){delete _0x19df71['name'];}_0xfe740d['status'](_0x2f010c)[_0xb123('0x27')](_0x19df71);};}exports[_0xb123('0x28')]=function(_0x3ec537,_0x30e42f,_0x2f23dc){if(!_0x3ec537[_0xb123('0x29')][_0xb123('0x2a')](_0xb123('0x2b'))&&!_0x3ec537[_0xb123('0x29')][_0xb123('0x2a')](_0xb123('0x2c'))){throw new db['Sequelize'][(_0xb123('0x2d'))](_0xb123('0x2e'));}else{if(_0x3ec537['body'][_0xb123('0x2a')](_0xb123('0x2c'))&&!_0x3ec537[_0xb123('0x29')][_0xb123('0x2a')](_0xb123('0x2f'))){throw new db['Sequelize'][(_0xb123('0x2d'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x3ec537[_0xb123('0x29')][_0xb123('0x2a')]('recipients')){throw new db[(_0xb123('0x30'))][(_0xb123('0x2d'))](_0xb123('0x31'));}else{try{var _0x409137=JSON[_0xb123('0x32')](_0x3ec537[_0xb123('0x29')][_0xb123('0x33')]);}catch(_0x5841df){logger['error'](_0x5841df);throw new db[(_0xb123('0x30'))][(_0xb123('0x2d'))](_0xb123('0x34'));}var _0x2d0767=[_0xb123('0x35'),_0xb123('0x36'),_0xb123('0x37'),_0xb123('0x38'),'smsqueue',_0xb123('0x39'),'whatsappqueue',_0xb123('0x3a'),_0xb123('0x3b')];if(_[_0xb123('0x3c')](_0x409137,function(_0x15a0e7){return!_[_0xb123('0x3d')](_0x2d0767,_0x15a0e7[_0xb123('0x3e')][_0xb123('0x3f')]());})){throw new db[(_0xb123('0x30'))][(_0xb123('0x2d'))](_0xb123('0x40'));}}}var _0x16d30b={};_0x16d30b[_0xb123('0x41')]=_0x3ec537[_0xb123('0x29')][_0xb123('0x2a')]('senderName')?_0x3ec537[_0xb123('0x29')]['senderName']:_0x3ec537[_0xb123('0x3b')][_0xb123('0x42')];_0x16d30b[_0xb123('0x43')]=_[_0xb123('0x44')](_0x3ec537[_0xb123('0x29')]['recipientsDescription'])?null:_0x3ec537[_0xb123('0x29')][_0xb123('0x43')];_0x16d30b[_0xb123('0x45')]=_0x3ec537['body'][_0xb123('0x45')]||![];_0x16d30b[_0xb123('0x46')]=_0x3ec537[_0xb123('0x3b')]['id'];return getContent(_0x3ec537[_0xb123('0x29')])['then'](function(_0x3ef666){_0x16d30b['body']=_0x3ef666;return getRecipients(_0x409137);})['then'](function(_0x2cb23c){_0x16d30b[_0xb123('0x47')]=_['sortBy'](_0x2cb23c)[_0xb123('0x48')](',');return db[_0xb123('0x49')][_0xb123('0x4a')](function(_0x214a55){return db['UserNotification'][_0xb123('0x4b')](_0x16d30b,{'raw':!![],'transaction':_0x214a55})[_0xb123('0x24')](function(_0x530f15){var _0x10ba9d={'sender':_0x16d30b[_0xb123('0x41')],'description':_0x16d30b['recipientsDescription'],'content':_0x16d30b[_0xb123('0x29')],'beep':_0x16d30b[_0xb123('0x45')]};_0x2cb23c[_0xb123('0x4c')](function(_0x46140d){_0x10ba9d[_0xb123('0x4d')]=_0x46140d;socket[_0xb123('0x4e')](_0xb123('0x4f'),_0x10ba9d);});return _0x530f15;});});})[_0xb123('0x24')](respondWithResult(_0x30e42f,0xc9))['catch'](handleError(_0x30e42f,null));};function getContent(_0x4af162){return new BPromise(function(_0x3a8718,_0x249811){if(_0x4af162[_0xb123('0x2b')]){_0x3a8718(_0x4af162[_0xb123('0x2b')]);return;}return db['Template'][_0xb123('0x50')]({'attributes':['html'],'where':{'id':_0x4af162[_0xb123('0x2c')]},'raw':!![]})[_0xb123('0x24')](function(_0x2e6ba7){if(!_0x2e6ba7)throw new db[(_0xb123('0x30'))][(_0xb123('0x2d'))](_0xb123('0x51'));var _0x5bbe99=Mustache[_0xb123('0x52')](_0x2e6ba7[_0xb123('0x53')],_0x4af162[_0xb123('0x2f')]);_0x3a8718(_0x5bbe99);})[_0xb123('0x54')](function(_0x55c62f){_0x249811(_0x55c62f);});});}function getRecipients(_0x1fe575){return new BPromise(function(_0x3ae9f8,_0x5ad295){var _0x16a74c=[];var _0x13a610=[];_0x1fe575['forEach'](function(_0x3cbe6c){var _0x5dba87=_['startCase'](_0x3cbe6c[_0xb123('0x3e')][_0xb123('0x3f')]());if(_0x5dba87===_0xb123('0x55')){_0x16a74c=_['union'](_0x16a74c,_0x3cbe6c[_0xb123('0x56')]);}else{if(_[_0xb123('0x3d')](_0x5dba87,_0xb123('0x57')))_0x5dba87=_0x5dba87[_0xb123('0x58')](_0xb123('0x57'),_0xb123('0x59'));_0x3cbe6c[_0xb123('0x56')][_0xb123('0x4c')](function(_0x2267b1){_0x13a610[_0xb123('0x5a')](getAgents(_0x5dba87,_0x2267b1));});}});return BPromise[_0xb123('0x5b')](_0x13a610)[_0xb123('0x24')](function(_0x1c517d){_0x16a74c=_[_0xb123('0x5c')](_0x16a74c,_[_0xb123('0x5d')](_0x1c517d));_0x3ae9f8(_0x16a74c);})[_0xb123('0x54')](function(_0x107d0a){_0x5ad295(_0x107d0a);});});}function getAgents(_0x20095e,_0x5254a3){return new BPromise(function(_0x513a43,_0x4ec7fb){return db[_0x20095e]['findOne']({'where':{'id':_0x5254a3}})[_0xb123('0x24')](function(_0x2bc603){return _0x2bc603[_0xb123('0x5e')]({'attributes':['id'],'raw':!![]})[_0xb123('0x24')](function(_0x174edb){var _0x4bb224=_[_0xb123('0x5f')](_0x174edb,'id');_0x513a43(_0x4bb224);});})['catch'](function(_0x4e5f21){_0x4ec7fb(_0x4e5f21);});});}
\ No newline at end of file