Built motion from commit f738f9592c388b9f9eb3948f400a5c9d717a3561. Version 3.0.0...
[motion-next.git] / server / api / smsQueue / smsQueue.controller.js
index e608eee..b41a48d 100644 (file)
@@ -1 +1 @@
-const a679_0x469d=['addAgents','findOne','user_has_teams','voicePause','omit','toString','include','status','userSmsQueue:save','show','error','./smsQueue.socket','length','count','get','UserSmsQueue','undefined','keys','query','createdAt','value','getTeams','user','emit','type','userSmsQueue:remove','filter','fieldName','options','then','Unable\x20to\x20retrieve\x20the\x20current\x20user','create','transaction','key','filters','includes','sort','set','findOrCreate','rows','order','sequelize','isArray','end','smsPause','name','SmsQueue','body','describe','join','where','interface','isEmpty','../../config/logger','User','api','TeamId','rawAttributes','catch','util','getAgents','team_has_sms_queues','Team','findAll','destroy','stack','json','userProfileId','addTeams','findAndCountAll','Agents','removeAgents','offset','../../rediscache','send','../../mysqldb','UserProfileSection','intersection','limit','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','includeAll','SIP','nolimit','compact','lodash','pick','format','%s/%s','all','forEach','SmsQueueId\x20=\x20?','updatedAt','squel','params','getMembers','VIRTUAL','sendStatus','SELECT','SmsQueueId','removeTeams','register','tq.TeamId','fields','map','role','like','ids','UserProfileResource','model','merge','attributes'];(function(_0x5867d3,_0x343ea7){const _0x469d76=function(_0x1e3b07){while(--_0x1e3b07){_0x5867d3['push'](_0x5867d3['shift']());}};_0x469d76(++_0x343ea7);}(a679_0x469d,0x81));const a679_0x1e3b=function(_0x5867d3,_0x343ea7){_0x5867d3=_0x5867d3-0x97;let _0x469d76=a679_0x469d[_0x5867d3];return _0x469d76;};const a679_0x2c66d7=a679_0x1e3b;'use strict';const util=require(a679_0x2c66d7(0xc0)),_=require(a679_0x2c66d7(0xd9)),squel=require(a679_0x2c66d7(0xe1)),qs=require('../../components/parsers/qs'),logger=require(a679_0x2c66d7(0xba))(a679_0x2c66d7(0xbc)),{getSocket}=require(a679_0x2c66d7(0xce)),socket=getSocket(),{db}=require(a679_0x2c66d7(0xd0)),{Op,QueryTypes}=require(a679_0x2c66d7(0xae));require(a679_0x2c66d7(0xff))[a679_0x2c66d7(0xe9)](socket);function respondWithStatusCode(_0x350b61,_0x295d53){return _0x295d53=_0x295d53||0xcc,function(_0x50e5ef){const _0x2dd047=a679_0x1e3b;if(_0x50e5ef)return _0x350b61['sendStatus'](_0x295d53);return _0x350b61[_0x2dd047(0xfb)](_0x295d53)[_0x2dd047(0xb0)]();};}function respondWithResult(_0x166bf6,_0x162f5e){return _0x162f5e=_0x162f5e||0xc8,function(_0x41fd2f){const _0x484dfb=a679_0x1e3b;if(_0x41fd2f)return _0x166bf6[_0x484dfb(0xfb)](_0x162f5e)[_0x484dfb(0xc7)](_0x41fd2f);};}function respondWithFilteredResult(_0x3312cf,_0x273c92){return function(_0x554083){const _0xe7861a=a679_0x1e3b;if(_0x554083){const _0x50c9c5=_0x554083[_0xe7861a(0x101)],_0x212d6f=_0x273c92[_0xe7861a(0xcd)];let _0x58ce06=_0x273c92[_0xe7861a(0xcd)]+_0x273c92['limit'],_0x372724;return _0x58ce06>=_0x50c9c5?(_0x58ce06=_0x50c9c5,_0x372724=0xc8):_0x372724=0xce,_0x3312cf[_0xe7861a(0xfb)](_0x372724),_0x3312cf[_0xe7861a(0xaa)]('Content-Range',_0x212d6f+'-'+_0x58ce06+'/'+_0x50c9c5)[_0xe7861a(0xc7)](_0x554083);}return null;};}function saveUpdates(_0x163940){return function(_0x327a7d){const _0x19eb22=a679_0x1e3b;if(_0x327a7d)return _0x327a7d['update'](_0x163940)[_0x19eb22(0xa2)](function(_0x48449e){return _0x48449e;});return null;};}function removeEntity(_0x3555f){return function(_0x2d22b5){const _0xe9b916=a679_0x1e3b;if(_0x2d22b5)return _0x2d22b5[_0xe9b916(0xc5)]()[_0xe9b916(0xa2)](function(){const _0x265c58=_0xe9b916,_0x3841f6=_0x2d22b5[_0x265c58(0x102)]({'plain':!![]}),_0x5051c2='SmsQueues';return db[_0x265c58(0xf0)][_0x265c58(0xc5)]({'where':{'type':_0x5051c2,'resourceId':_0x3841f6['id']}})[_0x265c58(0xa2)](function(){return _0x2d22b5;});})['then'](function(){const _0x302125=_0xe9b916;_0x3555f[_0x302125(0xfb)](0xcc)['end']();});};}function handleEntityNotFound(_0x40b377){return function(_0x141995){const _0x30c49c=a679_0x1e3b;return!_0x141995&&_0x40b377[_0x30c49c(0xe5)](0x194),_0x141995;};}function handleError(_0x1bcead,_0x3ea9df){return _0x3ea9df=_0x3ea9df||0x1f4,function(_0x1eff9d){const _0x215a29=a679_0x1e3b;logger[_0x215a29(0xfe)](_0x1eff9d[_0x215a29(0xc6)]),_0x1eff9d[_0x215a29(0xb2)]&&delete _0x1eff9d[_0x215a29(0xb2)],_0x1bcead[_0x215a29(0xfb)](_0x3ea9df)[_0x215a29(0xcf)](_0x1eff9d);};}exports['index']=function(_0x62bca9,_0x1491b7){const _0x3db4e0=a679_0x2c66d7;let _0x7949={};const _0x42cd7b={},_0x1c4ee1={'count':0x0,'rows':[]},_0x31dba4=_[_0x3db4e0(0xec)](db['SmsQueue'][_0x3db4e0(0xbe)],function(_0x33031f){const _0x3699e4=_0x3db4e0;return{'name':_0x33031f[_0x3699e4(0xa0)],'type':_0x33031f['type'][_0x3699e4(0xa6)]};});_0x42cd7b[_0x3db4e0(0xf1)]=_[_0x3db4e0(0xec)](_0x31dba4,_0x3db4e0(0xb2)),_0x42cd7b[_0x3db4e0(0x97)]=_[_0x3db4e0(0x105)](_0x62bca9['query']),_0x42cd7b[_0x3db4e0(0xa7)]=_['intersection'](_0x42cd7b[_0x3db4e0(0xf1)],_0x42cd7b[_0x3db4e0(0x97)]),_0x7949['attributes']=_[_0x3db4e0(0xd2)](_0x42cd7b['model'],qs[_0x3db4e0(0xeb)](_0x62bca9['query']['fields'])),_0x7949[_0x3db4e0(0xf3)]=_0x7949[_0x3db4e0(0xf3)][_0x3db4e0(0x100)]?_0x7949[_0x3db4e0(0xf3)]:_0x42cd7b[_0x3db4e0(0xf1)];typeof _0x62bca9[_0x3db4e0(0x97)][_0x3db4e0(0xd7)]===_0x3db4e0(0x104)&&(_0x7949[_0x3db4e0(0xd3)]=qs[_0x3db4e0(0xd3)](_0x62bca9[_0x3db4e0(0x97)]['limit']),_0x7949[_0x3db4e0(0xcd)]=qs[_0x3db4e0(0xcd)](_0x62bca9[_0x3db4e0(0x97)]['offset']));_0x7949[_0x3db4e0(0xad)]=qs[_0x3db4e0(0xa9)](_0x62bca9[_0x3db4e0(0x97)][_0x3db4e0(0xa9)]),_0x7949[_0x3db4e0(0xb7)]=qs['filters'](_[_0x3db4e0(0xda)](_0x62bca9[_0x3db4e0(0x97)],_0x42cd7b[_0x3db4e0(0xa7)]),_0x31dba4);_0x62bca9['query']['filter']&&(_0x7949[_0x3db4e0(0xb7)]=_[_0x3db4e0(0xf2)](_0x7949[_0x3db4e0(0xb7)],{[Op['or']]:_[_0x3db4e0(0xec)](_0x31dba4,function(_0x4a29b3){const _0x2f53fe=_0x3db4e0;if(_0x4a29b3[_0x2f53fe(0x9d)]!==_0x2f53fe(0xe4)){const _0x4e43d7={};return _0x4e43d7[_0x4a29b3[_0x2f53fe(0xb2)]]={[Op[_0x2f53fe(0xee)]]:'%'+_0x62bca9[_0x2f53fe(0x97)][_0x2f53fe(0x9f)]+'%'},_0x4e43d7;}})}));_0x7949=_[_0x3db4e0(0xf2)]({},_0x7949,_0x62bca9[_0x3db4e0(0xa1)]);const _0x287299={'where':_0x7949['where']};return db[_0x3db4e0(0xb3)][_0x3db4e0(0x101)](_0x287299)[_0x3db4e0(0xa2)](function(_0x368059){const _0x283a78=_0x3db4e0;return _0x1c4ee1[_0x283a78(0x101)]=_0x368059,_0x62bca9['query'][_0x283a78(0xd5)]&&(_0x7949['include']=[{'all':!![]}]),db[_0x283a78(0xb3)][_0x283a78(0xc4)](_0x7949);})[_0x3db4e0(0xa2)](function(_0x583f7f){const _0x3d36ca=_0x3db4e0;return _0x1c4ee1[_0x3d36ca(0xac)]=_0x583f7f,_0x1c4ee1;})[_0x3db4e0(0xa2)](respondWithFilteredResult(_0x1491b7,_0x7949))[_0x3db4e0(0xbf)](handleError(_0x1491b7,null));},exports[a679_0x2c66d7(0xfd)]=function(_0x56717d,_0x185e2f){const _0x19db11=a679_0x2c66d7;let _0xf102b5={'raw':!![],'where':{'id':_0x56717d[_0x19db11(0xe2)]['id']}};const _0x578fb4={};return _0x578fb4[_0x19db11(0xf1)]=_['keys'](db['SmsQueue'][_0x19db11(0xbe)]),_0x578fb4['query']=_[_0x19db11(0x105)](_0x56717d['query']),_0x578fb4[_0x19db11(0xa7)]=_['intersection'](_0x578fb4['model'],_0x578fb4[_0x19db11(0x97)]),_0xf102b5['attributes']=_['intersection'](_0x578fb4[_0x19db11(0xf1)],qs['fields'](_0x56717d[_0x19db11(0x97)][_0x19db11(0xeb)])),_0xf102b5[_0x19db11(0xf3)]=_0xf102b5[_0x19db11(0xf3)][_0x19db11(0x100)]?_0xf102b5[_0x19db11(0xf3)]:_0x578fb4[_0x19db11(0xf1)],_0x56717d[_0x19db11(0x97)][_0x19db11(0xd5)]&&(_0xf102b5[_0x19db11(0xfa)]=[{'all':!![]}]),_0xf102b5=_[_0x19db11(0xf2)]({},_0xf102b5,_0x56717d[_0x19db11(0xa1)]),db[_0x19db11(0xb3)]['findOne'](_0xf102b5)[_0x19db11(0xa2)](handleEntityNotFound(_0x185e2f,null))[_0x19db11(0xa2)](respondWithResult(_0x185e2f,null))[_0x19db11(0xbf)](handleError(_0x185e2f,null));},exports[a679_0x2c66d7(0xa4)]=function(_0x522a67,_0x30f90d){const _0x43583a=a679_0x2c66d7;return db[_0x43583a(0xb3)][_0x43583a(0xa4)](_0x522a67[_0x43583a(0xb4)],{})[_0x43583a(0xa2)](function(_0x391a71){const _0x17c83f=_0x43583a,_0xd6d8c9=_0x522a67[_0x17c83f(0x9b)]['get']({'plain':!![]});if(!_0xd6d8c9)throw new Error(_0x17c83f(0xa3));if(_0xd6d8c9[_0x17c83f(0xed)]==='user'){const _0x166e7d=_0x391a71[_0x17c83f(0x102)]({'plain':!![]}),_0x1d5bf4='SmsQueues';return db[_0x17c83f(0xd1)][_0x17c83f(0xf5)]({'where':{'name':_0x1d5bf4,'userProfileId':_0xd6d8c9[_0x17c83f(0xc8)]},'raw':!![]})['then'](function(_0x46190f){const _0x52e63a=_0x17c83f;return _0x46190f&&_0x46190f['autoAssociation']===0x0?db[_0x52e63a(0xf0)]['create']({'name':_0x166e7d[_0x52e63a(0xb2)],'resourceId':_0x166e7d['id'],'type':_0x46190f['name'],'sectionId':_0x46190f['id']},{})[_0x52e63a(0xa2)](function(){return _0x391a71;}):_0x391a71;})[_0x17c83f(0xbf)](function(_0x31ccba){const _0x4c6fc0=_0x17c83f;logger['error'](_0x4c6fc0(0xd4),_0x31ccba);throw _0x31ccba;});}return _0x391a71;})[_0x43583a(0xa2)](respondWithResult(_0x30f90d,0xc9))[_0x43583a(0xbf)](handleError(_0x30f90d,null));},exports['update']=function(_0x5c7a90,_0x5883af){const _0x2a23d3=a679_0x2c66d7;return _0x5c7a90[_0x2a23d3(0xb4)]['id']&&delete _0x5c7a90[_0x2a23d3(0xb4)]['id'],db[_0x2a23d3(0xb3)][_0x2a23d3(0xf5)]({'where':{'id':_0x5c7a90[_0x2a23d3(0xe2)]['id']}})[_0x2a23d3(0xa2)](handleEntityNotFound(_0x5883af,null))['then'](saveUpdates(_0x5c7a90[_0x2a23d3(0xb4)],null))['then'](respondWithResult(_0x5883af,null))[_0x2a23d3(0xbf)](handleError(_0x5883af,null));},exports[a679_0x2c66d7(0xc5)]=function(_0x4fbbb2,_0x15f204){const _0x3227f1=a679_0x2c66d7;return db[_0x3227f1(0xb3)][_0x3227f1(0xf5)]({'where':{'id':_0x4fbbb2['params']['id']}})[_0x3227f1(0xa2)](handleEntityNotFound(_0x15f204,null))['then'](removeEntity(_0x15f204,null))[_0x3227f1(0xbf)](handleError(_0x15f204,null));},exports[a679_0x2c66d7(0xb5)]=function(_0x172f4d,_0x2413ab){const _0x5c5c7f=a679_0x2c66d7;return db[_0x5c5c7f(0xb3)][_0x5c5c7f(0xb5)]()['then'](respondWithResult(_0x2413ab,null))[_0x5c5c7f(0xbf)](handleError(_0x2413ab,null));},exports[a679_0x2c66d7(0xe3)]=function(_0x59b758,_0x15c3c9){const _0x5ca248=a679_0x2c66d7;let _0x301390={'raw':!![],'where':{}};const _0x5aa68e={};let _0x4e0682;return db[_0x5ca248(0xb3)]['findOne']({'where':{'id':_0x59b758[_0x5ca248(0xe2)]['id']}})[_0x5ca248(0xa2)](handleEntityNotFound(_0x15c3c9,null))[_0x5ca248(0xa2)](function(_0x418b97){const _0x38417a=_0x5ca248;if(_0x418b97)return _0x4e0682=_0x418b97[_0x38417a(0x102)]({'plain':!![]}),_0x5aa68e[_0x38417a(0xf1)]=_[_0x38417a(0x105)](db[_0x38417a(0x103)]['rawAttributes']),_0x5aa68e[_0x38417a(0x97)]=_['keys'](_0x59b758['query']),_0x5aa68e[_0x38417a(0xa7)]=_[_0x38417a(0xd2)](_0x5aa68e[_0x38417a(0xf1)],_0x5aa68e[_0x38417a(0x97)]),_0x301390[_0x38417a(0xf3)]=_['intersection'](_0x5aa68e['model'],qs[_0x38417a(0xeb)](_0x59b758[_0x38417a(0x97)][_0x38417a(0xeb)])),_0x301390[_0x38417a(0xf3)]=_0x301390['attributes'][_0x38417a(0x100)]?_0x301390[_0x38417a(0xf3)]:_0x5aa68e[_0x38417a(0xf1)],typeof _0x59b758[_0x38417a(0x97)][_0x38417a(0xd7)]===_0x38417a(0x104)&&(_0x301390[_0x38417a(0xd3)]=qs[_0x38417a(0xd3)](_0x59b758[_0x38417a(0x97)][_0x38417a(0xd3)]),_0x301390[_0x38417a(0xcd)]=qs[_0x38417a(0xcd)](_0x59b758[_0x38417a(0x97)]['offset'])),_0x301390[_0x38417a(0xad)]=qs[_0x38417a(0xa9)](_0x59b758[_0x38417a(0x97)][_0x38417a(0xa9)]),_0x301390[_0x38417a(0xb7)]=qs[_0x38417a(0xa7)](_[_0x38417a(0xda)](_0x59b758[_0x38417a(0x97)],_0x5aa68e[_0x38417a(0xa7)])),_0x301390[_0x38417a(0xb7)][_0x38417a(0xe7)]=_0x418b97['id'],_0x59b758['query']['filter']&&(_0x301390[_0x38417a(0xb7)]=_['merge'](_0x301390['where'],{[Op['or']]:_['map'](_0x301390[_0x38417a(0xf3)],function(_0x5cf39f){const _0x5566c4=_0x38417a,_0x41d4c3={};return _0x41d4c3[_0x5cf39f]={[Op[_0x5566c4(0xee)]]:'%'+_0x59b758['query']['filter']+'%'},_0x41d4c3;})})),_0x301390=_[_0x38417a(0xf2)]({},_0x301390,_0x59b758[_0x38417a(0xa1)]),db[_0x38417a(0x103)][_0x38417a(0xc4)](_0x301390);})[_0x5ca248(0xa2)](function(_0x4a90f5){const _0x34fd4f=_0x5ca248;if(_0x4a90f5)return db[_0x34fd4f(0xbb)][_0x34fd4f(0xca)]({'where':{'id':_[_0x34fd4f(0xec)](_0x4a90f5,'UserId'),'role':'agent'},'attributes':['id',_0x34fd4f(0xb2),'smsPause',_0x34fd4f(0xe0),_0x34fd4f(0x98)]});})[_0x5ca248(0xa2)](function(_0x37cac5){const _0x31dc3f=_0x5ca248;return _0x37cac5?{'count':_0x37cac5['count'],'rows':_[_0x31dc3f(0xec)](_0x37cac5['rows'],function(_0x5718d4){const _0x546f8e=_0x31dc3f;return{'membername':_0x5718d4[_0x546f8e(0xb2)],'UserId':_0x5718d4['id'],'queue_name':_0x4e0682['name'],'SmsQueueId':_0x4e0682['id'],'interface':util[_0x546f8e(0xdb)](_0x546f8e(0xdc),_0x546f8e(0xd6),_0x5718d4[_0x546f8e(0xb2)]),'penalty':0x0,'paused':_0x5718d4[_0x546f8e(0xb1)],'createdAt':_0x5718d4[_0x546f8e(0x98)],'updatedAt':_0x5718d4[_0x546f8e(0xe0)]};})}:{'count':0x0,'rows':[]};})[_0x5ca248(0xa2)](respondWithFilteredResult(_0x15c3c9,_0x301390))[_0x5ca248(0xbf)](handleError(_0x15c3c9,null));},exports[a679_0x2c66d7(0x9a)]=function(_0x335408,_0x5d6780){const _0x1a4a2=a679_0x2c66d7;let _0x2ba157={};const _0x72df70={};let _0x229dd5,_0x483389;return db[_0x1a4a2(0xb3)][_0x1a4a2(0xf5)]({'where':{'id':_0x335408[_0x1a4a2(0xe2)]['id']}})[_0x1a4a2(0xa2)](handleEntityNotFound(_0x5d6780,null))[_0x1a4a2(0xa2)](function(_0x2041aa){const _0xd62b45=_0x1a4a2;if(_0x2041aa)return _0x229dd5=_0x2041aa,_0x72df70[_0xd62b45(0xf1)]=_[_0xd62b45(0x105)](db['Team']['rawAttributes']),_0x72df70[_0xd62b45(0x97)]=_['keys'](_0x335408[_0xd62b45(0x97)]),_0x72df70[_0xd62b45(0xa7)]=_['intersection'](_0x72df70[_0xd62b45(0xf1)],_0x72df70['query']),_0x2ba157[_0xd62b45(0xf3)]=_[_0xd62b45(0xd2)](_0x72df70[_0xd62b45(0xf1)],qs[_0xd62b45(0xeb)](_0x335408[_0xd62b45(0x97)]['fields'])),_0x2ba157['attributes']=_0x2ba157['attributes'][_0xd62b45(0x100)]?_0x2ba157[_0xd62b45(0xf3)]:_0x72df70[_0xd62b45(0xf1)],_0x2ba157[_0xd62b45(0xad)]=qs[_0xd62b45(0xa9)](_0x335408['query'][_0xd62b45(0xa9)]),_0x2ba157[_0xd62b45(0xb7)]=qs['filters'](_['pick'](_0x335408[_0xd62b45(0x97)],_0x72df70[_0xd62b45(0xa7)])),_0x335408['query']['filter']&&(_0x2ba157[_0xd62b45(0xb7)]=_[_0xd62b45(0xf2)](_0x2ba157[_0xd62b45(0xb7)],{[Op['or']]:_[_0xd62b45(0xec)](_0x2ba157[_0xd62b45(0xf3)],function(_0x32f46f){const _0x12c979=_0xd62b45,_0x4faf8a={};return _0x4faf8a[_0x32f46f]={[Op['like']]:'%'+_0x335408[_0x12c979(0x97)][_0x12c979(0x9f)]+'%'},_0x4faf8a;})})),_0x2ba157=_[_0xd62b45(0xf2)]({},_0x2ba157,_0x335408['options']),_0x229dd5[_0xd62b45(0x9a)](_0x2ba157);})[_0x1a4a2(0xa2)](function(_0x410bbd){const _0x148a7d=_0x1a4a2;if(_0x410bbd)return _0x483389=_0x410bbd[_0x148a7d(0x100)],typeof _0x335408['query']['nolimit']===_0x148a7d(0x104)&&(_0x2ba157['limit']=qs[_0x148a7d(0xd3)](_0x335408[_0x148a7d(0x97)]['limit']),_0x2ba157['offset']=qs[_0x148a7d(0xcd)](_0x335408[_0x148a7d(0x97)][_0x148a7d(0xcd)])),_0x229dd5[_0x148a7d(0x9a)](_0x2ba157);})[_0x1a4a2(0xa2)](function(_0x2a3067){if(_0x2a3067)return _0x2a3067?{'count':_0x483389,'rows':_0x2a3067}:null;})['then'](respondWithResult(_0x5d6780,null))[_0x1a4a2(0xbf)](handleError(_0x5d6780,null));},exports['addTeams']=function(_0x49e6be,_0x3754b1){const _0x227866=a679_0x2c66d7,_0x286aad=_0x49e6be['body'][_0x227866(0xef)];return db[_0x227866(0xc3)]['findAll']({'where':{'id':_0x286aad},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online',_0x227866(0xf7),_0x227866(0xb8)],'raw':!![]}]})[_0x227866(0xa2)](function(_0x220cdf){const _0x4d7332=_0x227866;if(_0x220cdf){const _0x3d97c0=_['flatMap'](_0x220cdf,function(_0x136b1c){const _0x37bbfd=a679_0x1e3b,_0x4aee23=_0x136b1c[_0x37bbfd(0x102)]({'plain':!![]});return _0x4aee23[_0x37bbfd(0xcb)];});return db[_0x4d7332(0xb3)][_0x4d7332(0xf5)]({'where':{'id':_0x49e6be[_0x4d7332(0xe2)]['id']}})[_0x4d7332(0xa2)](function(_0xbc6a56){const _0x4c8cdd=_0x4d7332;return db[_0x4c8cdd(0xae)][_0x4c8cdd(0xa5)](function(_0x16b65f){const _0x353dab=_0x4c8cdd;return _0xbc6a56[_0x353dab(0xc9)](_0x286aad,{'transaction':_0x16b65f})[_0x353dab(0xa2)](function(){const _0x557a67=_0x353dab;return Promise[_0x557a67(0xdd)](_0x3d97c0['map'](_0xe517fb=>{const _0x24a167=_0x557a67;return db[_0x24a167(0x103)][_0x24a167(0xab)]({'where':{'UserId':_0xe517fb['id'],'SmsQueueId':_0x49e6be[_0x24a167(0xe2)]['id']},'transaction':_0x16b65f});}));})['then'](function(){const _0x38a789=_0x353dab;_0x3d97c0[_0x38a789(0xde)](function(_0x303297){const _0x569def=_0x38a789;socket[_0x569def(0x9c)](_0x569def(0xfc),{'UserId':_0x303297['id'],'SmsQueueId':_0xbc6a56['id']});});});});});}})[_0x227866(0xa2)](respondWithStatusCode(_0x3754b1,null))[_0x227866(0xbf)](handleError(_0x3754b1,null));},exports[a679_0x2c66d7(0xe8)]=function(_0x39fae2,_0x2c8413){const _0x163ba=a679_0x2c66d7;return db[_0x163ba(0xc3)][_0x163ba(0xc4)]({'where':{'id':_0x39fae2[_0x163ba(0x97)]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x163ba(0xcb),'attributes':['id'],'raw':!![]}]})[_0x163ba(0xa2)](handleEntityNotFound(_0x2c8413,null))[_0x163ba(0xa2)](function(_0x392265){const _0xbd4a3e=_0x163ba,_0x1c5911=_[_0xbd4a3e(0xec)](_0x392265,'id');let _0x4a03db=[];const _0x2ae514=[],_0x49a61e=squel['select']();_0x49a61e['field'](_0xbd4a3e(0xea))['from'](_0xbd4a3e(0xc2),'tq')[_0xbd4a3e(0xb6)](_0xbd4a3e(0xf6),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xbd4a3e(0xdf),_0x39fae2['params']['id']);for(let _0x2d83c5=0x0;_0x2d83c5<_0x392265[_0xbd4a3e(0x100)];_0x2d83c5+=0x1){const _0x1969fc=_0x392265[_0x2d83c5];for(let _0x31e078=0x0;_0x31e078<_0x1969fc[_0xbd4a3e(0xcb)][_0xbd4a3e(0x100)];_0x31e078+=0x1){const _0x357132=_0x1969fc['Agents'][_0x31e078],_0x4abf2b=_0x49a61e['clone']();_0x4abf2b[_0xbd4a3e(0xb7)]('ut.UserId\x20=\x20?',_0x357132['id']),_0x2ae514['push'](db[_0xbd4a3e(0xae)][_0xbd4a3e(0x97)](_0x4abf2b[_0xbd4a3e(0xf9)](),{'type':QueryTypes[_0xbd4a3e(0xe6)]})[_0xbd4a3e(0xa2)](function(_0x3b320c){const _0x4c0184=_0xbd4a3e;if(_0x3b320c[_0x4c0184(0x100)]===0x1)return _0x357132['id'];else{const _0xf29231=_['every'](_[_0x4c0184(0xec)](_0x3b320c,_0x4c0184(0xbd)),function(_0x41a359){const _0x3f391e=_0x4c0184;return _[_0x3f391e(0xa8)](_0x1c5911,_0x41a359);});if(_0xf29231)return _0x357132['id'];}}));}}return Promise[_0xbd4a3e(0xdd)](_0x2ae514)[_0xbd4a3e(0xa2)](function(_0x30a1ff){const _0x1748da=_0xbd4a3e;return _0x4a03db=_(_0x4a03db)['union'](_0x30a1ff)[_0x1748da(0xd8)]()[_0x1748da(0x99)](),db[_0x1748da(0xb3)]['findOne']({'where':{'id':_0x39fae2[_0x1748da(0xe2)]['id']}})['then'](function(_0x363f36){const _0x25ea0d=_0x1748da;return db[_0x25ea0d(0xae)][_0x25ea0d(0xa5)](function(_0x1773d9){const _0x25743d=_0x25ea0d;return _0x363f36[_0x25743d(0xe8)](_0x39fae2[_0x25743d(0x97)][_0x25743d(0xef)],{'transaction':_0x1773d9})[_0x25743d(0xa2)](function(){const _0x27704a=_0x25743d;if(!_[_0x27704a(0xb9)](_0x4a03db))return _0x363f36[_0x27704a(0xcc)](_0x4a03db,{'transaction':_0x1773d9});})[_0x25743d(0xa2)](function(){const _0x20d7ef=_0x25743d;_0x4a03db[_0x20d7ef(0xde)](function(_0xcfa1a7){socket['emit']('userSmsQueue:remove',{'UserId':_0xcfa1a7,'SmsQueueId':_0x363f36['id']});});});});});});})[_0x163ba(0xa2)](respondWithStatusCode(_0x2c8413,null))['catch'](handleError(_0x2c8413,null));},exports[a679_0x2c66d7(0xf4)]=function(_0xd8ce34,_0x5b8f88){const _0x423ebe=a679_0x2c66d7;return db[_0x423ebe(0xb3)][_0x423ebe(0xf5)]({'where':{'id':_0xd8ce34['params']['id']}})[_0x423ebe(0xa2)](function(_0x4db664){const _0xdaa592=_0x423ebe;if(_0x4db664)return _0x4db664[_0xdaa592(0xf4)](_0xd8ce34['body'][_0xdaa592(0xef)],{'through':_[_0xdaa592(0xf8)](_0xd8ce34[_0xdaa592(0xb4)],[_0xdaa592(0xef),'id'])})[_0xdaa592(0xa2)](function(_0x204eb1){const _0xc48b20=_0xdaa592;for(let _0x4649af=0x0;_0x4649af<_0xd8ce34[_0xc48b20(0xb4)][_0xc48b20(0xef)][_0xc48b20(0x100)];_0x4649af+=0x1){socket[_0xc48b20(0x9c)](_0xc48b20(0xfc),{'UserId':_0xd8ce34[_0xc48b20(0xb4)][_0xc48b20(0xef)][_0x4649af],'SmsQueueId':_0xd8ce34[_0xc48b20(0xe2)]['id']});}return _0x204eb1;});})[_0x423ebe(0xa2)](respondWithResult(_0x5b8f88,null))[_0x423ebe(0xbf)](handleError(_0x5b8f88,null));},exports[a679_0x2c66d7(0xcc)]=function(_0x5ee6db,_0x5ee8f3){const _0x322f74=a679_0x2c66d7;return db[_0x322f74(0xb3)][_0x322f74(0xf5)]({'where':{'id':_0x5ee6db[_0x322f74(0xe2)]['id']}})['then'](handleEntityNotFound(_0x5ee8f3,null))['then'](function(_0x10381d){const _0x292105=_0x322f74;if(_0x10381d)return _0x10381d[_0x292105(0xcc)](_0x5ee6db[_0x292105(0x97)][_0x292105(0xef)])[_0x292105(0xa2)](function(){const _0x2c7c79=_0x292105;if(_[_0x2c7c79(0xaf)](_0x5ee6db[_0x2c7c79(0x97)]['ids']))for(let _0x43582f=0x0;_0x43582f<_0x5ee6db[_0x2c7c79(0x97)][_0x2c7c79(0xef)][_0x2c7c79(0x100)];_0x43582f+=0x1){socket[_0x2c7c79(0x9c)](_0x2c7c79(0x9e),{'UserId':Number(_0x5ee6db[_0x2c7c79(0x97)][_0x2c7c79(0xef)][_0x43582f]),'SmsQueueId':Number(_0x5ee6db[_0x2c7c79(0xe2)]['id'])});}else socket[_0x2c7c79(0x9c)](_0x2c7c79(0x9e),{'UserId':Number(_0x5ee6db['query'][_0x2c7c79(0xef)]),'SmsQueueId':Number(_0x5ee6db[_0x2c7c79(0xe2)]['id'])});});})[_0x322f74(0xa2)](respondWithStatusCode(_0x5ee8f3,null))[_0x322f74(0xbf)](handleError(_0x5ee8f3,null));},exports[a679_0x2c66d7(0xc1)]=function(_0x311497,_0x471b07){const _0x46a8ed=a679_0x2c66d7;let _0xd4639b={};const _0x3a58c0={};let _0x4770f5,_0x3f9106;return db['SmsQueue'][_0x46a8ed(0xf5)]({'where':{'id':_0x311497[_0x46a8ed(0xe2)]['id']}})[_0x46a8ed(0xa2)](handleEntityNotFound(_0x471b07,null))[_0x46a8ed(0xa2)](function(_0x3871f9){const _0x14060b=_0x46a8ed;if(_0x3871f9)return _0x4770f5=_0x3871f9,_0x3a58c0['model']=_[_0x14060b(0x105)](db[_0x14060b(0xbb)][_0x14060b(0xbe)]),_0x3a58c0[_0x14060b(0x97)]=_[_0x14060b(0x105)](_0x311497['query']),_0x3a58c0[_0x14060b(0xa7)]=_['intersection'](_0x3a58c0['model'],_0x3a58c0[_0x14060b(0x97)]),_0xd4639b[_0x14060b(0xf3)]=_['intersection'](_0x3a58c0[_0x14060b(0xf1)],qs[_0x14060b(0xeb)](_0x311497[_0x14060b(0x97)][_0x14060b(0xeb)])),_0xd4639b[_0x14060b(0xf3)]=_0xd4639b[_0x14060b(0xf3)][_0x14060b(0x100)]?_0xd4639b[_0x14060b(0xf3)]:_0x3a58c0['model'],_0xd4639b['order']=qs[_0x14060b(0xa9)](_0x311497[_0x14060b(0x97)]['sort']),_0xd4639b['where']=qs[_0x14060b(0xa7)](_[_0x14060b(0xda)](_0x311497[_0x14060b(0x97)],_0x3a58c0[_0x14060b(0xa7)])),_0x311497[_0x14060b(0x97)][_0x14060b(0x9f)]&&(_0xd4639b[_0x14060b(0xb7)]=_[_0x14060b(0xf2)](_0xd4639b[_0x14060b(0xb7)],{[Op['or']]:_[_0x14060b(0xec)](_0xd4639b[_0x14060b(0xf3)],function(_0x5f53c1){const _0x9e4b17=_0x14060b,_0x38eed8={};return _0x38eed8[_0x5f53c1]={[Op[_0x9e4b17(0xee)]]:'%'+_0x311497[_0x9e4b17(0x97)][_0x9e4b17(0x9f)]+'%'},_0x38eed8;})})),_0xd4639b=_[_0x14060b(0xf2)]({},_0xd4639b,_0x311497[_0x14060b(0xa1)]),_0x4770f5[_0x14060b(0xc1)](_0xd4639b);})['then'](function(_0x4d0727){const _0xa8bca7=_0x46a8ed;if(_0x4d0727)return _0x3f9106=_0x4d0727[_0xa8bca7(0x100)],typeof _0x311497[_0xa8bca7(0x97)]['nolimit']===_0xa8bca7(0x104)&&(_0xd4639b['limit']=qs[_0xa8bca7(0xd3)](_0x311497[_0xa8bca7(0x97)][_0xa8bca7(0xd3)]),_0xd4639b[_0xa8bca7(0xcd)]=qs['offset'](_0x311497['query']['offset'])),_0x4770f5['getAgents'](_0xd4639b);})[_0x46a8ed(0xa2)](function(_0x4a3dda){if(_0x4a3dda)return _0x4a3dda?{'count':_0x3f9106,'rows':_0x4a3dda}:null;})[_0x46a8ed(0xa2)](respondWithResult(_0x471b07,null))[_0x46a8ed(0xbf)](handleError(_0x471b07,null));};
\ No newline at end of file
+const a679_0x32dc=['get','../../components/parsers/qs','createdAt','voicePause','undefined','userProfileId','TeamId','role','updatedAt','sort','squel','value','stack','count','tq.TeamId','getAgents','removeTeams','clone','UserProfileSection','create','set','fieldName','then','findAndCountAll','addAgents','options','fields','limit','sendStatus','join','../../rediscache','omit','autoAssociation','every','user_has_teams','./smsQueue.socket','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','emit','model','end','getTeams','push','addTeams','status','userSmsQueue:remove','Agents','util','UserSmsQueue','select','SmsQueue','forEach','UserProfileResource','agent','intersection','ids','describe','register','compact','SELECT','length','field','ut.TeamId\x20=\x20tq.TeamId','Unable\x20to\x20retrieve\x20the\x20current\x20user','getMembers','update','User','lodash','Content-Range','rows','params','body','Team','team_has_sms_queues','where','SmsQueueId','format','catch','filters','ut.UserId\x20=\x20?','%s/%s','attributes','SmsQueueId\x20=\x20?','toString','flatMap','isArray','type','userSmsQueue:save','interface','SmsQueues','like','sequelize','filter','map','union','destroy','findOne','VIRTUAL','rawAttributes','removeAgents','api','json','findOrCreate','merge','online','key','query','include','pick','order','../../config/logger','findAll','error','keys','from','name','user','all','../../mysqldb','SIP','offset'];(function(_0x4b93b0,_0x298446){const _0x32dcec=function(_0x162edd){while(--_0x162edd){_0x4b93b0['push'](_0x4b93b0['shift']());}};_0x32dcec(++_0x298446);}(a679_0x32dc,0x1ef));const a679_0x162e=function(_0x4b93b0,_0x298446){_0x4b93b0=_0x4b93b0-0x98;let _0x32dcec=a679_0x32dc[_0x4b93b0];return _0x32dcec;};const a679_0x22e361=a679_0x162e;'use strict';const util=require(a679_0x22e361(0xb7)),_=require(a679_0x22e361(0xcb)),squel=require(a679_0x22e361(0x10b)),qs=require(a679_0x22e361(0x102)),logger=require(a679_0x22e361(0xf6))(a679_0x22e361(0xec)),{getSocket}=require(a679_0x22e361(0xa7)),socket=getSocket(),{db}=require(a679_0x22e361(0xfe)),{Op,QueryTypes}=require(a679_0x22e361(0xe3));require(a679_0x22e361(0xac))[a679_0x22e361(0xc1)](socket);function respondWithStatusCode(_0x52b5b7,_0x14b422){return _0x14b422=_0x14b422||0xcc,function(_0xb04770){const _0x29dadb=a679_0x162e;if(_0xb04770)return _0x52b5b7[_0x29dadb(0xa5)](_0x14b422);return _0x52b5b7[_0x29dadb(0xb4)](_0x14b422)[_0x29dadb(0xb0)]();};}function respondWithResult(_0x241e1f,_0x1126b7){return _0x1126b7=_0x1126b7||0xc8,function(_0x16c99a){const _0x9804eb=a679_0x162e;if(_0x16c99a)return _0x241e1f[_0x9804eb(0xb4)](_0x1126b7)[_0x9804eb(0xed)](_0x16c99a);};}function respondWithFilteredResult(_0x5b2f01,_0x1f23b4){return function(_0x20910f){const _0x4869b6=a679_0x162e;if(_0x20910f){const _0x493c0e=_0x20910f[_0x4869b6(0x10e)],_0x5af0e1=_0x1f23b4[_0x4869b6(0x100)];let _0x1eb0bb=_0x1f23b4[_0x4869b6(0x100)]+_0x1f23b4[_0x4869b6(0xa4)],_0xf47b95;return _0x1eb0bb>=_0x493c0e?(_0x1eb0bb=_0x493c0e,_0xf47b95=0xc8):_0xf47b95=0xce,_0x5b2f01[_0x4869b6(0xb4)](_0xf47b95),_0x5b2f01[_0x4869b6(0x9d)](_0x4869b6(0xcc),_0x5af0e1+'-'+_0x1eb0bb+'/'+_0x493c0e)[_0x4869b6(0xed)](_0x20910f);}return null;};}function saveUpdates(_0x50653e){return function(_0x2b0b1c){const _0x2d02a5=a679_0x162e;if(_0x2b0b1c)return _0x2b0b1c[_0x2d02a5(0xc9)](_0x50653e)[_0x2d02a5(0x9f)](function(_0x474744){return _0x474744;});return null;};}function removeEntity(_0x340712){return function(_0x15f602){const _0x25da80=a679_0x162e;if(_0x15f602)return _0x15f602[_0x25da80(0xe7)]()[_0x25da80(0x9f)](function(){const _0x1f9d57=_0x25da80,_0x24ada1=_0x15f602[_0x1f9d57(0x101)]({'plain':!![]}),_0x3976a0=_0x1f9d57(0xe1);return db['UserProfileResource'][_0x1f9d57(0xe7)]({'where':{'type':_0x3976a0,'resourceId':_0x24ada1['id']}})[_0x1f9d57(0x9f)](function(){return _0x15f602;});})[_0x25da80(0x9f)](function(){const _0x441c4c=_0x25da80;_0x340712[_0x441c4c(0xb4)](0xcc)[_0x441c4c(0xb0)]();});};}function handleEntityNotFound(_0x310b24){return function(_0x2ff623){const _0x43e3cf=a679_0x162e;return!_0x2ff623&&_0x310b24[_0x43e3cf(0xa5)](0x194),_0x2ff623;};}function handleError(_0x32b481,_0x15994d){return _0x15994d=_0x15994d||0x1f4,function(_0x2e2667){const _0x4197a0=a679_0x162e;logger[_0x4197a0(0xf8)](_0x2e2667[_0x4197a0(0x10d)]),_0x2e2667['name']&&delete _0x2e2667['name'],_0x32b481[_0x4197a0(0xb4)](_0x15994d)['send'](_0x2e2667);};}exports['index']=function(_0x451069,_0x7951d8){const _0x547405=a679_0x22e361;let _0x1ffd11={};const _0x113aec={},_0x587225={'count':0x0,'rows':[]},_0x37f9fd=_[_0x547405(0xe5)](db[_0x547405(0xba)][_0x547405(0xea)],function(_0x3815dc){const _0x40cee1=_0x547405;return{'name':_0x3815dc[_0x40cee1(0x9e)],'type':_0x3815dc[_0x40cee1(0xde)][_0x40cee1(0xf1)]};});_0x113aec[_0x547405(0xaf)]=_['map'](_0x37f9fd,_0x547405(0xfb)),_0x113aec[_0x547405(0xf2)]=_['keys'](_0x451069[_0x547405(0xf2)]),_0x113aec[_0x547405(0xd6)]=_[_0x547405(0xbe)](_0x113aec[_0x547405(0xaf)],_0x113aec[_0x547405(0xf2)]),_0x1ffd11[_0x547405(0xd9)]=_['intersection'](_0x113aec[_0x547405(0xaf)],qs[_0x547405(0xa3)](_0x451069[_0x547405(0xf2)][_0x547405(0xa3)])),_0x1ffd11[_0x547405(0xd9)]=_0x1ffd11[_0x547405(0xd9)][_0x547405(0xc4)]?_0x1ffd11[_0x547405(0xd9)]:_0x113aec[_0x547405(0xaf)];typeof _0x451069[_0x547405(0xf2)]['nolimit']==='undefined'&&(_0x1ffd11[_0x547405(0xa4)]=qs[_0x547405(0xa4)](_0x451069['query'][_0x547405(0xa4)]),_0x1ffd11[_0x547405(0x100)]=qs[_0x547405(0x100)](_0x451069['query'][_0x547405(0x100)]));_0x1ffd11[_0x547405(0xf5)]=qs[_0x547405(0x10a)](_0x451069[_0x547405(0xf2)][_0x547405(0x10a)]),_0x1ffd11[_0x547405(0xd2)]=qs['filters'](_['pick'](_0x451069[_0x547405(0xf2)],_0x113aec[_0x547405(0xd6)]),_0x37f9fd);_0x451069['query'][_0x547405(0xe4)]&&(_0x1ffd11['where']=_[_0x547405(0xef)](_0x1ffd11[_0x547405(0xd2)],{[Op['or']]:_['map'](_0x37f9fd,function(_0x18d453){const _0x560786=_0x547405;if(_0x18d453[_0x560786(0xde)]!==_0x560786(0xe9)){const _0x108a73={};return _0x108a73[_0x18d453['name']]={[Op[_0x560786(0xe2)]]:'%'+_0x451069[_0x560786(0xf2)][_0x560786(0xe4)]+'%'},_0x108a73;}})}));_0x1ffd11=_[_0x547405(0xef)]({},_0x1ffd11,_0x451069[_0x547405(0xa2)]);const _0x844989={'where':_0x1ffd11[_0x547405(0xd2)]};return db['SmsQueue'][_0x547405(0x10e)](_0x844989)['then'](function(_0x4db497){const _0x1b5cde=_0x547405;return _0x587225[_0x1b5cde(0x10e)]=_0x4db497,_0x451069[_0x1b5cde(0xf2)]['includeAll']&&(_0x1ffd11['include']=[{'all':!![]}]),db[_0x1b5cde(0xba)][_0x1b5cde(0xf7)](_0x1ffd11);})[_0x547405(0x9f)](function(_0x156ae3){const _0x4c8844=_0x547405;return _0x587225[_0x4c8844(0xcd)]=_0x156ae3,_0x587225;})[_0x547405(0x9f)](respondWithFilteredResult(_0x7951d8,_0x1ffd11))[_0x547405(0xd5)](handleError(_0x7951d8,null));},exports['show']=function(_0x1d8f95,_0x562793){const _0x473d4c=a679_0x22e361;let _0x5aff49={'raw':!![],'where':{'id':_0x1d8f95[_0x473d4c(0xce)]['id']}};const _0x46dc72={};return _0x46dc72[_0x473d4c(0xaf)]=_[_0x473d4c(0xf9)](db[_0x473d4c(0xba)]['rawAttributes']),_0x46dc72['query']=_[_0x473d4c(0xf9)](_0x1d8f95[_0x473d4c(0xf2)]),_0x46dc72[_0x473d4c(0xd6)]=_[_0x473d4c(0xbe)](_0x46dc72[_0x473d4c(0xaf)],_0x46dc72['query']),_0x5aff49[_0x473d4c(0xd9)]=_[_0x473d4c(0xbe)](_0x46dc72['model'],qs['fields'](_0x1d8f95[_0x473d4c(0xf2)]['fields'])),_0x5aff49[_0x473d4c(0xd9)]=_0x5aff49['attributes'][_0x473d4c(0xc4)]?_0x5aff49[_0x473d4c(0xd9)]:_0x46dc72[_0x473d4c(0xaf)],_0x1d8f95['query']['includeAll']&&(_0x5aff49[_0x473d4c(0xf3)]=[{'all':!![]}]),_0x5aff49=_[_0x473d4c(0xef)]({},_0x5aff49,_0x1d8f95[_0x473d4c(0xa2)]),db['SmsQueue'][_0x473d4c(0xe8)](_0x5aff49)['then'](handleEntityNotFound(_0x562793,null))[_0x473d4c(0x9f)](respondWithResult(_0x562793,null))[_0x473d4c(0xd5)](handleError(_0x562793,null));},exports[a679_0x22e361(0x9c)]=function(_0x248230,_0x2751aa){const _0x264b78=a679_0x22e361;return db['SmsQueue']['create'](_0x248230[_0x264b78(0xcf)],{})['then'](function(_0x27eab9){const _0x5d2926=_0x264b78,_0x2bd6f0=_0x248230['user'][_0x5d2926(0x101)]({'plain':!![]});if(!_0x2bd6f0)throw new Error(_0x5d2926(0xc7));if(_0x2bd6f0[_0x5d2926(0x108)]===_0x5d2926(0xfc)){const _0xddd683=_0x27eab9['get']({'plain':!![]}),_0x2f20c2=_0x5d2926(0xe1);return db[_0x5d2926(0x9b)][_0x5d2926(0xe8)]({'where':{'name':_0x2f20c2,'userProfileId':_0x2bd6f0[_0x5d2926(0x106)]},'raw':!![]})[_0x5d2926(0x9f)](function(_0x5dc6c4){const _0x1b4fc1=_0x5d2926;return _0x5dc6c4&&_0x5dc6c4[_0x1b4fc1(0xa9)]===0x0?db[_0x1b4fc1(0xbc)]['create']({'name':_0xddd683['name'],'resourceId':_0xddd683['id'],'type':_0x5dc6c4[_0x1b4fc1(0xfb)],'sectionId':_0x5dc6c4['id']},{})[_0x1b4fc1(0x9f)](function(){return _0x27eab9;}):_0x27eab9;})[_0x5d2926(0xd5)](function(_0x199953){const _0x5f5bf4=_0x5d2926;logger[_0x5f5bf4(0xf8)](_0x5f5bf4(0xad),_0x199953);throw _0x199953;});}return _0x27eab9;})[_0x264b78(0x9f)](respondWithResult(_0x2751aa,0xc9))[_0x264b78(0xd5)](handleError(_0x2751aa,null));},exports[a679_0x22e361(0xc9)]=function(_0x4e2025,_0x2367fe){const _0x56ab5b=a679_0x22e361;return _0x4e2025['body']['id']&&delete _0x4e2025[_0x56ab5b(0xcf)]['id'],db[_0x56ab5b(0xba)][_0x56ab5b(0xe8)]({'where':{'id':_0x4e2025[_0x56ab5b(0xce)]['id']}})[_0x56ab5b(0x9f)](handleEntityNotFound(_0x2367fe,null))[_0x56ab5b(0x9f)](saveUpdates(_0x4e2025[_0x56ab5b(0xcf)],null))[_0x56ab5b(0x9f)](respondWithResult(_0x2367fe,null))[_0x56ab5b(0xd5)](handleError(_0x2367fe,null));},exports[a679_0x22e361(0xe7)]=function(_0x1c8283,_0x41ca4e){const _0xa022f9=a679_0x22e361;return db[_0xa022f9(0xba)][_0xa022f9(0xe8)]({'where':{'id':_0x1c8283[_0xa022f9(0xce)]['id']}})['then'](handleEntityNotFound(_0x41ca4e,null))['then'](removeEntity(_0x41ca4e,null))['catch'](handleError(_0x41ca4e,null));},exports[a679_0x22e361(0xc0)]=function(_0x23d470,_0x359dc2){const _0x165087=a679_0x22e361;return db[_0x165087(0xba)][_0x165087(0xc0)]()[_0x165087(0x9f)](respondWithResult(_0x359dc2,null))[_0x165087(0xd5)](handleError(_0x359dc2,null));},exports[a679_0x22e361(0xc8)]=function(_0x1c90d8,_0x508c14){const _0x18d50b=a679_0x22e361;let _0x7c1a28={'raw':!![],'where':{}};const _0x4389d0={};let _0x42a9a0;return db[_0x18d50b(0xba)][_0x18d50b(0xe8)]({'where':{'id':_0x1c90d8[_0x18d50b(0xce)]['id']}})[_0x18d50b(0x9f)](handleEntityNotFound(_0x508c14,null))[_0x18d50b(0x9f)](function(_0xa35430){const _0x41ca05=_0x18d50b;if(_0xa35430)return _0x42a9a0=_0xa35430['get']({'plain':!![]}),_0x4389d0['model']=_[_0x41ca05(0xf9)](db[_0x41ca05(0xb8)][_0x41ca05(0xea)]),_0x4389d0[_0x41ca05(0xf2)]=_[_0x41ca05(0xf9)](_0x1c90d8[_0x41ca05(0xf2)]),_0x4389d0['filters']=_[_0x41ca05(0xbe)](_0x4389d0[_0x41ca05(0xaf)],_0x4389d0[_0x41ca05(0xf2)]),_0x7c1a28[_0x41ca05(0xd9)]=_[_0x41ca05(0xbe)](_0x4389d0['model'],qs[_0x41ca05(0xa3)](_0x1c90d8[_0x41ca05(0xf2)][_0x41ca05(0xa3)])),_0x7c1a28[_0x41ca05(0xd9)]=_0x7c1a28['attributes'][_0x41ca05(0xc4)]?_0x7c1a28[_0x41ca05(0xd9)]:_0x4389d0[_0x41ca05(0xaf)],typeof _0x1c90d8[_0x41ca05(0xf2)]['nolimit']==='undefined'&&(_0x7c1a28[_0x41ca05(0xa4)]=qs[_0x41ca05(0xa4)](_0x1c90d8[_0x41ca05(0xf2)][_0x41ca05(0xa4)]),_0x7c1a28[_0x41ca05(0x100)]=qs[_0x41ca05(0x100)](_0x1c90d8['query']['offset'])),_0x7c1a28[_0x41ca05(0xf5)]=qs[_0x41ca05(0x10a)](_0x1c90d8['query'][_0x41ca05(0x10a)]),_0x7c1a28[_0x41ca05(0xd2)]=qs[_0x41ca05(0xd6)](_[_0x41ca05(0xf4)](_0x1c90d8[_0x41ca05(0xf2)],_0x4389d0[_0x41ca05(0xd6)])),_0x7c1a28[_0x41ca05(0xd2)][_0x41ca05(0xd3)]=_0xa35430['id'],_0x1c90d8[_0x41ca05(0xf2)]['filter']&&(_0x7c1a28[_0x41ca05(0xd2)]=_[_0x41ca05(0xef)](_0x7c1a28[_0x41ca05(0xd2)],{[Op['or']]:_[_0x41ca05(0xe5)](_0x7c1a28['attributes'],function(_0x1153d9){const _0x1b742b=_0x41ca05,_0x4be6aa={};return _0x4be6aa[_0x1153d9]={[Op[_0x1b742b(0xe2)]]:'%'+_0x1c90d8[_0x1b742b(0xf2)][_0x1b742b(0xe4)]+'%'},_0x4be6aa;})})),_0x7c1a28=_[_0x41ca05(0xef)]({},_0x7c1a28,_0x1c90d8[_0x41ca05(0xa2)]),db[_0x41ca05(0xb8)]['findAll'](_0x7c1a28);})[_0x18d50b(0x9f)](function(_0x2ff20e){const _0x2fb2b9=_0x18d50b;if(_0x2ff20e)return db[_0x2fb2b9(0xca)][_0x2fb2b9(0xa0)]({'where':{'id':_[_0x2fb2b9(0xe5)](_0x2ff20e,'UserId'),'role':_0x2fb2b9(0xbd)},'attributes':['id',_0x2fb2b9(0xfb),'smsPause',_0x2fb2b9(0x109),_0x2fb2b9(0x103)]});})[_0x18d50b(0x9f)](function(_0x49d9c4){const _0x55545f=_0x18d50b;return _0x49d9c4?{'count':_0x49d9c4['count'],'rows':_[_0x55545f(0xe5)](_0x49d9c4['rows'],function(_0xb5623){const _0x495f86=_0x55545f;return{'membername':_0xb5623[_0x495f86(0xfb)],'UserId':_0xb5623['id'],'queue_name':_0x42a9a0[_0x495f86(0xfb)],'SmsQueueId':_0x42a9a0['id'],'interface':util[_0x495f86(0xd4)](_0x495f86(0xd8),_0x495f86(0xff),_0xb5623[_0x495f86(0xfb)]),'penalty':0x0,'paused':_0xb5623['smsPause'],'createdAt':_0xb5623['createdAt'],'updatedAt':_0xb5623[_0x495f86(0x109)]};})}:{'count':0x0,'rows':[]};})['then'](respondWithFilteredResult(_0x508c14,_0x7c1a28))[_0x18d50b(0xd5)](handleError(_0x508c14,null));},exports[a679_0x22e361(0xb1)]=function(_0x4de92f,_0x599ff1){const _0x85e0ce=a679_0x22e361;let _0x2eb734={};const _0x13ac7a={};let _0x261575,_0x5370bf;return db[_0x85e0ce(0xba)][_0x85e0ce(0xe8)]({'where':{'id':_0x4de92f[_0x85e0ce(0xce)]['id']}})[_0x85e0ce(0x9f)](handleEntityNotFound(_0x599ff1,null))[_0x85e0ce(0x9f)](function(_0x52eb00){const _0x20393e=_0x85e0ce;if(_0x52eb00)return _0x261575=_0x52eb00,_0x13ac7a[_0x20393e(0xaf)]=_[_0x20393e(0xf9)](db[_0x20393e(0xd0)][_0x20393e(0xea)]),_0x13ac7a[_0x20393e(0xf2)]=_[_0x20393e(0xf9)](_0x4de92f[_0x20393e(0xf2)]),_0x13ac7a['filters']=_['intersection'](_0x13ac7a['model'],_0x13ac7a['query']),_0x2eb734[_0x20393e(0xd9)]=_[_0x20393e(0xbe)](_0x13ac7a[_0x20393e(0xaf)],qs[_0x20393e(0xa3)](_0x4de92f['query'][_0x20393e(0xa3)])),_0x2eb734[_0x20393e(0xd9)]=_0x2eb734[_0x20393e(0xd9)]['length']?_0x2eb734[_0x20393e(0xd9)]:_0x13ac7a[_0x20393e(0xaf)],_0x2eb734['order']=qs['sort'](_0x4de92f['query']['sort']),_0x2eb734['where']=qs['filters'](_[_0x20393e(0xf4)](_0x4de92f['query'],_0x13ac7a[_0x20393e(0xd6)])),_0x4de92f[_0x20393e(0xf2)][_0x20393e(0xe4)]&&(_0x2eb734[_0x20393e(0xd2)]=_[_0x20393e(0xef)](_0x2eb734['where'],{[Op['or']]:_['map'](_0x2eb734[_0x20393e(0xd9)],function(_0x54b3b0){const _0x1d9300=_0x20393e,_0x5c4de4={};return _0x5c4de4[_0x54b3b0]={[Op[_0x1d9300(0xe2)]]:'%'+_0x4de92f[_0x1d9300(0xf2)][_0x1d9300(0xe4)]+'%'},_0x5c4de4;})})),_0x2eb734=_['merge']({},_0x2eb734,_0x4de92f[_0x20393e(0xa2)]),_0x261575[_0x20393e(0xb1)](_0x2eb734);})['then'](function(_0x20f2f8){const _0x52396e=_0x85e0ce;if(_0x20f2f8)return _0x5370bf=_0x20f2f8[_0x52396e(0xc4)],typeof _0x4de92f[_0x52396e(0xf2)]['nolimit']===_0x52396e(0x105)&&(_0x2eb734[_0x52396e(0xa4)]=qs[_0x52396e(0xa4)](_0x4de92f[_0x52396e(0xf2)][_0x52396e(0xa4)]),_0x2eb734[_0x52396e(0x100)]=qs['offset'](_0x4de92f[_0x52396e(0xf2)]['offset'])),_0x261575[_0x52396e(0xb1)](_0x2eb734);})[_0x85e0ce(0x9f)](function(_0x56fb39){if(_0x56fb39)return _0x56fb39?{'count':_0x5370bf,'rows':_0x56fb39}:null;})[_0x85e0ce(0x9f)](respondWithResult(_0x599ff1,null))[_0x85e0ce(0xd5)](handleError(_0x599ff1,null));},exports['addTeams']=function(_0x32900c,_0x376fc5){const _0x475742=a679_0x22e361,_0x1cff3e=_0x32900c[_0x475742(0xcf)]['ids'];return db[_0x475742(0xd0)][_0x475742(0xf7)]({'where':{'id':_0x1cff3e},'attributes':['id'],'include':[{'model':db[_0x475742(0xca)],'as':_0x475742(0xb6),'attributes':['id','name',_0x475742(0xf0),_0x475742(0x104),_0x475742(0xe0)],'raw':!![]}]})[_0x475742(0x9f)](function(_0x9b2a4e){const _0x29c278=_0x475742;if(_0x9b2a4e){const _0x37c7cd=_[_0x29c278(0xdc)](_0x9b2a4e,function(_0x3c38bf){const _0x9c3505=_0x29c278,_0x214f94=_0x3c38bf[_0x9c3505(0x101)]({'plain':!![]});return _0x214f94[_0x9c3505(0xb6)];});return db[_0x29c278(0xba)][_0x29c278(0xe8)]({'where':{'id':_0x32900c[_0x29c278(0xce)]['id']}})[_0x29c278(0x9f)](function(_0x220148){const _0x20384a=_0x29c278;return db[_0x20384a(0xe3)]['transaction'](function(_0x5c5cc2){const _0x3affed=_0x20384a;return _0x220148[_0x3affed(0xb3)](_0x1cff3e,{'transaction':_0x5c5cc2})[_0x3affed(0x9f)](function(){const _0x59f146=_0x3affed;return Promise[_0x59f146(0xfd)](_0x37c7cd[_0x59f146(0xe5)](_0x33df43=>{const _0x4d327d=_0x59f146;return db[_0x4d327d(0xb8)][_0x4d327d(0xee)]({'where':{'UserId':_0x33df43['id'],'SmsQueueId':_0x32900c[_0x4d327d(0xce)]['id']},'transaction':_0x5c5cc2});}));})[_0x3affed(0x9f)](function(){_0x37c7cd['forEach'](function(_0x2e10e6){const _0x5c1148=a679_0x162e;socket[_0x5c1148(0xae)](_0x5c1148(0xdf),{'UserId':_0x2e10e6['id'],'SmsQueueId':_0x220148['id']});});});});});}})['then'](respondWithStatusCode(_0x376fc5,null))['catch'](handleError(_0x376fc5,null));},exports[a679_0x22e361(0x99)]=function(_0x5e7751,_0x277fc3){const _0x2b7d48=a679_0x22e361;return db[_0x2b7d48(0xd0)]['findAll']({'where':{'id':_0x5e7751[_0x2b7d48(0xf2)][_0x2b7d48(0xbf)]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2b7d48(0xb6),'attributes':['id'],'raw':!![]}]})[_0x2b7d48(0x9f)](handleEntityNotFound(_0x277fc3,null))[_0x2b7d48(0x9f)](function(_0x24e4fc){const _0x5eaff4=_0x2b7d48,_0x11d47b=_[_0x5eaff4(0xe5)](_0x24e4fc,'id');let _0x265ef2=[];const _0x5c4c33=[],_0x546153=squel[_0x5eaff4(0xb9)]();_0x546153[_0x5eaff4(0xc5)](_0x5eaff4(0x10f))[_0x5eaff4(0xfa)](_0x5eaff4(0xd1),'tq')[_0x5eaff4(0xa6)](_0x5eaff4(0xab),'ut',_0x5eaff4(0xc6))[_0x5eaff4(0xd2)](_0x5eaff4(0xda),_0x5e7751['params']['id']);for(let _0x431cf9=0x0;_0x431cf9<_0x24e4fc['length'];_0x431cf9+=0x1){const _0x4b00dc=_0x24e4fc[_0x431cf9];for(let _0x15dc5e=0x0;_0x15dc5e<_0x4b00dc['Agents']['length'];_0x15dc5e+=0x1){const _0x57ee9c=_0x4b00dc[_0x5eaff4(0xb6)][_0x15dc5e],_0x420d18=_0x546153[_0x5eaff4(0x9a)]();_0x420d18[_0x5eaff4(0xd2)](_0x5eaff4(0xd7),_0x57ee9c['id']),_0x5c4c33[_0x5eaff4(0xb2)](db[_0x5eaff4(0xe3)][_0x5eaff4(0xf2)](_0x420d18[_0x5eaff4(0xdb)](),{'type':QueryTypes[_0x5eaff4(0xc3)]})[_0x5eaff4(0x9f)](function(_0x4cb659){const _0x1f08d9=_0x5eaff4;if(_0x4cb659[_0x1f08d9(0xc4)]===0x1)return _0x57ee9c['id'];else{const _0x50a163=_[_0x1f08d9(0xaa)](_[_0x1f08d9(0xe5)](_0x4cb659,_0x1f08d9(0x107)),function(_0x1be9ec){return _['includes'](_0x11d47b,_0x1be9ec);});if(_0x50a163)return _0x57ee9c['id'];}}));}}return Promise['all'](_0x5c4c33)['then'](function(_0x529718){const _0x1501af=_0x5eaff4;return _0x265ef2=_(_0x265ef2)[_0x1501af(0xe6)](_0x529718)[_0x1501af(0xc2)]()[_0x1501af(0x10c)](),db[_0x1501af(0xba)]['findOne']({'where':{'id':_0x5e7751[_0x1501af(0xce)]['id']}})['then'](function(_0x27471c){const _0x25caa3=_0x1501af;return db[_0x25caa3(0xe3)]['transaction'](function(_0x105d79){const _0x277fff=_0x25caa3;return _0x27471c[_0x277fff(0x99)](_0x5e7751[_0x277fff(0xf2)][_0x277fff(0xbf)],{'transaction':_0x105d79})[_0x277fff(0x9f)](function(){const _0x1b432d=_0x277fff;if(!_['isEmpty'](_0x265ef2))return _0x27471c[_0x1b432d(0xeb)](_0x265ef2,{'transaction':_0x105d79});})[_0x277fff(0x9f)](function(){const _0x566846=_0x277fff;_0x265ef2[_0x566846(0xbb)](function(_0x3512d0){const _0x2de93d=_0x566846;socket[_0x2de93d(0xae)](_0x2de93d(0xb5),{'UserId':_0x3512d0,'SmsQueueId':_0x27471c['id']});});});});});});})[_0x2b7d48(0x9f)](respondWithStatusCode(_0x277fc3,null))[_0x2b7d48(0xd5)](handleError(_0x277fc3,null));},exports[a679_0x22e361(0xa1)]=function(_0x33c9c2,_0x3e50a9){const _0x52962d=a679_0x22e361;return db[_0x52962d(0xba)][_0x52962d(0xe8)]({'where':{'id':_0x33c9c2[_0x52962d(0xce)]['id']}})[_0x52962d(0x9f)](function(_0x29cba9){const _0xd4eb95=_0x52962d;if(_0x29cba9)return _0x29cba9[_0xd4eb95(0xa1)](_0x33c9c2[_0xd4eb95(0xcf)]['ids'],{'through':_[_0xd4eb95(0xa8)](_0x33c9c2['body'],[_0xd4eb95(0xbf),'id'])})[_0xd4eb95(0x9f)](function(_0x47fe06){const _0x108d4c=_0xd4eb95;for(let _0x5cd795=0x0;_0x5cd795<_0x33c9c2[_0x108d4c(0xcf)][_0x108d4c(0xbf)][_0x108d4c(0xc4)];_0x5cd795+=0x1){socket[_0x108d4c(0xae)](_0x108d4c(0xdf),{'UserId':_0x33c9c2[_0x108d4c(0xcf)]['ids'][_0x5cd795],'SmsQueueId':_0x33c9c2[_0x108d4c(0xce)]['id']});}return _0x47fe06;});})[_0x52962d(0x9f)](respondWithResult(_0x3e50a9,null))[_0x52962d(0xd5)](handleError(_0x3e50a9,null));},exports['removeAgents']=function(_0x5f32f6,_0x39838e){const _0x510aa1=a679_0x22e361;return db[_0x510aa1(0xba)][_0x510aa1(0xe8)]({'where':{'id':_0x5f32f6[_0x510aa1(0xce)]['id']}})[_0x510aa1(0x9f)](handleEntityNotFound(_0x39838e,null))[_0x510aa1(0x9f)](function(_0x47796f){const _0x3ca0e3=_0x510aa1;if(_0x47796f)return _0x47796f[_0x3ca0e3(0xeb)](_0x5f32f6[_0x3ca0e3(0xf2)][_0x3ca0e3(0xbf)])[_0x3ca0e3(0x9f)](function(){const _0x34fdfb=_0x3ca0e3;if(_[_0x34fdfb(0xdd)](_0x5f32f6[_0x34fdfb(0xf2)][_0x34fdfb(0xbf)]))for(let _0x240db7=0x0;_0x240db7<_0x5f32f6[_0x34fdfb(0xf2)][_0x34fdfb(0xbf)][_0x34fdfb(0xc4)];_0x240db7+=0x1){socket['emit'](_0x34fdfb(0xb5),{'UserId':Number(_0x5f32f6[_0x34fdfb(0xf2)][_0x34fdfb(0xbf)][_0x240db7]),'SmsQueueId':Number(_0x5f32f6['params']['id'])});}else socket[_0x34fdfb(0xae)](_0x34fdfb(0xb5),{'UserId':Number(_0x5f32f6['query'][_0x34fdfb(0xbf)]),'SmsQueueId':Number(_0x5f32f6['params']['id'])});});})[_0x510aa1(0x9f)](respondWithStatusCode(_0x39838e,null))[_0x510aa1(0xd5)](handleError(_0x39838e,null));},exports[a679_0x22e361(0x98)]=function(_0x1815fc,_0x587e17){const _0x32bc89=a679_0x22e361;let _0x14a6ef={};const _0x5043e5={};let _0x25382d,_0x52d831;return db[_0x32bc89(0xba)][_0x32bc89(0xe8)]({'where':{'id':_0x1815fc[_0x32bc89(0xce)]['id']}})[_0x32bc89(0x9f)](handleEntityNotFound(_0x587e17,null))[_0x32bc89(0x9f)](function(_0x3b57e0){const _0x2950b0=_0x32bc89;if(_0x3b57e0)return _0x25382d=_0x3b57e0,_0x5043e5[_0x2950b0(0xaf)]=_[_0x2950b0(0xf9)](db[_0x2950b0(0xca)][_0x2950b0(0xea)]),_0x5043e5['query']=_[_0x2950b0(0xf9)](_0x1815fc[_0x2950b0(0xf2)]),_0x5043e5[_0x2950b0(0xd6)]=_['intersection'](_0x5043e5['model'],_0x5043e5['query']),_0x14a6ef[_0x2950b0(0xd9)]=_[_0x2950b0(0xbe)](_0x5043e5[_0x2950b0(0xaf)],qs[_0x2950b0(0xa3)](_0x1815fc[_0x2950b0(0xf2)][_0x2950b0(0xa3)])),_0x14a6ef[_0x2950b0(0xd9)]=_0x14a6ef[_0x2950b0(0xd9)][_0x2950b0(0xc4)]?_0x14a6ef[_0x2950b0(0xd9)]:_0x5043e5[_0x2950b0(0xaf)],_0x14a6ef[_0x2950b0(0xf5)]=qs[_0x2950b0(0x10a)](_0x1815fc[_0x2950b0(0xf2)][_0x2950b0(0x10a)]),_0x14a6ef[_0x2950b0(0xd2)]=qs[_0x2950b0(0xd6)](_[_0x2950b0(0xf4)](_0x1815fc[_0x2950b0(0xf2)],_0x5043e5[_0x2950b0(0xd6)])),_0x1815fc[_0x2950b0(0xf2)][_0x2950b0(0xe4)]&&(_0x14a6ef[_0x2950b0(0xd2)]=_['merge'](_0x14a6ef[_0x2950b0(0xd2)],{[Op['or']]:_['map'](_0x14a6ef[_0x2950b0(0xd9)],function(_0x36378f){const _0x43d6c3=_0x2950b0,_0x40838e={};return _0x40838e[_0x36378f]={[Op[_0x43d6c3(0xe2)]]:'%'+_0x1815fc[_0x43d6c3(0xf2)][_0x43d6c3(0xe4)]+'%'},_0x40838e;})})),_0x14a6ef=_[_0x2950b0(0xef)]({},_0x14a6ef,_0x1815fc[_0x2950b0(0xa2)]),_0x25382d[_0x2950b0(0x98)](_0x14a6ef);})[_0x32bc89(0x9f)](function(_0xba3732){const _0x34fa12=_0x32bc89;if(_0xba3732)return _0x52d831=_0xba3732['length'],typeof _0x1815fc[_0x34fa12(0xf2)]['nolimit']===_0x34fa12(0x105)&&(_0x14a6ef['limit']=qs[_0x34fa12(0xa4)](_0x1815fc[_0x34fa12(0xf2)][_0x34fa12(0xa4)]),_0x14a6ef[_0x34fa12(0x100)]=qs[_0x34fa12(0x100)](_0x1815fc[_0x34fa12(0xf2)]['offset'])),_0x25382d['getAgents'](_0x14a6ef);})[_0x32bc89(0x9f)](function(_0x287efa){if(_0x287efa)return _0x287efa?{'count':_0x52d831,'rows':_0x287efa}:null;})[_0x32bc89(0x9f)](respondWithResult(_0x587e17,null))[_0x32bc89(0xd5)](handleError(_0x587e17,null));};
\ No newline at end of file