Built motion from commit b0a9a629.|2.6.33
[motion2.git] / server / api / userNotification / userNotification.controller.js
index 864d7db..78a4af0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x42f2=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','sendUserNotification','body','hasOwnProperty','text','Sequelize','ValidationError','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','forEach','emit','userNotification:send','Template','render','catch','startCase','union','ids','queue','replace','Queue','push','flatten','findOne','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x42f2,0x175));var _0x242f=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0x42f2[_0x3a0c4f];return _0x247049;};'use strict';var emlformat=require(_0x242f('0x0'));var rimraf=require(_0x242f('0x1'));var zipdir=require(_0x242f('0x2'));var jsonpatch=require(_0x242f('0x3'));var rp=require(_0x242f('0x4'));var moment=require(_0x242f('0x5'));var BPromise=require(_0x242f('0x6'));var Mustache=require(_0x242f('0x7'));var util=require('util');var path=require(_0x242f('0x8'));var sox=require('sox');var csv=require(_0x242f('0x9'));var ejs=require(_0x242f('0xa'));var fs=require('fs');var fs_extra=require(_0x242f('0xb'));var _=require(_0x242f('0xc'));var squel=require('squel');var crypto=require(_0x242f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x242f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x242f('0xf'));var Papa=require(_0x242f('0x10'));var Redis=require(_0x242f('0x11'));var authService=require(_0x242f('0x12'));var qs=require(_0x242f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x242f('0x14'));var logger=require(_0x242f('0x15'))('api');var utils=require(_0x242f('0x16'));var config=require(_0x242f('0x17'));var licenseUtil=require(_0x242f('0x18'));var db=require('../../mysqldb')['db'];config[_0x242f('0x19')]=_[_0x242f('0x1a')](config[_0x242f('0x19')],{'host':_0x242f('0x1b'),'port':0x18eb});var socket=require(_0x242f('0x1c'))(new Redis(config['redis']));require(_0x242f('0x1d'))[_0x242f('0x1e')](socket);function respondWithStatusCode(_0x5288f3,_0x596dcd){_0x596dcd=_0x596dcd||0xcc;return function(_0x28c189){if(_0x28c189){return _0x5288f3[_0x242f('0x1f')](_0x596dcd);}return _0x5288f3[_0x242f('0x20')](_0x596dcd)[_0x242f('0x21')]();};}function respondWithResult(_0x5cafb8,_0x14e3a4){_0x14e3a4=_0x14e3a4||0xc8;return function(_0x161d37){if(_0x161d37){return _0x5cafb8[_0x242f('0x20')](_0x14e3a4)[_0x242f('0x22')](_0x161d37);}};}function respondWithFilteredResult(_0x4bed2a,_0x42a037){return function(_0x251681){if(_0x251681){var _0x2fdcca=typeof _0x42a037[_0x242f('0x23')]===_0x242f('0x24')&&typeof _0x42a037['limit']===_0x242f('0x24');var _0x19a1f7=_0x251681['count'];var _0x10bc6c=_0x2fdcca?0x0:_0x42a037[_0x242f('0x23')];var _0x36bc5f=_0x2fdcca?_0x251681[_0x242f('0x25')]:_0x42a037['offset']+_0x42a037[_0x242f('0x26')];var _0x337d0d;if(_0x36bc5f>=_0x19a1f7){_0x36bc5f=_0x19a1f7;_0x337d0d=0xc8;}else{_0x337d0d=0xce;}_0x4bed2a[_0x242f('0x20')](_0x337d0d);return _0x4bed2a[_0x242f('0x27')](_0x242f('0x28'),_0x10bc6c+'-'+_0x36bc5f+'/'+_0x19a1f7)['json'](_0x251681);}return null;};}function patchUpdates(_0x65e102){return function(_0xee8bad){try{jsonpatch[_0x242f('0x29')](_0xee8bad,_0x65e102,!![]);}catch(_0x146b05){return BPromise[_0x242f('0x2a')](_0x146b05);}return _0xee8bad[_0x242f('0x2b')]();};}function saveUpdates(_0x5c59db,_0x5f5d18){return function(_0x197e82){if(_0x197e82){return _0x197e82[_0x242f('0x2c')](_0x5c59db)['then'](function(_0x4bb8d9){return _0x4bb8d9;});}return null;};}function removeEntity(_0x435f50,_0x186e26){return function(_0x236804){if(_0x236804){return _0x236804[_0x242f('0x2d')]()[_0x242f('0x2e')](function(){_0x435f50[_0x242f('0x20')](0xcc)[_0x242f('0x21')]();});}};}function handleEntityNotFound(_0x359c43,_0x40145d){return function(_0x3da0a2){if(!_0x3da0a2){_0x359c43['sendStatus'](0x194);}return _0x3da0a2;};}function handleError(_0x18cfb5,_0x326a19){_0x326a19=_0x326a19||0x1f4;return function(_0x563c16){logger['error'](_0x563c16[_0x242f('0x2f')]);if(_0x563c16[_0x242f('0x30')]){delete _0x563c16['name'];}_0x18cfb5['status'](_0x326a19)['send'](_0x563c16);};}exports[_0x242f('0x31')]=function(_0x2d5ae1,_0x344e97,_0x1f17dd){if(!_0x2d5ae1[_0x242f('0x32')][_0x242f('0x33')](_0x242f('0x34'))&&!_0x2d5ae1[_0x242f('0x32')][_0x242f('0x33')]('TemplateId')){throw new db[(_0x242f('0x35'))][(_0x242f('0x36'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x2d5ae1[_0x242f('0x32')]['hasOwnProperty'](_0x242f('0x37'))&&!_0x2d5ae1['body']['hasOwnProperty'](_0x242f('0x38'))){throw new db[(_0x242f('0x35'))][(_0x242f('0x36'))](_0x242f('0x39'));}if(!_0x2d5ae1[_0x242f('0x32')]['hasOwnProperty'](_0x242f('0x3a'))){throw new db[(_0x242f('0x35'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x24883f=JSON[_0x242f('0x3b')](_0x2d5ae1[_0x242f('0x32')]['recipients']);}catch(_0x349978){logger[_0x242f('0x3c')](_0x349978);throw new db[(_0x242f('0x35'))]['ValidationError'](_0x242f('0x3d'));}var _0x1ec2b9=[_0x242f('0x3e'),_0x242f('0x3f'),_0x242f('0x40'),_0x242f('0x41'),_0x242f('0x42'),_0x242f('0x43'),_0x242f('0x44'),'team','user'];if(_[_0x242f('0x45')](_0x24883f,function(_0x6c2ac0){return!_['includes'](_0x1ec2b9,_0x6c2ac0['model'][_0x242f('0x46')]());})){throw new db[(_0x242f('0x35'))]['ValidationError'](_0x242f('0x47'));}}}var _0xd36a2d={};_0xd36a2d[_0x242f('0x48')]=_0x2d5ae1['body'][_0x242f('0x33')]('senderName')?_0x2d5ae1[_0x242f('0x32')][_0x242f('0x48')]:_0x2d5ae1[_0x242f('0x49')]['fullname'];_0xd36a2d[_0x242f('0x4a')]=_[_0x242f('0x4b')](_0x2d5ae1[_0x242f('0x32')][_0x242f('0x4a')])?null:_0x2d5ae1['body'][_0x242f('0x4a')];_0xd36a2d[_0x242f('0x4c')]=_0x2d5ae1[_0x242f('0x32')]['beep']||![];_0xd36a2d[_0x242f('0x4d')]=_0x2d5ae1[_0x242f('0x49')]['id'];return getContent(_0x2d5ae1[_0x242f('0x32')])[_0x242f('0x2e')](function(_0x45f708){_0xd36a2d['body']=_0x45f708;return getRecipients(_0x24883f);})[_0x242f('0x2e')](function(_0x52c830){_0xd36a2d[_0x242f('0x4e')]=_[_0x242f('0x4f')](_0x52c830)[_0x242f('0x50')](',');return db['sequelize']['transaction'](function(_0x587a88){return db['UserNotification']['create'](_0xd36a2d,{'raw':!![],'transaction':_0x587a88})[_0x242f('0x2e')](function(_0x27a972){var _0x534082={'sender':_0xd36a2d[_0x242f('0x48')],'description':_0xd36a2d[_0x242f('0x4a')],'content':_0xd36a2d[_0x242f('0x32')],'beep':_0xd36a2d[_0x242f('0x4c')]};_0x52c830[_0x242f('0x51')](function(_0x2ae755){_0x534082['recipient']=_0x2ae755;socket[_0x242f('0x52')](_0x242f('0x53'),_0x534082);});return _0x27a972;});});})['then'](respondWithResult(_0x344e97,0xc9))['catch'](handleError(_0x344e97,null));};function getContent(_0x444dc7){return new BPromise(function(_0x21c75a,_0x5ecab7){if(_0x444dc7[_0x242f('0x34')]){_0x21c75a(_0x444dc7[_0x242f('0x34')]);return;}return db[_0x242f('0x54')]['findOne']({'attributes':['html'],'where':{'id':_0x444dc7[_0x242f('0x37')]},'raw':!![]})[_0x242f('0x2e')](function(_0x2d0ef5){if(!_0x2d0ef5)throw new db['Sequelize'][(_0x242f('0x36'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x47b07d=Mustache[_0x242f('0x55')](_0x2d0ef5['html'],_0x444dc7['view']);_0x21c75a(_0x47b07d);})[_0x242f('0x56')](function(_0x5de13b){_0x5ecab7(_0x5de13b);});});}function getRecipients(_0x3c1c1b){return new BPromise(function(_0x4d3516,_0x174d44){var _0x2fdbac=[];var _0x59a669=[];_0x3c1c1b[_0x242f('0x51')](function(_0x2f6d55){var _0x593892=_[_0x242f('0x57')](_0x2f6d55['model'][_0x242f('0x46')]());if(_0x593892==='User'){_0x2fdbac=_[_0x242f('0x58')](_0x2fdbac,_0x2f6d55[_0x242f('0x59')]);}else{if(_['includes'](_0x593892,_0x242f('0x5a')))_0x593892=_0x593892[_0x242f('0x5b')]('queue',_0x242f('0x5c'));_0x2f6d55[_0x242f('0x59')][_0x242f('0x51')](function(_0x170856){_0x59a669[_0x242f('0x5d')](getAgents(_0x593892,_0x170856));});}});return BPromise['all'](_0x59a669)[_0x242f('0x2e')](function(_0x42ae09){_0x2fdbac=_[_0x242f('0x58')](_0x2fdbac,_[_0x242f('0x5e')](_0x42ae09));_0x4d3516(_0x2fdbac);})['catch'](function(_0x2e8624){_0x174d44(_0x2e8624);});});}function getAgents(_0x578bfc,_0x621626){return new BPromise(function(_0x33e5db,_0x17422d){return db[_0x578bfc][_0x242f('0x5f')]({'where':{'id':_0x621626}})['then'](function(_0x384173){return _0x384173[_0x242f('0x60')]({'attributes':['id'],'raw':!![]})[_0x242f('0x2e')](function(_0x2afc85){var _0x42f7dd=_['map'](_0x2afc85,'id');_0x33e5db(_0x42f7dd);});})[_0x242f('0x56')](function(_0x586c27){_0x17422d(_0x586c27);});});}
\ 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