Built motion from commit df3e9871f6bcc3432fec345b2f4facbd4dba8b5c. Version 3.0.0...
[motion-next.git] / server / api / cmHopper / cmHopper.controller.js
index 2096030..6cc0725 100644 (file)
@@ -1 +1 @@
-const a137_0x170b=['state','sort','offset','show','../../config/logger','findAll','includeAll','sequelize','lodash','intersection','isNumber','count','$and','model','include','phone','concat','UserId','body','Queue','destroy','deletedat','name','$ne','attributes','preview','entity\x20not\x20found','hopperIds','campaign','updatedAt','$notBetween','../../mysqldb','then','transaction','calleridnum','format','$in','user','UPDATE','VoiceQueue','options','ivr','ContactId','prev','filter','key','$any','deleted','$lt','undefined','membername','ASC','$lte','pick','$between','$overlap','index','priority','$notILike','merge','DESC','lastName','scheduledAt','VIRTUAL','like','filters','$contains','campaigntype','$like','$gte','LOCK','type','VoiceQueueId','CmContac','create','query','keys','$notIn','getVoiceQueues','api','getPreview','$or','CmContact','update','fields','map','moment','outbound','COALESCE(CmHopper.UserId,\x200)\x20DESC','firstName','status','length','order','dialActive','isNil','describe','Contact','List','CmHopperFinal','end','send','statedesc','Content-Range','findOne','nolimit','../../components/parsers/qs','stack','rawAttributes','dialOrderByScheduledAt','lte','direction','$not','dataValues','set','$eq','limit','CmHopper,\x20%s,\x20%s,\x20%s','error','getOpenContacts','sendStatus','catch','CampaignId','YYYY-MM-DD\x20HH:mm:ss','where','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledat','$contained','json','CmHopper','params'];(function(_0x55f815,_0x170b56){const _0x3f40b0=function(_0x2ffd01){while(--_0x2ffd01){_0x55f815['push'](_0x55f815['shift']());}};_0x3f40b0(++_0x170b56);}(a137_0x170b,0x141));const a137_0x3f40=function(_0x55f815,_0x170b56){_0x55f815=_0x55f815-0x0;let _0x3f40b0=a137_0x170b[_0x55f815];return _0x3f40b0;};const _0x55c2b2=a137_0x3f40;'use strict';const moment=require(_0x55c2b2('0x19')),_=require(_0x55c2b2('0x4d')),qs=require(_0x55c2b2('0x2c')),logger=require(_0x55c2b2('0x49'))(_0x55c2b2('0x12')),db=require(_0x55c2b2('0x64'))['db'],{Op,literal}=require(_0x55c2b2('0x4c'));function respondWithResult(_0x2ffd01,_0x237e99){return _0x237e99=_0x237e99||0xc8,function(_0x433ab6){const _0x121a93=a137_0x3f40;if(_0x433ab6)return _0x2ffd01[_0x121a93('0x1d')](_0x237e99)[_0x121a93('0x42')](_0x433ab6);};}function respondWithFilteredResult(_0x4e9386,_0x1fca60){return function(_0x49fb94){const _0x2057cc=a137_0x3f40;if(_0x49fb94){const _0x1aef3d=_0x49fb94[_0x2057cc('0x50')],_0x478e2d=_0x1fca60[_0x2057cc('0x47')];let _0x27b3bc=_0x1fca60[_0x2057cc('0x47')]+_0x1fca60['limit'],_0x1e03fc;return _0x27b3bc>=_0x1aef3d?(_0x27b3bc=_0x1aef3d,_0x1e03fc=0xc8):_0x1e03fc=0xce,_0x4e9386[_0x2057cc('0x1d')](_0x1e03fc),_0x4e9386[_0x2057cc('0x34')](_0x2057cc('0x29'),_0x478e2d+'-'+_0x27b3bc+'/'+_0x1aef3d)[_0x2057cc('0x42')](_0x49fb94);}return null;};}function saveUpdates(_0x6b59fa){return function(_0x4ba697){const _0x3629af=a137_0x3f40;if(_0x4ba697)return _0x4ba697['update'](_0x6b59fa)[_0x3629af('0x65')](function(_0x59ce1d){return _0x59ce1d;});return null;};}function handleEntityNotFound(_0x44844a){return function(_0x1e7903){const _0xcb2e18=a137_0x3f40;return!_0x1e7903&&_0x44844a[_0xcb2e18('0x3a')](0x194),_0x1e7903;};}function handleError(_0x2ab9c0,_0x4cefd6){return _0x4cefd6=_0x4cefd6||0x1f4,function(_0x4fa155){const _0x18de64=a137_0x3f40;logger[_0x18de64('0x38')](_0x4fa155[_0x18de64('0x2d')]),_0x4fa155[_0x18de64('0x5b')]&&delete _0x4fa155[_0x18de64('0x5b')],_0x2ab9c0[_0x18de64('0x1d')](_0x4cefd6)[_0x18de64('0x27')](_0x4fa155);};}exports[_0x55c2b2('0x7d')]=function(_0x21da10,_0x214075){const _0xffab5e=_0x55c2b2;let _0x4f78f0={};const _0x389baf={},_0x3854cb={'count':0x0,'rows':[]},_0x10d8c5=_[_0xffab5e('0x18')](db[_0xffab5e('0x43')][_0xffab5e('0x2e')],function(_0x4eec11){const _0x3b0ae0=_0xffab5e;return{'name':_0x4eec11['fieldName'],'type':_0x4eec11[_0x3b0ae0('0xa')][_0x3b0ae0('0x72')]};});_0x389baf['model']=_[_0xffab5e('0x18')](_0x10d8c5,'name'),_0x389baf[_0xffab5e('0xe')]=_[_0xffab5e('0xf')](_0x21da10[_0xffab5e('0xe')]),_0x389baf[_0xffab5e('0x4')]=_[_0xffab5e('0x4e')](_0x389baf['model'],_0x389baf[_0xffab5e('0xe')]),_0x389baf[_0xffab5e('0x4')]=_[_0xffab5e('0x55')](_0x389baf['filters'],[_0xffab5e('0x51'),_0xffab5e('0x14'),'$gt',_0xffab5e('0x8'),_0xffab5e('0x75'),_0xffab5e('0x79'),_0xffab5e('0x5c'),_0xffab5e('0x35'),_0xffab5e('0x32'),_0xffab5e('0x7b'),_0xffab5e('0x63'),_0xffab5e('0x69'),_0xffab5e('0x10'),_0xffab5e('0x7'),'$notLike','$iLike',_0xffab5e('0x7f'),_0xffab5e('0x7'),_0xffab5e('0x7c'),_0xffab5e('0x5'),_0xffab5e('0x41'),_0xffab5e('0x73')]),_0x4f78f0[_0xffab5e('0x5d')]=_[_0xffab5e('0x4e')](_0x389baf[_0xffab5e('0x52')],qs[_0xffab5e('0x17')](_0x21da10[_0xffab5e('0xe')][_0xffab5e('0x17')])),_0x4f78f0[_0xffab5e('0x5d')]=_0x4f78f0[_0xffab5e('0x5d')][_0xffab5e('0x1e')]?_0x4f78f0[_0xffab5e('0x5d')]:_0x389baf['model'];typeof _0x21da10['query'][_0xffab5e('0x2b')]===_0xffab5e('0x76')&&(_0x4f78f0['limit']=qs['limit'](_0x21da10[_0xffab5e('0xe')][_0xffab5e('0x36')]),_0x4f78f0['offset']=qs['offset'](_0x21da10[_0xffab5e('0xe')][_0xffab5e('0x47')]));_0x4f78f0[_0xffab5e('0x1f')]=qs[_0xffab5e('0x46')](_0x21da10[_0xffab5e('0xe')][_0xffab5e('0x46')]),_0x4f78f0[_0xffab5e('0x3e')]=qs['filters'](_[_0xffab5e('0x7a')](_0x21da10['query'],_0x389baf[_0xffab5e('0x4')]),_0x10d8c5);_0x21da10['query'][_0xffab5e('0x71')]&&(_0x4f78f0[_0xffab5e('0x3e')]=_['merge'](_0x4f78f0[_0xffab5e('0x3e')],{[Op['or']]:_[_0xffab5e('0x18')](_0x10d8c5,function(_0x238633){const _0x48923b=_0xffab5e;if(_0x238633[_0x48923b('0xa')]!==_0x48923b('0x2')){const _0x328cde={};return _0x328cde[_0x238633['name']]={[Op[_0x48923b('0x3')]]:'%'+_0x21da10[_0x48923b('0xe')][_0x48923b('0x71')]+'%'},_0x328cde;}})}));_0x4f78f0=_['merge']({},_0x4f78f0,_0x21da10[_0xffab5e('0x6d')]);const _0x521e4b={'where':_0x4f78f0[_0xffab5e('0x3e')]};return db[_0xffab5e('0x43')][_0xffab5e('0x50')](_0x521e4b)[_0xffab5e('0x65')](function(_0x4de403){const _0x3531a7=_0xffab5e;return _0x3854cb[_0x3531a7('0x50')]=_0x4de403,_0x21da10[_0x3531a7('0xe')][_0x3531a7('0x4b')]&&(_0x4f78f0[_0x3531a7('0x53')]=[{'all':!![]}]),db[_0x3531a7('0x43')][_0x3531a7('0x4a')](_0x4f78f0);})[_0xffab5e('0x65')](function(_0x4efbdc){return _0x3854cb['rows']=_0x4efbdc,_0x3854cb;})['then'](respondWithFilteredResult(_0x214075,_0x4f78f0))['catch'](handleError(_0x214075,null));},exports[_0x55c2b2('0x48')]=function(_0x3cbcd3,_0xc7278b){const _0xab1c7a=_0x55c2b2;let _0x1888a5={'raw':!![],'where':{'id':_0x3cbcd3[_0xab1c7a('0x44')]['id']}};const _0x3d5de7={};return _0x3d5de7[_0xab1c7a('0x52')]=_[_0xab1c7a('0xf')](db[_0xab1c7a('0x43')][_0xab1c7a('0x2e')]),_0x3d5de7['query']=_[_0xab1c7a('0xf')](_0x3cbcd3['query']),_0x3d5de7[_0xab1c7a('0x4')]=_[_0xab1c7a('0x4e')](_0x3d5de7[_0xab1c7a('0x52')],_0x3d5de7['query']),_0x1888a5[_0xab1c7a('0x5d')]=_['intersection'](_0x3d5de7[_0xab1c7a('0x52')],qs['fields'](_0x3cbcd3['query'][_0xab1c7a('0x17')])),_0x1888a5['attributes']=_0x1888a5[_0xab1c7a('0x5d')]['length']?_0x1888a5['attributes']:_0x3d5de7[_0xab1c7a('0x52')],_0x3cbcd3[_0xab1c7a('0xe')][_0xab1c7a('0x4b')]&&(_0x1888a5['include']=[{'all':!![]}]),_0x1888a5=_['merge']({},_0x1888a5,_0x3cbcd3[_0xab1c7a('0x6d')]),db[_0xab1c7a('0x43')][_0xab1c7a('0x2a')](_0x1888a5)[_0xab1c7a('0x65')](handleEntityNotFound(_0xc7278b,null))[_0xab1c7a('0x65')](respondWithResult(_0xc7278b,null))[_0xab1c7a('0x3b')](handleError(_0xc7278b,null));},exports[_0x55c2b2('0xd')]=function(_0x2166f4,_0xc8e34b){const _0x24db1b=_0x55c2b2;return db[_0x24db1b('0x43')][_0x24db1b('0xd')](_0x2166f4[_0x24db1b('0x57')],{})['then'](respondWithResult(_0xc8e34b,0xc9))['catch'](handleError(_0xc8e34b,null));},exports[_0x55c2b2('0x16')]=function(_0x524eb4,_0x3793a8){const _0x51d008=_0x55c2b2;return _0x524eb4[_0x51d008('0x57')]['id']&&delete _0x524eb4[_0x51d008('0x57')]['id'],db['CmHopper'][_0x51d008('0x2a')]({'where':{'id':_0x524eb4[_0x51d008('0x44')]['id']}})['then'](handleEntityNotFound(_0x3793a8,null))[_0x51d008('0x65')](saveUpdates(_0x524eb4[_0x51d008('0x57')],null))[_0x51d008('0x65')](respondWithResult(_0x3793a8,null))['catch'](handleError(_0x3793a8,null));},exports[_0x55c2b2('0x22')]=function(_0x5087a1,_0x4c4198){const _0x101be9=_0x55c2b2;return db[_0x101be9('0x43')]['describe']()[_0x101be9('0x65')](respondWithResult(_0x4c4198,null))['catch'](handleError(_0x4c4198,null));},exports[_0x55c2b2('0x59')]=function(_0x252aad,_0x518407){const _0x42eb50=_0x55c2b2;let _0x2f9e9f;return db[_0x42eb50('0x43')][_0x42eb50('0x2a')]({'where':{'id':_0x252aad[_0x42eb50('0x44')]['id']}})['then'](handleEntityNotFound(_0x518407,null))[_0x42eb50('0x65')](function(_0x190c1d){const _0x407a4a=_0x42eb50;if(_0x190c1d)return _0x190c1d['destroy']()[_0x407a4a('0x65')](function(_0x4bb548){return _0x4bb548;});})[_0x42eb50('0x65')](function(_0x49cbfb){const _0x2d8d0e=_0x42eb50;_0x2f9e9f=_0x49cbfb;if(_0x49cbfb){if(_0x49cbfb['VoiceQueueId']||_0x49cbfb[_0x2d8d0e('0x3c')])return db[_0x49cbfb[_0x2d8d0e('0xb')]?_0x2d8d0e('0x6c'):'Campaign'][_0x2d8d0e('0x2a')]({'where':{'id':_0x49cbfb['VoiceQueueId']?_0x49cbfb['VoiceQueueId']:_0x49cbfb[_0x2d8d0e('0x3c')]},'attributes':['id',_0x2d8d0e('0x5b')],'raw':!![]});}})[_0x42eb50('0x65')](function(_0x49af45){const _0x4471c2=_0x42eb50,_0x4a8ec4={};if(_0x49af45)return _[_0x4471c2('0x80')](_0x4a8ec4,_['omit'](_0x2f9e9f[_0x4471c2('0x33')],['createdAt',_0x4471c2('0x62'),'id'])),_0x4a8ec4[_0x4471c2('0x45')]=0x15,_0x4a8ec4[_0x4471c2('0x28')]=_0x4471c2('0x74'),_0x4a8ec4[_0x4471c2('0x61')]=_0x49af45['name'],_0x4a8ec4[_0x4471c2('0x77')]=_0x252aad['user']['name'],_0x4a8ec4[_0x4471c2('0x56')]=_0x252aad[_0x4471c2('0x6a')]['id'],_0x4a8ec4[_0x4471c2('0x74')]=!![],_0x4a8ec4[_0x4471c2('0x5a')]=moment()[_0x4471c2('0x68')](_0x4471c2('0x3d')),_0x4a8ec4[_0x4471c2('0x67')]=_0x2f9e9f[_0x4471c2('0x54')],_0x4a8ec4[_0x4471c2('0x6')]=_0x2f9e9f[_0x4471c2('0xb')]?'queue':_0x4471c2('0x6e'),db[_0x4471c2('0xc')][_0x4471c2('0x2a')]({'where':{'id':_0x4a8ec4[_0x4471c2('0x6f')]},'attributes':[_0x4471c2('0x1c'),'lastName']})[_0x4471c2('0x65')](function(_0x488d4e){const _0x4d972f=_0x4471c2;!_['isNil'](_0x518407)&&!_[_0x4d972f('0x21')](_0x488d4e['firstName'])&&(_0x4a8ec4['calleridname']=_0x488d4e[_0x4d972f('0x1c')],!_[_0x4d972f('0x21')](_0x488d4e[_0x4d972f('0x0')])&&(_0x4a8ec4['calleridname']+='\x20'+_0x488d4e[_0x4d972f('0x0')]));})['finally'](function(){const _0x349c09=_0x4471c2;return db[_0x349c09('0x25')][_0x349c09('0xd')](_0x4a8ec4);});})['then'](function(){const _0x1d5cec=_0x42eb50;return _0x518407[_0x1d5cec('0x1d')](0xcc)[_0x1d5cec('0x26')]();})[_0x42eb50('0x3b')](handleError(_0x518407,null));},exports[_0x55c2b2('0x13')]=function(_0x44fae8,_0xc7e69d){const _0x283d91=_0x55c2b2;let _0x5de55b=[];return db[_0x283d91('0x15')][_0x283d91('0x22')]()[_0x283d91('0x65')](function(_0x172bb3){const _0x1a6ad0=_0x283d91;return _0x5de55b=_[_0x1a6ad0('0xf')](_0x172bb3),_0x44fae8[_0x1a6ad0('0x6a')][_0x1a6ad0('0x11')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x1a6ad0('0x5e')},'attributes':['id',_0x1a6ad0('0x2f')],'raw':!![]});})[_0x283d91('0x65')](function(_0x49ed8d){const _0x41f9a5=_0x283d91;if(_0x49ed8d&&_0x49ed8d['length'])return db['sequelize'][_0x41f9a5('0x66')](function(_0xe80262){const _0x4b2721=_0x41f9a5,_0x363429={'active':![],'recallme':![],'scheduledAt':{[Op[_0x4b2721('0x30')]]:moment()[_0x4b2721('0x68')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{[Op['in']]:_[_0x4b2721('0x18')](_0x49ed8d,'id')},[Op['or']]:[{'UserId':null},{'UserId':_0x44fae8['user']['id']}]};let _0x4daa6a=[];return _0x44fae8[_0x4b2721('0x57')][_0x4b2721('0x31')]&&_0x44fae8['body'][_0x4b2721('0x31')]===_0x4b2721('0x70')?(!_['isEmpty'](_0x44fae8['body'][_0x4b2721('0x60')])&&(_0x363429['id']={'$in':_0x44fae8[_0x4b2721('0x57')][_0x4b2721('0x60')]}),_0x4daa6a=[[_0x4b2721('0x7e'),_0x4b2721('0x78')],[_0x4b2721('0x1'),_0x49ed8d[0x0]['dialOrderByScheduledAt']===_0x4b2721('0x78')?_0x4b2721('0x81'):'ASC'],literal(_0x4b2721('0x3f')),['id',_0x4b2721('0x81')]]):(!_['isEmpty'](_0x44fae8[_0x4b2721('0x57')][_0x4b2721('0x60')])&&(_0x363429['id']={'$notIn':_0x44fae8[_0x4b2721('0x57')][_0x4b2721('0x60')]}),_0x4daa6a=[[_0x4b2721('0x7e'),_0x4b2721('0x81')],[_0x4b2721('0x1'),_0x49ed8d[0x0]['dialOrderByScheduledAt']],literal(_0x4b2721('0x1b')),['id',_0x4b2721('0x78')]]),db[_0x4b2721('0x43')][_0x4b2721('0x2a')]({'attributes':['id',_0x4b2721('0x40')],'where':_0x363429,'order':_0x4daa6a,'transaction':_0xe80262,'lock':_0xe80262[_0x4b2721('0x9')][_0x4b2721('0x6b')],'include':[{'model':db[_0x4b2721('0x15')],'as':_0x4b2721('0x23'),'attributes':_0x5de55b,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x4b2721('0x5b')]}]},{'model':db['CmList'],'as':_0x4b2721('0x24'),'attributes':['id','name']},{'model':db[_0x4b2721('0x6c')],'as':_0x4b2721('0x58'),'attributes':['id',_0x4b2721('0x5b'),_0x4b2721('0x20')]}]})[_0x4b2721('0x65')](function(_0x1720ac){const _0x2c1c74=_0x4b2721;if(_0x1720ac)return _0x1720ac[_0x2c1c74('0x16')]({'UserId':_0x44fae8['user']['id']},{'transaction':_0xe80262});});});})[_0x283d91('0x65')](handleEntityNotFound(_0xc7e69d,null))['then'](respondWithResult(_0xc7e69d,null))['catch'](handleError(_0xc7e69d,null));},exports[_0x55c2b2('0x39')]=function(_0x261515,_0xf79d1a){const _0x4dfdd5=_0x55c2b2;return _0x261515[_0x4dfdd5('0x6a')][_0x4dfdd5('0x11')]({'where':{'type':_0x4dfdd5('0x1a'),'dialActive':!![],'dialMethod':_0x4dfdd5('0x5e')},'attributes':['id'],'raw':!![]})[_0x4dfdd5('0x65')](function(_0x539769){const _0x2639d3=_0x4dfdd5;if(_0x539769&&_0x539769[_0x2639d3('0x1e')])return db[_0x2639d3('0x43')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{[Op[_0x2639d3('0x30')]]:moment()[_0x2639d3('0x68')](_0x2639d3('0x3d'))},'VoiceQueueId':{[Op['in']]:_[_0x2639d3('0x18')](_0x539769,'id')},[Op['or']]:[{'UserId':null},{'UserId':_0x261515['user']['id']}]}});return 0x0;})[_0x4dfdd5('0x65')](function(_0x1b7655){const _0x46b249=_0x4dfdd5;if(!_[_0x46b249('0x21')](_0x1b7655)&&_[_0x46b249('0x4f')](_0x1b7655))return _0xf79d1a[_0x46b249('0x1d')](0xc8)['json']({'contacts':_0x1b7655});else logger['error'](_0x46b249('0x37'),_0x46b249('0x39'),0x194,_0x46b249('0x5f')),_0xf79d1a['sendStatus'](0x194);})[_0x4dfdd5('0x3b')](handleError(_0xf79d1a,null));};
\ No newline at end of file
+const a137_0xa004=['key','lodash','length','$in','show','membername','CampaignId','stack','params','keys','findOne','preview','campaign','options','VoiceQueueId','Content-Range','updatedAt','getVoiceQueues','sequelize','phone','prev','set','outbound','where','model','Company','isEmpty','create','createdAt','firstName','UserId','like','CmList','../../mysqldb','Queue','VIRTUAL','json','ContactId','DESC','undefined','../../config/logger','VoiceQueue','dialActive','attributes','priority','body','scheduledAt','$like','entity\x20not\x20found','lte','findAll','calleridname','query','rawAttributes','isNumber','$any','fieldName','CmContac','Contact','count','intersection','error','catch','hopperIds','offset','user','lastName','$ne','send','update','order','$lt','CmHopper','format','scheduledat','$lte','filters','direction','getOpenContacts','Campaign','statedesc','sort','destroy','includeAll','deletedat','dataValues','type','ASC','limit','nolimit','include','List','name','$gte','dialOrderByScheduledAt','UPDATE','LOCK','index','campaigntype','YYYY-MM-DD\x20HH:mm:ss','COALESCE(CmHopper.UserId,\x200)\x20DESC','sendStatus','queue','merge','isNil','deleted','then','describe','$notIn','filter','$gt','fields','status','concat','map','omit','moment','$iLike','$between','pick','CmCompany','$overlap','state','$not'];(function(_0x5de9b6,_0xa00473){const _0x41db84=function(_0x3613c6){while(--_0x3613c6){_0x5de9b6['push'](_0x5de9b6['shift']());}};_0x41db84(++_0xa00473);}(a137_0xa004,0x132));const a137_0x41db=function(_0x5de9b6,_0xa00473){_0x5de9b6=_0x5de9b6-0x0;let _0x41db84=a137_0xa004[_0x5de9b6];return _0x41db84;};const _0x558598=a137_0x41db;'use strict';const moment=require(_0x558598('0x3a')),_=require(_0x558598('0x43')),qs=require('../../components/parsers/qs'),logger=require(_0x558598('0x6a'))('api'),db=require(_0x558598('0x63'))['db'],{Op,literal}=require(_0x558598('0x54'));function respondWithResult(_0x3613c6,_0x43ea79){return _0x43ea79=_0x43ea79||0xc8,function(_0x53b460){const _0x51259f=a137_0x41db;if(_0x53b460)return _0x3613c6['status'](_0x43ea79)[_0x51259f('0x66')](_0x53b460);};}function respondWithFilteredResult(_0x16e551,_0x1edfe8){return function(_0x3c0313){const _0x1cbaef=a137_0x41db;if(_0x3c0313){const _0xbbf800=_0x3c0313[_0x1cbaef('0x1')],_0x50ec40=_0x1edfe8[_0x1cbaef('0x6')];let _0x537ae1=_0x1edfe8['offset']+_0x1edfe8[_0x1cbaef('0x1e')],_0x1a61d4;return _0x537ae1>=_0xbbf800?(_0x537ae1=_0xbbf800,_0x1a61d4=0xc8):_0x1a61d4=0xce,_0x16e551['status'](_0x1a61d4),_0x16e551[_0x1cbaef('0x57')](_0x1cbaef('0x51'),_0x50ec40+'-'+_0x537ae1+'/'+_0xbbf800)[_0x1cbaef('0x66')](_0x3c0313);}return null;};}function saveUpdates(_0x114cb7){return function(_0x3505a3){const _0x37c7a4=a137_0x41db;if(_0x3505a3)return _0x3505a3['update'](_0x114cb7)[_0x37c7a4('0x30')](function(_0x34d1bf){return _0x34d1bf;});return null;};}function handleEntityNotFound(_0x34bd23){return function(_0x2381d0){const _0xe42733=a137_0x41db;return!_0x2381d0&&_0x34bd23[_0xe42733('0x2b')](0x194),_0x2381d0;};}function handleError(_0x12f926,_0x321c98){return _0x321c98=_0x321c98||0x1f4,function(_0x4f4400){const _0x491a49=a137_0x41db;logger[_0x491a49('0x3')](_0x4f4400[_0x491a49('0x49')]),_0x4f4400[_0x491a49('0x22')]&&delete _0x4f4400[_0x491a49('0x22')],_0x12f926[_0x491a49('0x36')](_0x321c98)[_0x491a49('0xa')](_0x4f4400);};}exports[_0x558598('0x27')]=function(_0x2c4883,_0x4de294){const _0x11efb9=_0x558598;let _0x4a351c={};const _0x45fc53={},_0x22c2e0={'count':0x0,'rows':[]},_0x334926=_[_0x11efb9('0x38')](db['CmHopper'][_0x11efb9('0x77')],function(_0x3e394f){const _0x2b6237=_0x11efb9;return{'name':_0x3e394f[_0x2b6237('0x7a')],'type':_0x3e394f[_0x2b6237('0x1c')][_0x2b6237('0x42')]};});_0x45fc53[_0x11efb9('0x5a')]=_[_0x11efb9('0x38')](_0x334926,_0x11efb9('0x22')),_0x45fc53[_0x11efb9('0x76')]=_[_0x11efb9('0x4b')](_0x2c4883['query']),_0x45fc53['filters']=_[_0x11efb9('0x2')](_0x45fc53[_0x11efb9('0x5a')],_0x45fc53[_0x11efb9('0x76')]),_0x45fc53['filters']=_[_0x11efb9('0x37')](_0x45fc53[_0x11efb9('0x12')],['$and','$or',_0x11efb9('0x34'),_0x11efb9('0x23'),_0x11efb9('0xd'),_0x11efb9('0x11'),_0x11efb9('0x9'),'$eq',_0x11efb9('0x41'),_0x11efb9('0x3c'),'$notBetween',_0x11efb9('0x45'),_0x11efb9('0x32'),'$like','$notLike',_0x11efb9('0x3b'),'$notILike',_0x11efb9('0x71'),_0x11efb9('0x3f'),'$contains','$contained',_0x11efb9('0x79')]),_0x4a351c[_0x11efb9('0x6d')]=_[_0x11efb9('0x2')](_0x45fc53[_0x11efb9('0x5a')],qs['fields'](_0x2c4883['query'][_0x11efb9('0x35')])),_0x4a351c[_0x11efb9('0x6d')]=_0x4a351c[_0x11efb9('0x6d')][_0x11efb9('0x44')]?_0x4a351c[_0x11efb9('0x6d')]:_0x45fc53['model'];typeof _0x2c4883[_0x11efb9('0x76')][_0x11efb9('0x1f')]===_0x11efb9('0x69')&&(_0x4a351c[_0x11efb9('0x1e')]=qs[_0x11efb9('0x1e')](_0x2c4883[_0x11efb9('0x76')][_0x11efb9('0x1e')]),_0x4a351c[_0x11efb9('0x6')]=qs[_0x11efb9('0x6')](_0x2c4883[_0x11efb9('0x76')][_0x11efb9('0x6')]));_0x4a351c[_0x11efb9('0xc')]=qs[_0x11efb9('0x17')](_0x2c4883[_0x11efb9('0x76')][_0x11efb9('0x17')]),_0x4a351c[_0x11efb9('0x59')]=qs[_0x11efb9('0x12')](_[_0x11efb9('0x3d')](_0x2c4883[_0x11efb9('0x76')],_0x45fc53[_0x11efb9('0x12')]),_0x334926);_0x2c4883[_0x11efb9('0x76')][_0x11efb9('0x33')]&&(_0x4a351c[_0x11efb9('0x59')]=_[_0x11efb9('0x2d')](_0x4a351c[_0x11efb9('0x59')],{[Op['or']]:_[_0x11efb9('0x38')](_0x334926,function(_0x3524b4){const _0x59e46a=_0x11efb9;if(_0x3524b4['type']!==_0x59e46a('0x65')){const _0x38a4ca={};return _0x38a4ca[_0x3524b4[_0x59e46a('0x22')]]={[Op[_0x59e46a('0x61')]]:'%'+_0x2c4883[_0x59e46a('0x76')][_0x59e46a('0x33')]+'%'},_0x38a4ca;}})}));_0x4a351c=_['merge']({},_0x4a351c,_0x2c4883[_0x11efb9('0x4f')]);const _0x5a331e={'where':_0x4a351c[_0x11efb9('0x59')]};return db[_0x11efb9('0xe')]['count'](_0x5a331e)['then'](function(_0x5edee0){const _0x58058c=_0x11efb9;return _0x22c2e0['count']=_0x5edee0,_0x2c4883[_0x58058c('0x76')][_0x58058c('0x19')]&&(_0x4a351c[_0x58058c('0x20')]=[{'all':!![]}]),db[_0x58058c('0xe')][_0x58058c('0x74')](_0x4a351c);})[_0x11efb9('0x30')](function(_0x2a5281){return _0x22c2e0['rows']=_0x2a5281,_0x22c2e0;})[_0x11efb9('0x30')](respondWithFilteredResult(_0x4de294,_0x4a351c))[_0x11efb9('0x4')](handleError(_0x4de294,null));},exports[_0x558598('0x46')]=function(_0xa51e9f,_0x33b8a4){const _0x18524f=_0x558598;let _0x4e1512={'raw':!![],'where':{'id':_0xa51e9f[_0x18524f('0x4a')]['id']}};const _0x521904={};return _0x521904['model']=_[_0x18524f('0x4b')](db[_0x18524f('0xe')][_0x18524f('0x77')]),_0x521904[_0x18524f('0x76')]=_[_0x18524f('0x4b')](_0xa51e9f[_0x18524f('0x76')]),_0x521904['filters']=_[_0x18524f('0x2')](_0x521904[_0x18524f('0x5a')],_0x521904[_0x18524f('0x76')]),_0x4e1512['attributes']=_[_0x18524f('0x2')](_0x521904[_0x18524f('0x5a')],qs[_0x18524f('0x35')](_0xa51e9f[_0x18524f('0x76')][_0x18524f('0x35')])),_0x4e1512[_0x18524f('0x6d')]=_0x4e1512['attributes'][_0x18524f('0x44')]?_0x4e1512['attributes']:_0x521904[_0x18524f('0x5a')],_0xa51e9f[_0x18524f('0x76')][_0x18524f('0x19')]&&(_0x4e1512['include']=[{'all':!![]}]),_0x4e1512=_[_0x18524f('0x2d')]({},_0x4e1512,_0xa51e9f[_0x18524f('0x4f')]),db[_0x18524f('0xe')][_0x18524f('0x4c')](_0x4e1512)['then'](handleEntityNotFound(_0x33b8a4,null))['then'](respondWithResult(_0x33b8a4,null))[_0x18524f('0x4')](handleError(_0x33b8a4,null));},exports[_0x558598('0x5d')]=function(_0x32b022,_0x3b2650){const _0x11935b=_0x558598;return db[_0x11935b('0xe')][_0x11935b('0x5d')](_0x32b022[_0x11935b('0x6f')],{})['then'](respondWithResult(_0x3b2650,0xc9))['catch'](handleError(_0x3b2650,null));},exports[_0x558598('0xb')]=function(_0x4e2308,_0x4678e3){const _0x21f4a7=_0x558598;return _0x4e2308[_0x21f4a7('0x6f')]['id']&&delete _0x4e2308[_0x21f4a7('0x6f')]['id'],db[_0x21f4a7('0xe')][_0x21f4a7('0x4c')]({'where':{'id':_0x4e2308['params']['id']}})[_0x21f4a7('0x30')](handleEntityNotFound(_0x4678e3,null))['then'](saveUpdates(_0x4e2308[_0x21f4a7('0x6f')],null))[_0x21f4a7('0x30')](respondWithResult(_0x4678e3,null))['catch'](handleError(_0x4678e3,null));},exports[_0x558598('0x31')]=function(_0x578890,_0x186d75){const _0x33497e=_0x558598;return db[_0x33497e('0xe')][_0x33497e('0x31')]()[_0x33497e('0x30')](respondWithResult(_0x186d75,null))[_0x33497e('0x4')](handleError(_0x186d75,null));},exports[_0x558598('0x18')]=function(_0x155f0a,_0x322acc){const _0x31372b=_0x558598;let _0x346841;return db[_0x31372b('0xe')]['findOne']({'where':{'id':_0x155f0a['params']['id']}})[_0x31372b('0x30')](handleEntityNotFound(_0x322acc,null))['then'](function(_0xff90e2){if(_0xff90e2)return _0xff90e2['destroy']()['then'](function(_0x5904ad){return _0x5904ad;});})[_0x31372b('0x30')](function(_0x408ead){const _0x4682a9=_0x31372b;_0x346841=_0x408ead;if(_0x408ead){if(_0x408ead[_0x4682a9('0x50')]||_0x408ead[_0x4682a9('0x48')])return db[_0x408ead['VoiceQueueId']?'VoiceQueue':_0x4682a9('0x15')][_0x4682a9('0x4c')]({'where':{'id':_0x408ead[_0x4682a9('0x50')]?_0x408ead[_0x4682a9('0x50')]:_0x408ead['CampaignId']},'attributes':['id',_0x4682a9('0x22')],'raw':!![]});}})[_0x31372b('0x30')](function(_0x3b8925){const _0x4a8527=_0x31372b,_0x3abd40={};if(_0x3b8925)return _[_0x4a8527('0x2d')](_0x3abd40,_[_0x4a8527('0x39')](_0x346841[_0x4a8527('0x1b')],[_0x4a8527('0x5e'),_0x4a8527('0x52'),'id'])),_0x3abd40[_0x4a8527('0x40')]=0x15,_0x3abd40[_0x4a8527('0x16')]=_0x4a8527('0x2f'),_0x3abd40[_0x4a8527('0x4e')]=_0x3b8925[_0x4a8527('0x22')],_0x3abd40[_0x4a8527('0x47')]=_0x155f0a[_0x4a8527('0x7')]['name'],_0x3abd40[_0x4a8527('0x60')]=_0x155f0a[_0x4a8527('0x7')]['id'],_0x3abd40[_0x4a8527('0x2f')]=!![],_0x3abd40[_0x4a8527('0x1a')]=moment()[_0x4a8527('0xf')](_0x4a8527('0x29')),_0x3abd40['calleridnum']=_0x346841[_0x4a8527('0x55')],_0x3abd40[_0x4a8527('0x28')]=_0x346841[_0x4a8527('0x50')]?_0x4a8527('0x2c'):'ivr',db[_0x4a8527('0x7b')][_0x4a8527('0x4c')]({'where':{'id':_0x3abd40[_0x4a8527('0x67')]},'attributes':[_0x4a8527('0x5f'),'lastName']})[_0x4a8527('0x30')](function(_0x1a612f){const _0x1917c8=_0x4a8527;!_[_0x1917c8('0x2e')](_0x322acc)&&!_[_0x1917c8('0x2e')](_0x1a612f[_0x1917c8('0x5f')])&&(_0x3abd40[_0x1917c8('0x75')]=_0x1a612f['firstName'],!_[_0x1917c8('0x2e')](_0x1a612f[_0x1917c8('0x8')])&&(_0x3abd40[_0x1917c8('0x75')]+='\x20'+_0x1a612f[_0x1917c8('0x8')]));})['finally'](function(){const _0x357db1=_0x4a8527;return db['CmHopperFinal'][_0x357db1('0x5d')](_0x3abd40);});})[_0x31372b('0x30')](function(){const _0x537265=_0x31372b;return _0x322acc[_0x537265('0x36')](0xcc)['end']();})['catch'](handleError(_0x322acc,null));},exports['getPreview']=function(_0x14c59c,_0x584003){const _0x538c9f=_0x558598;let _0x2ef136=[];return db['CmContact'][_0x538c9f('0x31')]()[_0x538c9f('0x30')](function(_0x1e7e51){const _0x3a7c7d=_0x538c9f;return _0x2ef136=_[_0x3a7c7d('0x4b')](_0x1e7e51),_0x14c59c[_0x3a7c7d('0x7')][_0x3a7c7d('0x53')]({'where':{'type':_0x3a7c7d('0x58'),'dialActive':!![],'dialMethod':_0x3a7c7d('0x4d')},'attributes':['id',_0x3a7c7d('0x24')],'raw':!![]});})[_0x538c9f('0x30')](function(_0x269e4a){const _0x371905=_0x538c9f;if(_0x269e4a&&_0x269e4a['length'])return db[_0x371905('0x54')]['transaction'](function(_0x58551f){const _0x179400=_0x371905,_0x6952be={'active':![],'recallme':![],'scheduledAt':{[Op[_0x179400('0x73')]]:moment()['format'](_0x179400('0x29'))},'VoiceQueueId':{[Op['in']]:_[_0x179400('0x38')](_0x269e4a,'id')},[Op['or']]:[{'UserId':null},{'UserId':_0x14c59c['user']['id']}]};let _0x323335=[];return _0x14c59c[_0x179400('0x6f')][_0x179400('0x13')]&&_0x14c59c[_0x179400('0x6f')][_0x179400('0x13')]===_0x179400('0x56')?(!_[_0x179400('0x5c')](_0x14c59c[_0x179400('0x6f')][_0x179400('0x5')])&&(_0x6952be['id']={'$in':_0x14c59c[_0x179400('0x6f')][_0x179400('0x5')]}),_0x323335=[[_0x179400('0x6e'),_0x179400('0x1d')],[_0x179400('0x70'),_0x269e4a[0x0]['dialOrderByScheduledAt']===_0x179400('0x1d')?_0x179400('0x68'):_0x179400('0x1d')],literal('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x179400('0x68')]]):(!_[_0x179400('0x5c')](_0x14c59c['body'][_0x179400('0x5')])&&(_0x6952be['id']={'$notIn':_0x14c59c['body'][_0x179400('0x5')]}),_0x323335=[['priority',_0x179400('0x68')],[_0x179400('0x70'),_0x269e4a[0x0][_0x179400('0x24')]],literal(_0x179400('0x2a')),['id',_0x179400('0x1d')]]),db[_0x179400('0xe')][_0x179400('0x4c')]({'attributes':['id',_0x179400('0x10')],'where':_0x6952be,'order':_0x323335,'transaction':_0x58551f,'lock':_0x58551f[_0x179400('0x26')][_0x179400('0x25')],'include':[{'model':db['CmContact'],'as':_0x179400('0x0'),'attributes':_0x2ef136,'include':[{'model':db[_0x179400('0x3e')],'as':_0x179400('0x5b'),'attributes':['id','name']}]},{'model':db[_0x179400('0x62')],'as':_0x179400('0x21'),'attributes':['id',_0x179400('0x22')]},{'model':db[_0x179400('0x6b')],'as':_0x179400('0x64'),'attributes':['id',_0x179400('0x22'),_0x179400('0x6c')]}]})[_0x179400('0x30')](function(_0x4d3130){const _0x4acef8=_0x179400;if(_0x4d3130)return _0x4d3130['update']({'UserId':_0x14c59c[_0x4acef8('0x7')]['id']},{'transaction':_0x58551f});});});})[_0x538c9f('0x30')](handleEntityNotFound(_0x584003,null))['then'](respondWithResult(_0x584003,null))['catch'](handleError(_0x584003,null));},exports['getOpenContacts']=function(_0x3cc817,_0x2af2d7){const _0x39c4b6=_0x558598;return _0x3cc817[_0x39c4b6('0x7')]['getVoiceQueues']({'where':{'type':_0x39c4b6('0x58'),'dialActive':!![],'dialMethod':_0x39c4b6('0x4d')},'attributes':['id'],'raw':!![]})[_0x39c4b6('0x30')](function(_0x51338f){const _0x484a80=_0x39c4b6;if(_0x51338f&&_0x51338f[_0x484a80('0x44')])return db[_0x484a80('0xe')][_0x484a80('0x1')]({'where':{'active':![],'recallme':![],'scheduledAt':{[Op[_0x484a80('0x73')]]:moment()[_0x484a80('0xf')](_0x484a80('0x29'))},'VoiceQueueId':{[Op['in']]:_['map'](_0x51338f,'id')},[Op['or']]:[{'UserId':null},{'UserId':_0x3cc817[_0x484a80('0x7')]['id']}]}});return 0x0;})['then'](function(_0x5388ce){const _0x5c8a08=_0x39c4b6;if(!_[_0x5c8a08('0x2e')](_0x5388ce)&&_[_0x5c8a08('0x78')](_0x5388ce))return _0x2af2d7['status'](0xc8)['json']({'contacts':_0x5388ce});else logger[_0x5c8a08('0x3')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x5c8a08('0x14'),0x194,_0x5c8a08('0x72')),_0x2af2d7[_0x5c8a08('0x2b')](0x194);})[_0x39c4b6('0x4')](handleError(_0x2af2d7,null));};
\ No newline at end of file