Built motion from commit b0a9a629.|2.6.33
[motion2.git] / server / api / userNotification / userNotification.controller.js
index ab21b79..78a4af0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x55c4=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','Sequelize','ValidationError','TemplateId','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','smsqueue','voicequeue','whatsappqueue','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','isEmpty','recipientsDescription','beep','recipientsId','sortBy','join','transaction','UserNotification','create','recipient','emit','catch','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','forEach','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0xc99620,_0x28d9c1){var _0x21cd2f=function(_0x37f52e){while(--_0x37f52e){_0xc99620['push'](_0xc99620['shift']());}};_0x21cd2f(++_0x28d9c1);}(_0x55c4,0xbb));var _0x455c=function(_0x453db9,_0xf73ae1){_0x453db9=_0x453db9-0x0;var _0x350087=_0x55c4[_0x453db9];return _0x350087;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x455c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x455c('0x1'));var moment=require('moment');var BPromise=require(_0x455c('0x2'));var Mustache=require('mustache');var util=require(_0x455c('0x3'));var path=require('path');var sox=require(_0x455c('0x4'));var csv=require(_0x455c('0x5'));var ejs=require(_0x455c('0x6'));var fs=require('fs');var fs_extra=require(_0x455c('0x7'));var _=require(_0x455c('0x8'));var squel=require(_0x455c('0x9'));var crypto=require(_0x455c('0xa'));var jsforce=require(_0x455c('0xb'));var deskjs=require(_0x455c('0xc'));var toCsv=require(_0x455c('0x5'));var querystring=require('querystring');var Papa=require(_0x455c('0xd'));var Redis=require(_0x455c('0xe'));var authService=require(_0x455c('0xf'));var qs=require(_0x455c('0x10'));var as=require(_0x455c('0x11'));var hardwareService=require(_0x455c('0x12'));var logger=require(_0x455c('0x13'))('api');var utils=require(_0x455c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x455c('0x15'));var db=require(_0x455c('0x16'))['db'];config['redis']=_['defaults'](config[_0x455c('0x17')],{'host':_0x455c('0x18'),'port':0x18eb});var socket=require(_0x455c('0x19'))(new Redis(config['redis']));require(_0x455c('0x1a'))[_0x455c('0x1b')](socket);function respondWithStatusCode(_0xa30860,_0x5144d8){_0x5144d8=_0x5144d8||0xcc;return function(_0x40d191){if(_0x40d191){return _0xa30860[_0x455c('0x1c')](_0x5144d8);}return _0xa30860[_0x455c('0x1d')](_0x5144d8)['end']();};}function respondWithResult(_0x2a36c7,_0x4d3ce7){_0x4d3ce7=_0x4d3ce7||0xc8;return function(_0x3f51a0){if(_0x3f51a0){return _0x2a36c7[_0x455c('0x1d')](_0x4d3ce7)[_0x455c('0x1e')](_0x3f51a0);}};}function respondWithFilteredResult(_0x4da8f8,_0x4dacc8){return function(_0x5ba249){if(_0x5ba249){var _0x31256d=typeof _0x4dacc8['offset']===_0x455c('0x1f')&&typeof _0x4dacc8[_0x455c('0x20')]===_0x455c('0x1f');var _0x50a7b5=_0x5ba249[_0x455c('0x21')];var _0x5eaf41=_0x31256d?0x0:_0x4dacc8[_0x455c('0x22')];var _0x2335c5=_0x31256d?_0x5ba249[_0x455c('0x21')]:_0x4dacc8[_0x455c('0x22')]+_0x4dacc8['limit'];var _0x273544;if(_0x2335c5>=_0x50a7b5){_0x2335c5=_0x50a7b5;_0x273544=0xc8;}else{_0x273544=0xce;}_0x4da8f8[_0x455c('0x1d')](_0x273544);return _0x4da8f8[_0x455c('0x23')](_0x455c('0x24'),_0x5eaf41+'-'+_0x2335c5+'/'+_0x50a7b5)[_0x455c('0x1e')](_0x5ba249);}return null;};}function patchUpdates(_0x833cc){return function(_0x27137a){try{jsonpatch[_0x455c('0x25')](_0x27137a,_0x833cc,!![]);}catch(_0x5a7f8c){return BPromise[_0x455c('0x26')](_0x5a7f8c);}return _0x27137a[_0x455c('0x27')]();};}function saveUpdates(_0x3d2bf9,_0x411237){return function(_0x302bc1){if(_0x302bc1){return _0x302bc1[_0x455c('0x28')](_0x3d2bf9)[_0x455c('0x29')](function(_0x5ef8ed){return _0x5ef8ed;});}return null;};}function removeEntity(_0x406702,_0xee032d){return function(_0x4e6525){if(_0x4e6525){return _0x4e6525[_0x455c('0x2a')]()[_0x455c('0x29')](function(){_0x406702[_0x455c('0x1d')](0xcc)[_0x455c('0x2b')]();});}};}function handleEntityNotFound(_0x24041b,_0x5c7f99){return function(_0x37214e){if(!_0x37214e){_0x24041b[_0x455c('0x1c')](0x194);}return _0x37214e;};}function handleError(_0x2dd3e1,_0x346e0d){_0x346e0d=_0x346e0d||0x1f4;return function(_0xf24782){logger[_0x455c('0x2c')](_0xf24782[_0x455c('0x2d')]);if(_0xf24782['name']){delete _0xf24782[_0x455c('0x2e')];}_0x2dd3e1[_0x455c('0x1d')](_0x346e0d)[_0x455c('0x2f')](_0xf24782);};}exports[_0x455c('0x30')]=function(_0x257832,_0x56e9b8,_0x1b8a71){if(!_0x257832[_0x455c('0x31')][_0x455c('0x32')](_0x455c('0x33'))&&!_0x257832[_0x455c('0x31')]['hasOwnProperty']('TemplateId')){throw new db[(_0x455c('0x34'))][(_0x455c('0x35'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x257832['body'][_0x455c('0x32')](_0x455c('0x36'))&&!_0x257832['body'][_0x455c('0x32')](_0x455c('0x37'))){throw new db[(_0x455c('0x34'))][(_0x455c('0x35'))](_0x455c('0x38'));}if(!_0x257832[_0x455c('0x31')][_0x455c('0x32')]('recipients')){throw new db['Sequelize'][(_0x455c('0x35'))](_0x455c('0x39'));}else{try{var _0x2e9458=JSON[_0x455c('0x3a')](_0x257832[_0x455c('0x31')][_0x455c('0x3b')]);}catch(_0x97de4c){logger[_0x455c('0x2c')](_0x97de4c);throw new db['Sequelize']['ValidationError'](_0x455c('0x3c'));}var _0x302a81=[_0x455c('0x3d'),_0x455c('0x3e'),'mailqueue','openchannelqueue',_0x455c('0x3f'),_0x455c('0x40'),_0x455c('0x41'),'team','user'];if(_[_0x455c('0x42')](_0x2e9458,function(_0x5b4183){return!_[_0x455c('0x43')](_0x302a81,_0x5b4183[_0x455c('0x44')][_0x455c('0x45')]());})){throw new db[(_0x455c('0x34'))][(_0x455c('0x35'))](_0x455c('0x46'));}}}var _0x4b15a7={};_0x4b15a7[_0x455c('0x47')]=_0x257832[_0x455c('0x31')]['hasOwnProperty'](_0x455c('0x47'))?_0x257832[_0x455c('0x31')]['senderName']:_0x257832[_0x455c('0x48')]['fullname'];_0x4b15a7['recipientsDescription']=_[_0x455c('0x49')](_0x257832[_0x455c('0x31')][_0x455c('0x4a')])?null:_0x257832[_0x455c('0x31')][_0x455c('0x4a')];_0x4b15a7[_0x455c('0x4b')]=_0x257832['body']['beep']||![];_0x4b15a7['SenderId']=_0x257832[_0x455c('0x48')]['id'];return getContent(_0x257832[_0x455c('0x31')])[_0x455c('0x29')](function(_0x4fecfe){_0x4b15a7['body']=_0x4fecfe;return getRecipients(_0x2e9458);})[_0x455c('0x29')](function(_0x4c8137){_0x4b15a7[_0x455c('0x4c')]=_[_0x455c('0x4d')](_0x4c8137)[_0x455c('0x4e')](',');return db['sequelize'][_0x455c('0x4f')](function(_0x1b2ec5){return db[_0x455c('0x50')][_0x455c('0x51')](_0x4b15a7,{'raw':!![],'transaction':_0x1b2ec5})['then'](function(_0x22dbb4){var _0x233b47={'sender':_0x4b15a7[_0x455c('0x47')],'description':_0x4b15a7['recipientsDescription'],'content':_0x4b15a7[_0x455c('0x31')],'beep':_0x4b15a7[_0x455c('0x4b')]};_0x4c8137['forEach'](function(_0x1f4dd4){_0x233b47[_0x455c('0x52')]=_0x1f4dd4;socket[_0x455c('0x53')]('userNotification:send',_0x233b47);});return _0x22dbb4;});});})[_0x455c('0x29')](respondWithResult(_0x56e9b8,0xc9))[_0x455c('0x54')](handleError(_0x56e9b8,null));};function getContent(_0xc6d2c7){return new BPromise(function(_0x3db49a,_0x3c7306){if(_0xc6d2c7[_0x455c('0x33')]){_0x3db49a(_0xc6d2c7['text']);return;}return db['Template'][_0x455c('0x55')]({'attributes':['html'],'where':{'id':_0xc6d2c7['TemplateId']},'raw':!![]})['then'](function(_0x470cfe){if(!_0x470cfe)throw new db[(_0x455c('0x34'))][(_0x455c('0x35'))](_0x455c('0x56'));var _0x4345a3=Mustache[_0x455c('0x57')](_0x470cfe[_0x455c('0x58')],_0xc6d2c7[_0x455c('0x37')]);_0x3db49a(_0x4345a3);})[_0x455c('0x54')](function(_0x44f778){_0x3c7306(_0x44f778);});});}function getRecipients(_0x5aa36c){return new BPromise(function(_0x160783,_0x18f364){var _0x1ae837=[];var _0x2cc4b5=[];_0x5aa36c[_0x455c('0x59')](function(_0xdfe00c){var _0x35cc6e=_['startCase'](_0xdfe00c[_0x455c('0x44')][_0x455c('0x45')]());if(_0x35cc6e==='User'){_0x1ae837=_[_0x455c('0x5a')](_0x1ae837,_0xdfe00c[_0x455c('0x5b')]);}else{if(_[_0x455c('0x43')](_0x35cc6e,_0x455c('0x5c')))_0x35cc6e=_0x35cc6e[_0x455c('0x5d')]('queue',_0x455c('0x5e'));_0xdfe00c[_0x455c('0x5b')]['forEach'](function(_0x3cd208){_0x2cc4b5[_0x455c('0x5f')](getAgents(_0x35cc6e,_0x3cd208));});}});return BPromise[_0x455c('0x60')](_0x2cc4b5)[_0x455c('0x29')](function(_0xe1f874){_0x1ae837=_[_0x455c('0x5a')](_0x1ae837,_[_0x455c('0x61')](_0xe1f874));_0x160783(_0x1ae837);})['catch'](function(_0x331075){_0x18f364(_0x331075);});});}function getAgents(_0x372071,_0x9c3192){return new BPromise(function(_0x5d6045,_0x220daa){return db[_0x372071][_0x455c('0x55')]({'where':{'id':_0x9c3192}})[_0x455c('0x29')](function(_0x1e15f3){return _0x1e15f3[_0x455c('0x62')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5065df){var _0x41569a=_[_0x455c('0x63')](_0x5065df,'id');_0x5d6045(_0x41569a);});})['catch'](function(_0x109b71){_0x220daa(_0x109b71);});});}
\ 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