Built motion from commit 8dca541896b0ff92bb88a36cc13f4f385b593b4b. Version 3.0.0...
[motion-next.git] / server / api / team / team.controller.js
index 0ef2dc8..9f34f88 100644 (file)
@@ -1 +1 @@
-const a626_0x43ba=['Voice','capitalize','remove','sendStatus','fieldName','Team','model','../../mysqldb','rows','attributes','UserVoiceQueueRt','interface','sort','api','upsert','addQueues','removeQueues','voicePause','userTeam:save','lodash','VIRTUAL','end','options','destroy','Sms','ids','User','limit','params','online','sms','Fax','filter','../../components/parsers/qs','create','map','toLowerCase','send','addAgents','../../rediscache','Whatsapp','voice','body','mail','role','set','order','channel','get','length','fields','merge','offset','emit','then','./team.socket','Mail','format','Unknown\x20channel','Unable\x20to\x20retrieve\x20the\x20current\x20user','includeAll','findAll','catch','include','keys','../../config/logger','pick','type','error','intersection','Queues','removeAgents','show','../../config/utils','Queue','index','isArray','Openchannel','isNil','update','json','status','add','Teams','query','each','UserProfileResource','getAgents','undefined','name','userTeam:remove','where','count','filters','user','findOne','rawAttributes','Chat','nolimit','chat'];(function(_0x514a44,_0x43ba6c){const _0x13b06e=function(_0x4c5b34){while(--_0x4c5b34){_0x514a44['push'](_0x514a44['shift']());}};_0x13b06e(++_0x43ba6c);}(a626_0x43ba,0xe6));const a626_0x13b0=function(_0x514a44,_0x43ba6c){_0x514a44=_0x514a44-0x0;let _0x13b06e=a626_0x43ba[_0x514a44];return _0x13b06e;};const _0x272286=a626_0x13b0;'use strict';const util=require('util'),_=require(_0x272286('0x59')),qs=require(_0x272286('0x3')),logger=require(_0x272286('0x23'))(_0x272286('0x53')),utils=require(_0x272286('0x2b')),{getSocket}=require(_0x272286('0x9')),socket=getSocket(),db=require(_0x272286('0x4d'))['db'],{Op,ValidationError}=require('sequelize');require(_0x272286('0x19'))['register'](socket);function respondWithStatusCode(_0x4c5b34,_0x52631b){return _0x52631b=_0x52631b||0xcc,function(_0x1cfbee){const _0x35e7ce=a626_0x13b0;if(_0x1cfbee)return _0x4c5b34['sendStatus'](_0x52631b);return _0x4c5b34[_0x35e7ce('0x33')](_0x52631b)[_0x35e7ce('0x5b')]();};}function respondWithResult(_0x46b088,_0x23f33d){return _0x23f33d=_0x23f33d||0xc8,function(_0x444935){const _0x5d95e6=a626_0x13b0;if(_0x444935)return _0x46b088[_0x5d95e6('0x33')](_0x23f33d)[_0x5d95e6('0x32')](_0x444935);};}function respondWithFilteredResult(_0x4c7386,_0x4c30a0){return function(_0x2e8ba9){const _0x491e67=a626_0x13b0;if(_0x2e8ba9){const _0x13ed0f=_0x2e8ba9['count'],_0x2899c8=_0x4c30a0[_0x491e67('0x16')];let _0x635ceb=_0x4c30a0[_0x491e67('0x16')]+_0x4c30a0[_0x491e67('0x61')],_0x367c20;return _0x635ceb>=_0x13ed0f?(_0x635ceb=_0x13ed0f,_0x367c20=0xc8):_0x367c20=0xce,_0x4c7386[_0x491e67('0x33')](_0x367c20),_0x4c7386[_0x491e67('0xf')]('Content-Range',_0x2899c8+'-'+_0x635ceb+'/'+_0x13ed0f)['json'](_0x2e8ba9);}return null;};}function saveUpdates(_0x1eb985){return function(_0x3c6151){const _0x46b538=a626_0x13b0;if(_0x3c6151)return _0x3c6151['update'](_0x1eb985)[_0x46b538('0x18')](function(_0x214f5b){return _0x214f5b;});return null;};}function removeEntity(_0x1ad95a){return function(_0x54bec9){const _0x228a79=a626_0x13b0;if(_0x54bec9)return _0x54bec9['destroy']()['then'](function(){const _0x2226cc=a626_0x13b0,_0x3b53fa=_0x54bec9[_0x2226cc('0x12')]({'plain':!![]}),_0x2231ba=_0x2226cc('0x35');return db[_0x2226cc('0x38')][_0x2226cc('0x5d')]({'where':{'type':_0x2231ba,'resourceId':_0x3b53fa['id']}})[_0x2226cc('0x18')](function(){return _0x54bec9;});})[_0x228a79('0x18')](function(){const _0x567211=_0x228a79;_0x1ad95a['status'](0xcc)[_0x567211('0x5b')]();});};}function handleEntityNotFound(_0x239842){return function(_0x22c2ff){const _0x4295bf=a626_0x13b0;return!_0x22c2ff&&_0x239842[_0x4295bf('0x49')](0x194),_0x22c2ff;};}function handleError(_0x4f61e7,_0x55cfed){return _0x55cfed=_0x55cfed||0x1f4,function(_0x5e64c2){const _0x168e9f=a626_0x13b0;logger[_0x168e9f('0x26')](_0x5e64c2['stack']),_0x5e64c2[_0x168e9f('0x3b')]&&delete _0x5e64c2[_0x168e9f('0x3b')],_0x4f61e7[_0x168e9f('0x33')](_0x55cfed)[_0x168e9f('0x7')](_0x5e64c2);};}exports[_0x272286('0x2d')]=function(_0x435cf4,_0x13d93a){const _0x254741=_0x272286;let _0x3f0439={};const _0x30156d={},_0x44efea={'count':0x0,'rows':[]},_0x58db1e=_[_0x254741('0x5')](db[_0x254741('0x4b')][_0x254741('0x42')],function(_0x3a73e9){const _0x39d53c=_0x254741;return{'name':_0x3a73e9[_0x39d53c('0x4a')],'type':_0x3a73e9[_0x39d53c('0x25')]['key']};});_0x30156d[_0x254741('0x4c')]=_[_0x254741('0x5')](_0x58db1e,_0x254741('0x3b')),_0x30156d[_0x254741('0x36')]=_['keys'](_0x435cf4['query']),_0x30156d[_0x254741('0x3f')]=_['intersection'](_0x30156d[_0x254741('0x4c')],_0x30156d['query']),_0x3f0439[_0x254741('0x4f')]=_[_0x254741('0x27')](_0x30156d[_0x254741('0x4c')],qs[_0x254741('0x14')](_0x435cf4['query'][_0x254741('0x14')])),_0x3f0439['attributes']=_0x3f0439[_0x254741('0x4f')]['length']?_0x3f0439['attributes']:_0x30156d['model'];typeof _0x435cf4[_0x254741('0x36')]['nolimit']==='undefined'&&(_0x3f0439[_0x254741('0x61')]=qs[_0x254741('0x61')](_0x435cf4[_0x254741('0x36')][_0x254741('0x61')]),_0x3f0439[_0x254741('0x16')]=qs[_0x254741('0x16')](_0x435cf4[_0x254741('0x36')][_0x254741('0x16')]));_0x3f0439[_0x254741('0x10')]=qs[_0x254741('0x52')](_0x435cf4[_0x254741('0x36')][_0x254741('0x52')]),_0x3f0439[_0x254741('0x3d')]=qs[_0x254741('0x3f')](_['pick'](_0x435cf4[_0x254741('0x36')],_0x30156d[_0x254741('0x3f')]),_0x58db1e);_0x435cf4[_0x254741('0x36')][_0x254741('0x2')]&&(_0x3f0439['where']=_[_0x254741('0x15')](_0x3f0439[_0x254741('0x3d')],{[Op['or']]:_[_0x254741('0x5')](_0x58db1e,function(_0x8a6550){const _0x1350e8=_0x254741;if(_0x8a6550[_0x1350e8('0x25')]!==_0x1350e8('0x5a')){const _0x2d99e6={};return _0x2d99e6[_0x8a6550['name']]={[Op['like']]:'%'+_0x435cf4[_0x1350e8('0x36')][_0x1350e8('0x2')]+'%'},_0x2d99e6;}})}));_0x3f0439=_['merge']({},_0x3f0439,_0x435cf4[_0x254741('0x5c')]);const _0x157515={'where':_0x3f0439[_0x254741('0x3d')]};return db[_0x254741('0x4b')][_0x254741('0x3e')](_0x157515)[_0x254741('0x18')](function(_0x5dad05){const _0x425534=_0x254741;return _0x44efea[_0x425534('0x3e')]=_0x5dad05,_0x435cf4[_0x425534('0x36')]['includeAll']&&(_0x3f0439[_0x425534('0x21')]=[{'all':!![]}]),db['Team'][_0x425534('0x1f')](_0x3f0439);})[_0x254741('0x18')](function(_0x445be8){const _0x427d95=_0x254741;return _0x44efea[_0x427d95('0x4e')]=_0x445be8,_0x44efea;})[_0x254741('0x18')](respondWithFilteredResult(_0x13d93a,_0x3f0439))[_0x254741('0x20')](handleError(_0x13d93a,null));},exports[_0x272286('0x2a')]=function(_0x404d3f,_0x46bb34){const _0x1e3e39=_0x272286;let _0x3d2ce8={'raw':![],'where':{'id':_0x404d3f[_0x1e3e39('0x62')]['id']}};const _0x5db454={};return _0x5db454[_0x1e3e39('0x4c')]=_['keys'](db['Team']['rawAttributes']),_0x5db454[_0x1e3e39('0x36')]=_[_0x1e3e39('0x22')](_0x404d3f['query']),_0x5db454['filters']=_[_0x1e3e39('0x27')](_0x5db454['model'],_0x5db454['query']),_0x3d2ce8[_0x1e3e39('0x4f')]=_['intersection'](_0x5db454['model'],qs['fields'](_0x404d3f[_0x1e3e39('0x36')]['fields'])),_0x3d2ce8[_0x1e3e39('0x4f')]=_0x3d2ce8['attributes'][_0x1e3e39('0x13')]?_0x3d2ce8[_0x1e3e39('0x4f')]:_0x5db454[_0x1e3e39('0x4c')],_0x404d3f[_0x1e3e39('0x36')][_0x1e3e39('0x1e')]&&(_0x3d2ce8[_0x1e3e39('0x21')]=[{'all':!![]}]),_0x3d2ce8=_[_0x1e3e39('0x15')]({},_0x3d2ce8,_0x404d3f['options']),db[_0x1e3e39('0x4b')][_0x1e3e39('0x41')](_0x3d2ce8)['then'](handleEntityNotFound(_0x46bb34,null))['then'](respondWithResult(_0x46bb34,null))[_0x1e3e39('0x20')](handleError(_0x46bb34,null));},exports[_0x272286('0x4')]=function(_0x1c93f6,_0x3d558f){const _0x289572=_0x272286;return db[_0x289572('0x4b')][_0x289572('0x4')](_0x1c93f6[_0x289572('0xc')],{})[_0x289572('0x18')](function(_0x7c1d0a){const _0x3531f6=_0x289572,_0x3f0bc1=_0x1c93f6[_0x3531f6('0x40')][_0x3531f6('0x12')]({'plain':!![]});if(!_0x3f0bc1)throw new Error(_0x3531f6('0x1d'));if(_0x3f0bc1[_0x3531f6('0xe')]===_0x3531f6('0x40')){const _0x2b1515=_0x7c1d0a[_0x3531f6('0x12')]({'plain':!![]}),_0x1d3cea=_0x3531f6('0x35');return db['UserProfileSection'][_0x3531f6('0x41')]({'where':{'name':_0x1d3cea,'userProfileId':_0x3f0bc1['userProfileId']},'raw':!![]})[_0x3531f6('0x18')](function(_0x7cc7e0){const _0x25d9aa=_0x3531f6;return _0x7cc7e0&&_0x7cc7e0['autoAssociation']===0x0?db[_0x25d9aa('0x38')][_0x25d9aa('0x4')]({'name':_0x2b1515[_0x25d9aa('0x3b')],'resourceId':_0x2b1515['id'],'type':_0x7cc7e0['name'],'sectionId':_0x7cc7e0['id']},{})[_0x25d9aa('0x18')](function(){return _0x7c1d0a;}):_0x7c1d0a;})['catch'](function(_0x41b8e0){const _0x4ddc9f=_0x3531f6;logger[_0x4ddc9f('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41b8e0);throw _0x41b8e0;});}return _0x7c1d0a;})['then'](respondWithResult(_0x3d558f,0xc9))[_0x289572('0x20')](handleError(_0x3d558f,null));},exports[_0x272286('0x31')]=function(_0x914e10,_0x10141){const _0x330c18=_0x272286;return _0x914e10[_0x330c18('0xc')]['id']&&delete _0x914e10[_0x330c18('0xc')]['id'],db['Team']['findOne']({'where':{'id':_0x914e10[_0x330c18('0x62')]['id']}})[_0x330c18('0x18')](handleEntityNotFound(_0x10141,null))[_0x330c18('0x18')](saveUpdates(_0x914e10['body'],null))[_0x330c18('0x18')](respondWithResult(_0x10141,null))[_0x330c18('0x20')](handleError(_0x10141,null));},exports[_0x272286('0x5d')]=function(_0x306176,_0x18e01d){const _0x3266f6=_0x272286;return db['Team'][_0x3266f6('0x41')]({'where':{'id':_0x306176['params']['id']}})[_0x3266f6('0x18')](handleEntityNotFound(_0x18e01d,null))[_0x3266f6('0x18')](removeEntity(_0x18e01d,null))[_0x3266f6('0x20')](handleError(_0x18e01d,null));},exports['getQueues']=function(_0x42ae41,_0x15a25f){const _0x2fed6b=_0x272286;return db[_0x2fed6b('0x4b')][_0x2fed6b('0x41')]({'where':{'id':_0x42ae41['params']['id']}})[_0x2fed6b('0x18')](handleEntityNotFound(_0x15a25f,null))[_0x2fed6b('0x18')](function(_0x2ce43a){const _0x581134=_0x2fed6b;if(!_0x42ae41[_0x581134('0x36')][_0x581134('0x11')]||!utils['isValidChannel'](_0x42ae41[_0x581134('0x36')][_0x581134('0x11')]))throw new ValidationError(_0x581134('0x1c'));let _0x40d265={};const _0x575b5e={};return _0x575b5e[_0x581134('0x4c')]=_[_0x581134('0x22')](db[_[_0x581134('0x47')](_0x42ae41[_0x581134('0x36')][_0x581134('0x11')][_0x581134('0x6')]())+_0x581134('0x2c')][_0x581134('0x42')]),_0x575b5e['query']=_[_0x581134('0x22')](_0x42ae41[_0x581134('0x36')]),_0x575b5e[_0x581134('0x3f')]=_['intersection'](_0x575b5e[_0x581134('0x4c')],_0x575b5e[_0x581134('0x36')]),_0x40d265[_0x581134('0x4f')]=_[_0x581134('0x27')](_0x575b5e['model'],qs[_0x581134('0x14')](_0x42ae41['query'][_0x581134('0x14')])),_0x40d265[_0x581134('0x4f')]=_0x40d265['attributes'][_0x581134('0x13')]?_0x40d265[_0x581134('0x4f')]:_0x575b5e['model'],_0x40d265[_0x581134('0x61')]=qs['limit'](_0x42ae41[_0x581134('0x36')][_0x581134('0x61')]),_0x40d265['offset']=qs[_0x581134('0x16')](_0x42ae41['query'][_0x581134('0x16')]),_0x40d265[_0x581134('0x10')]=qs[_0x581134('0x52')](_0x42ae41[_0x581134('0x36')][_0x581134('0x52')]),_0x40d265[_0x581134('0x3d')]=qs[_0x581134('0x3f')](_['pick'](_0x42ae41[_0x581134('0x36')],_0x575b5e['filters'])),_0x40d265=_['merge']({},_0x40d265,_0x42ae41['options']),_0x2ce43a['get'+_[_0x581134('0x47')](_0x42ae41[_0x581134('0x36')][_0x581134('0x11')]['toLowerCase']())+'Queues'](_0x40d265);})[_0x2fed6b('0x18')](respondWithResult(_0x15a25f,null))[_0x2fed6b('0x20')](handleError(_0x15a25f,null));},exports[_0x272286('0x55')]=function(_0xe6414d,_0x3d7549){const _0x51e6e0=_0x272286;return db[_0x51e6e0('0x4b')]['findOne']({'where':{'id':_0xe6414d[_0x51e6e0('0x62')]['id']}})[_0x51e6e0('0x18')](function(_0x983387){const _0x36276d=_0x51e6e0;if(_0x983387){if(!_0xe6414d['body']['channel']||!utils['isValidChannel'](_0xe6414d[_0x36276d('0xc')][_0x36276d('0x11')]))throw new ValidationError(_0x36276d('0x1c'));return _0x983387[_0x36276d('0x34')+_[_0x36276d('0x47')](_0xe6414d['body'][_0x36276d('0x11')][_0x36276d('0x6')]())+'Queues'](_0xe6414d[_0x36276d('0xc')]['ids']);}return null;})['then'](handleEntityNotFound(_0x3d7549,null))['then'](respondWithStatusCode(_0x3d7549,null))[_0x51e6e0('0x20')](handleError(_0x3d7549,null));},exports[_0x272286('0x56')]=function(_0x2da849,_0x59f698){const _0x85849a=_0x272286;return db[_0x85849a('0x4b')][_0x85849a('0x41')]({'where':{'id':_0x2da849['params']['id']}})['then'](function(_0xdeb9fa){const _0x243465=_0x85849a;if(_0xdeb9fa){if(!_0x2da849['query'][_0x243465('0x11')]||!utils['isValidChannel'](_0x2da849['query'][_0x243465('0x11')]))throw new ValidationError(_0x243465('0x1c'));return _0xdeb9fa[_0x243465('0x48')+_[_0x243465('0x47')](_0x2da849['query'][_0x243465('0x11')][_0x243465('0x6')]())+'Queues'](_0x2da849[_0x243465('0x36')][_0x243465('0x5f')]);}return null;})[_0x85849a('0x18')](handleEntityNotFound(_0x59f698,null))[_0x85849a('0x18')](respondWithStatusCode(_0x59f698,null))[_0x85849a('0x20')](handleError(_0x59f698,null));},exports[_0x272286('0x8')]=function(_0x3a99a8,_0x3d04b2){const _0x566391=_0x272286;return db[_0x566391('0x4b')]['findOne']({'where':{'id':_0x3a99a8['params']['id']}})[_0x566391('0x18')](function(_0x16fab7){const _0x5ec3a4=_0x566391;if(_0x16fab7){const _0xd78cff=[_0x5ec3a4('0x46'),_0x5ec3a4('0x43'),_0x5ec3a4('0x1a'),_0x5ec3a4('0x5e'),_0x5ec3a4('0x1'),_0x5ec3a4('0x2f'),_0x5ec3a4('0xa')];return Promise[_0x5ec3a4('0x37')](_0xd78cff,function(_0x1e34e1){const _0x52ef31=_0x5ec3a4;return _0x16fab7[_0x52ef31('0x12')+_0x1e34e1+_0x52ef31('0x28')]({'attributes':['id',_0x52ef31('0x3b')]})[_0x52ef31('0x18')](function(_0x4c022a){const _0x5a2380=_0x52ef31;return Promise[_0x5a2380('0x37')](_0x4c022a,function(_0x529428){const _0x2379b7=_0x5a2380;return _0x529428['addAgents'](_0x3a99a8['body']['ids'])[_0x2379b7('0x18')](function(){const _0x251a67=_0x2379b7;if(_0x1e34e1===_0x251a67('0x46'))return db[_0x251a67('0x60')]['findAll']({'where':{'id':_0x3a99a8['body']['ids']},'attributes':['id',_0x251a67('0x3b'),_0x251a67('0x63'),_0x251a67('0x57'),_0x251a67('0x51')],'raw':!![]})[_0x251a67('0x18')](function(_0x281bd7){const _0x242bd8=_0x251a67;return Promise[_0x242bd8('0x37')](_['filter'](_0x281bd7,{'online':0x1}),function(_0x49e527){const _0x67ee57=_0x242bd8;return db['UserVoiceQueueRt'][_0x67ee57('0x54')]({'membername':_0x49e527[_0x67ee57('0x3b')],'UserId':_0x49e527['id'],'queue_name':_0x529428['name'],'VoiceQueueId':_0x529428['id'],'interface':_[_0x67ee57('0x30')](_0x49e527[_0x67ee57('0x51')])?util[_0x67ee57('0x1b')]('SIP/%s',_0x49e527[_0x67ee57('0x3b')]):_0x49e527[_0x67ee57('0x51')],'paused':_0x49e527[_0x67ee57('0x57')]||![],'penalty':0x0});});});});});})[_0x52ef31('0x18')](function(){return _0x16fab7;});})[_0x5ec3a4('0x18')](function(){return _0x16fab7;});}})[_0x566391('0x18')](function(_0x376342){const _0x48fad6=_0x566391;if(_0x376342)return _0x376342[_0x48fad6('0x8')](_0x3a99a8[_0x48fad6('0xc')][_0x48fad6('0x5f')],{'through':_['omit'](_0x3a99a8[_0x48fad6('0xc')],[_0x48fad6('0x5f'),'id'])})['then'](function(_0x307d8e){const _0x31d10d=_0x48fad6;for(let _0x320f0c=0x0;_0x320f0c<_0x3a99a8['body']['ids'][_0x31d10d('0x13')];_0x320f0c+=0x1){socket[_0x31d10d('0x17')](_0x31d10d('0x58'),{'UserId':_0x3a99a8[_0x31d10d('0xc')][_0x31d10d('0x5f')][_0x320f0c],'TeamId':_0x3a99a8[_0x31d10d('0x62')]['id']});}return _0x307d8e;});})[_0x566391('0x18')](respondWithResult(_0x3d04b2,null))[_0x566391('0x20')](handleError(_0x3d04b2,null));},exports[_0x272286('0x29')]=function(_0x563170,_0x58fefc){const _0x570d00=_0x272286;return db[_0x570d00('0x4b')]['findOne']({'where':{'id':_0x563170[_0x570d00('0x62')]['id']}})[_0x570d00('0x18')](handleEntityNotFound(_0x58fefc,null))['then'](function(_0x49eae0){const _0x55b316=_0x570d00;if(_0x49eae0)return Promise['each']([_0x55b316('0xb'),_0x55b316('0x45'),_0x55b316('0xd'),_0x55b316('0x0'),'fax','openchannel','whatsapp'],function(_0x47003d){const _0x5a72ab=_0x55b316;return _0x49eae0[_0x5a72ab('0x12')+_[_0x5a72ab('0x47')](_0x47003d)+_0x5a72ab('0x28')]({'attributes':['id',_0x5a72ab('0x3b')]})[_0x5a72ab('0x18')](function(_0x3d8361){const _0xbf2ec6=_0x5a72ab;return Promise[_0xbf2ec6('0x37')](_0x3d8361,function(_0x25caf7){const _0x3a791b=_0xbf2ec6;return _0x25caf7[_0x3a791b('0x29')](_0x563170[_0x3a791b('0x36')]['ids'])[_0x3a791b('0x18')](function(){const _0x5de1b5=_0x3a791b;if(_0x47003d===_0x5de1b5('0xb'))return db[_0x5de1b5('0x50')]['destroy']({'where':{'VoiceQueueId':_0x25caf7['id'],'UserId':_0x563170[_0x5de1b5('0x36')]['ids']}});});});})[_0x5a72ab('0x18')](function(){return _0x49eae0;});})[_0x55b316('0x18')](function(){return _0x49eae0;});})['then'](function(_0x23cf55){const _0x113335=_0x570d00;if(_0x23cf55)return _0x23cf55['removeAgents'](_0x563170[_0x113335('0x36')][_0x113335('0x5f')])[_0x113335('0x18')](function(){const _0x1498d7=_0x113335;if(_[_0x1498d7('0x2e')](_0x563170['query']['ids']))for(let _0x280afa=0x0;_0x280afa<_0x563170[_0x1498d7('0x36')][_0x1498d7('0x5f')]['length'];_0x280afa+=0x1){socket[_0x1498d7('0x17')](_0x1498d7('0x3c'),{'UserId':Number(_0x563170[_0x1498d7('0x36')]['ids'][_0x280afa]),'TeamId':Number(_0x563170[_0x1498d7('0x62')]['id'])});}else socket['emit'](_0x1498d7('0x3c'),{'UserId':Number(_0x563170[_0x1498d7('0x36')][_0x1498d7('0x5f')]),'TeamId':Number(_0x563170[_0x1498d7('0x62')]['id'])});});})[_0x570d00('0x18')](respondWithStatusCode(_0x58fefc,null))[_0x570d00('0x20')](handleError(_0x58fefc,null));},exports[_0x272286('0x39')]=function(_0x17f7f0,_0x53c64b){const _0x5d48b5=_0x272286;let _0x1f8b50={};const _0xc8c44b={};let _0x5218fc,_0x27c0b0;return db['Team'][_0x5d48b5('0x41')]({'where':{'id':_0x17f7f0[_0x5d48b5('0x62')]['id']}})[_0x5d48b5('0x18')](handleEntityNotFound(_0x53c64b,null))[_0x5d48b5('0x18')](function(_0x17c409){const _0x2e0035=_0x5d48b5;if(_0x17c409)return _0x5218fc=_0x17c409,_0xc8c44b[_0x2e0035('0x4c')]=_[_0x2e0035('0x22')](db[_0x2e0035('0x60')][_0x2e0035('0x42')]),_0xc8c44b[_0x2e0035('0x36')]=_[_0x2e0035('0x22')](_0x17f7f0[_0x2e0035('0x36')]),_0xc8c44b[_0x2e0035('0x3f')]=_[_0x2e0035('0x27')](_0xc8c44b['model'],_0xc8c44b['query']),_0x1f8b50[_0x2e0035('0x4f')]=_[_0x2e0035('0x27')](_0xc8c44b['model'],qs[_0x2e0035('0x14')](_0x17f7f0['query'][_0x2e0035('0x14')])),_0x1f8b50[_0x2e0035('0x4f')]=_0x1f8b50[_0x2e0035('0x4f')]['length']?_0x1f8b50[_0x2e0035('0x4f')]:_0xc8c44b[_0x2e0035('0x4c')],_0x1f8b50[_0x2e0035('0x10')]=qs[_0x2e0035('0x52')](_0x17f7f0[_0x2e0035('0x36')][_0x2e0035('0x52')]),_0x1f8b50[_0x2e0035('0x3d')]=qs[_0x2e0035('0x3f')](_[_0x2e0035('0x24')](_0x17f7f0[_0x2e0035('0x36')],_0xc8c44b[_0x2e0035('0x3f')])),_0x17f7f0[_0x2e0035('0x36')][_0x2e0035('0x2')]&&(_0x1f8b50[_0x2e0035('0x3d')]=_[_0x2e0035('0x15')](_0x1f8b50[_0x2e0035('0x3d')],{[Op['or']]:_[_0x2e0035('0x5')](_0x1f8b50[_0x2e0035('0x4f')],function(_0x13d22a){const _0x228a3d=_0x2e0035,_0x47ebb4={};return _0x47ebb4[_0x13d22a]={[Op['like']]:'%'+_0x17f7f0['query'][_0x228a3d('0x2')]+'%'},_0x47ebb4;})})),_0x1f8b50=_[_0x2e0035('0x15')]({},_0x1f8b50,_0x17f7f0[_0x2e0035('0x5c')]),_0x5218fc[_0x2e0035('0x39')](_0x1f8b50);})['then'](function(_0x3733db){const _0x3c4c07=_0x5d48b5;if(_0x3733db)return _0x27c0b0=_0x3733db[_0x3c4c07('0x13')],typeof _0x17f7f0[_0x3c4c07('0x36')][_0x3c4c07('0x44')]===_0x3c4c07('0x3a')&&(_0x1f8b50[_0x3c4c07('0x61')]=qs[_0x3c4c07('0x61')](_0x17f7f0['query']['limit']),_0x1f8b50[_0x3c4c07('0x16')]=qs[_0x3c4c07('0x16')](_0x17f7f0['query']['offset'])),_0x5218fc[_0x3c4c07('0x39')](_0x1f8b50);})[_0x5d48b5('0x18')](function(_0x22be32){if(_0x22be32)return _0x22be32?{'count':_0x27c0b0,'rows':_0x22be32}:null;})[_0x5d48b5('0x18')](respondWithResult(_0x53c64b,null))[_0x5d48b5('0x20')](handleError(_0x53c64b,null));};
\ No newline at end of file
+const a626_0x27aa=['ids','../../mysqldb','undefined','fieldName','include','keys','Teams','length','./team.socket','online','userTeam:remove','name','show','merge','count','sequelize','sms','body','../../components/parsers/qs','addQueues','mail','User','chat','autoAssociation','Unknown\x20channel','sort','get','capitalize','Unable\x20to\x20retrieve\x20the\x20current\x20user','Mail','Queues','model','remove','voicePause','key','rawAttributes','upsert','where','Fax','register','isValidChannel','intersection','Team','omit','map','rows','findOne','isArray','Openchannel','fax','toLowerCase','json','query','UserProfileSection','sendStatus','Voice','limit','nolimit','userTeam:save','options','Whatsapp','lodash','status','end','UserVoiceQueueRt','offset','filter','update','openchannel','emit','removeQueues','error','isNil','removeAgents','attributes','pick','voice','filters','includeAll','channel','../../config/logger','destroy','Sms','../../config/utils','each','user','set','getAgents','whatsapp','params','VIRTUAL','catch','role','create','UserProfileResource','type','then','Chat','Content-Range','send','interface','userProfileId','index','addAgents','fields','findAll'];(function(_0xc44687,_0x27aa2b){const _0xc10cf3=function(_0x5458f){while(--_0x5458f){_0xc44687['push'](_0xc44687['shift']());}};_0xc10cf3(++_0x27aa2b);}(a626_0x27aa,0xce));const a626_0xc10c=function(_0xc44687,_0x27aa2b){_0xc44687=_0xc44687-0x0;let _0xc10cf3=a626_0x27aa[_0xc44687];return _0xc10cf3;};const _0x1e0939=a626_0xc10c;'use strict';const util=require('util'),_=require(_0x1e0939('0x43')),qs=require(_0x1e0939('0x18')),logger=require(_0x1e0939('0x56'))('api'),utils=require(_0x1e0939('0x59')),{getSocket}=require('../../rediscache'),socket=getSocket(),db=require(_0x1e0939('0x7'))['db'],{Op,ValidationError}=require(_0x1e0939('0x15'));require(_0x1e0939('0xe'))[_0x1e0939('0x2d')](socket);function respondWithStatusCode(_0x5458f,_0x4b758d){return _0x4b758d=_0x4b758d||0xcc,function(_0x589571){const _0x3eae06=a626_0xc10c;if(_0x589571)return _0x5458f[_0x3eae06('0x3c')](_0x4b758d);return _0x5458f[_0x3eae06('0x44')](_0x4b758d)[_0x3eae06('0x45')]();};}function respondWithResult(_0x1a4daf,_0x1f17f7){return _0x1f17f7=_0x1f17f7||0xc8,function(_0x14e855){const _0x4fea68=a626_0xc10c;if(_0x14e855)return _0x1a4daf[_0x4fea68('0x44')](_0x1f17f7)[_0x4fea68('0x39')](_0x14e855);};}function respondWithFilteredResult(_0x5338ac,_0x44aa31){return function(_0x55c0c6){const _0x15523b=a626_0xc10c;if(_0x55c0c6){const _0x43ba1e=_0x55c0c6[_0x15523b('0x14')],_0x2f5e01=_0x44aa31['offset'];let _0x54b6d0=_0x44aa31[_0x15523b('0x47')]+_0x44aa31['limit'],_0x38280a;return _0x54b6d0>=_0x43ba1e?(_0x54b6d0=_0x43ba1e,_0x38280a=0xc8):_0x38280a=0xce,_0x5338ac[_0x15523b('0x44')](_0x38280a),_0x5338ac[_0x15523b('0x5c')](_0x15523b('0x68'),_0x2f5e01+'-'+_0x54b6d0+'/'+_0x43ba1e)[_0x15523b('0x39')](_0x55c0c6);}return null;};}function saveUpdates(_0x1e2200){return function(_0x344525){const _0x787ac5=a626_0xc10c;if(_0x344525)return _0x344525['update'](_0x1e2200)[_0x787ac5('0x66')](function(_0x45a2d8){return _0x45a2d8;});return null;};}function removeEntity(_0x5135d0){return function(_0x1f5db4){const _0x495b9e=a626_0xc10c;if(_0x1f5db4)return _0x1f5db4['destroy']()['then'](function(){const _0x23c79f=a626_0xc10c,_0x22e46f=_0x1f5db4['get']({'plain':!![]}),_0xb30909='Teams';return db['UserProfileResource'][_0x23c79f('0x57')]({'where':{'type':_0xb30909,'resourceId':_0x22e46f['id']}})[_0x23c79f('0x66')](function(){return _0x1f5db4;});})[_0x495b9e('0x66')](function(){const _0x493c42=_0x495b9e;_0x5135d0['status'](0xcc)[_0x493c42('0x45')]();});};}function handleEntityNotFound(_0x40cbbd){return function(_0x257a17){const _0x37db9d=a626_0xc10c;return!_0x257a17&&_0x40cbbd[_0x37db9d('0x3c')](0x194),_0x257a17;};}function handleError(_0x10fb77,_0x5182c1){return _0x5182c1=_0x5182c1||0x1f4,function(_0xe9c9b0){const _0x5d8592=a626_0xc10c;logger[_0x5d8592('0x4d')](_0xe9c9b0['stack']),_0xe9c9b0['name']&&delete _0xe9c9b0[_0x5d8592('0x11')],_0x10fb77[_0x5d8592('0x44')](_0x5182c1)[_0x5d8592('0x69')](_0xe9c9b0);};}exports[_0x1e0939('0x2')]=function(_0x3e7cbb,_0x1f753a){const _0xf7bb9a=_0x1e0939;let _0x4da381={};const _0x5b0918={},_0x2bc135={'count':0x0,'rows':[]},_0x3de6ad=_[_0xf7bb9a('0x32')](db['Team'][_0xf7bb9a('0x29')],function(_0x4ab888){const _0x16d34b=_0xf7bb9a;return{'name':_0x4ab888[_0x16d34b('0x9')],'type':_0x4ab888[_0x16d34b('0x65')][_0x16d34b('0x28')]};});_0x5b0918['model']=_[_0xf7bb9a('0x32')](_0x3de6ad,_0xf7bb9a('0x11')),_0x5b0918[_0xf7bb9a('0x3a')]=_[_0xf7bb9a('0xb')](_0x3e7cbb[_0xf7bb9a('0x3a')]),_0x5b0918[_0xf7bb9a('0x53')]=_[_0xf7bb9a('0x2f')](_0x5b0918['model'],_0x5b0918[_0xf7bb9a('0x3a')]),_0x4da381[_0xf7bb9a('0x50')]=_[_0xf7bb9a('0x2f')](_0x5b0918[_0xf7bb9a('0x25')],qs[_0xf7bb9a('0x4')](_0x3e7cbb[_0xf7bb9a('0x3a')][_0xf7bb9a('0x4')])),_0x4da381[_0xf7bb9a('0x50')]=_0x4da381[_0xf7bb9a('0x50')][_0xf7bb9a('0xd')]?_0x4da381[_0xf7bb9a('0x50')]:_0x5b0918[_0xf7bb9a('0x25')];typeof _0x3e7cbb[_0xf7bb9a('0x3a')][_0xf7bb9a('0x3f')]===_0xf7bb9a('0x8')&&(_0x4da381[_0xf7bb9a('0x3e')]=qs['limit'](_0x3e7cbb[_0xf7bb9a('0x3a')]['limit']),_0x4da381[_0xf7bb9a('0x47')]=qs[_0xf7bb9a('0x47')](_0x3e7cbb[_0xf7bb9a('0x3a')][_0xf7bb9a('0x47')]));_0x4da381['order']=qs[_0xf7bb9a('0x1f')](_0x3e7cbb[_0xf7bb9a('0x3a')][_0xf7bb9a('0x1f')]),_0x4da381['where']=qs[_0xf7bb9a('0x53')](_[_0xf7bb9a('0x51')](_0x3e7cbb[_0xf7bb9a('0x3a')],_0x5b0918[_0xf7bb9a('0x53')]),_0x3de6ad);_0x3e7cbb[_0xf7bb9a('0x3a')][_0xf7bb9a('0x48')]&&(_0x4da381[_0xf7bb9a('0x2b')]=_['merge'](_0x4da381[_0xf7bb9a('0x2b')],{[Op['or']]:_[_0xf7bb9a('0x32')](_0x3de6ad,function(_0x860498){const _0x299b69=_0xf7bb9a;if(_0x860498[_0x299b69('0x65')]!==_0x299b69('0x60')){const _0x3d4a4a={};return _0x3d4a4a[_0x860498['name']]={[Op['like']]:'%'+_0x3e7cbb['query'][_0x299b69('0x48')]+'%'},_0x3d4a4a;}})}));_0x4da381=_[_0xf7bb9a('0x13')]({},_0x4da381,_0x3e7cbb[_0xf7bb9a('0x41')]);const _0x3fcba7={'where':_0x4da381[_0xf7bb9a('0x2b')]};return db[_0xf7bb9a('0x30')][_0xf7bb9a('0x14')](_0x3fcba7)['then'](function(_0x14b464){const _0x102763=_0xf7bb9a;return _0x2bc135[_0x102763('0x14')]=_0x14b464,_0x3e7cbb[_0x102763('0x3a')][_0x102763('0x54')]&&(_0x4da381[_0x102763('0xa')]=[{'all':!![]}]),db[_0x102763('0x30')]['findAll'](_0x4da381);})[_0xf7bb9a('0x66')](function(_0x5e7f9b){const _0x102821=_0xf7bb9a;return _0x2bc135[_0x102821('0x33')]=_0x5e7f9b,_0x2bc135;})['then'](respondWithFilteredResult(_0x1f753a,_0x4da381))['catch'](handleError(_0x1f753a,null));},exports[_0x1e0939('0x12')]=function(_0x440098,_0x384a39){const _0x54c234=_0x1e0939;let _0x1257cb={'raw':![],'where':{'id':_0x440098[_0x54c234('0x5f')]['id']}};const _0x303100={};return _0x303100['model']=_[_0x54c234('0xb')](db[_0x54c234('0x30')][_0x54c234('0x29')]),_0x303100[_0x54c234('0x3a')]=_[_0x54c234('0xb')](_0x440098[_0x54c234('0x3a')]),_0x303100[_0x54c234('0x53')]=_[_0x54c234('0x2f')](_0x303100['model'],_0x303100[_0x54c234('0x3a')]),_0x1257cb[_0x54c234('0x50')]=_[_0x54c234('0x2f')](_0x303100[_0x54c234('0x25')],qs[_0x54c234('0x4')](_0x440098['query'][_0x54c234('0x4')])),_0x1257cb[_0x54c234('0x50')]=_0x1257cb['attributes'][_0x54c234('0xd')]?_0x1257cb['attributes']:_0x303100[_0x54c234('0x25')],_0x440098['query'][_0x54c234('0x54')]&&(_0x1257cb['include']=[{'all':!![]}]),_0x1257cb=_[_0x54c234('0x13')]({},_0x1257cb,_0x440098[_0x54c234('0x41')]),db[_0x54c234('0x30')][_0x54c234('0x34')](_0x1257cb)[_0x54c234('0x66')](handleEntityNotFound(_0x384a39,null))[_0x54c234('0x66')](respondWithResult(_0x384a39,null))['catch'](handleError(_0x384a39,null));},exports['create']=function(_0x2fda69,_0x293066){const _0x140371=_0x1e0939;return db[_0x140371('0x30')][_0x140371('0x63')](_0x2fda69[_0x140371('0x17')],{})[_0x140371('0x66')](function(_0x27b824){const _0x18f511=_0x140371,_0x4f0986=_0x2fda69[_0x18f511('0x5b')][_0x18f511('0x20')]({'plain':!![]});if(!_0x4f0986)throw new Error(_0x18f511('0x22'));if(_0x4f0986[_0x18f511('0x62')]===_0x18f511('0x5b')){const _0x515884=_0x27b824['get']({'plain':!![]}),_0x57f9b5=_0x18f511('0xc');return db[_0x18f511('0x3b')]['findOne']({'where':{'name':_0x57f9b5,'userProfileId':_0x4f0986[_0x18f511('0x1')]},'raw':!![]})[_0x18f511('0x66')](function(_0x460e00){const _0x91ebd=_0x18f511;return _0x460e00&&_0x460e00[_0x91ebd('0x1d')]===0x0?db[_0x91ebd('0x64')][_0x91ebd('0x63')]({'name':_0x515884[_0x91ebd('0x11')],'resourceId':_0x515884['id'],'type':_0x460e00['name'],'sectionId':_0x460e00['id']},{})['then'](function(){return _0x27b824;}):_0x27b824;})[_0x18f511('0x61')](function(_0x5c1592){const _0x201edd=_0x18f511;logger[_0x201edd('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c1592);throw _0x5c1592;});}return _0x27b824;})[_0x140371('0x66')](respondWithResult(_0x293066,0xc9))['catch'](handleError(_0x293066,null));},exports[_0x1e0939('0x49')]=function(_0x3792e5,_0x1e24d2){const _0x55913f=_0x1e0939;return _0x3792e5[_0x55913f('0x17')]['id']&&delete _0x3792e5['body']['id'],db[_0x55913f('0x30')][_0x55913f('0x34')]({'where':{'id':_0x3792e5['params']['id']}})[_0x55913f('0x66')](handleEntityNotFound(_0x1e24d2,null))[_0x55913f('0x66')](saveUpdates(_0x3792e5[_0x55913f('0x17')],null))[_0x55913f('0x66')](respondWithResult(_0x1e24d2,null))[_0x55913f('0x61')](handleError(_0x1e24d2,null));},exports[_0x1e0939('0x57')]=function(_0x458b0b,_0x168949){const _0x2d875b=_0x1e0939;return db['Team'][_0x2d875b('0x34')]({'where':{'id':_0x458b0b[_0x2d875b('0x5f')]['id']}})[_0x2d875b('0x66')](handleEntityNotFound(_0x168949,null))[_0x2d875b('0x66')](removeEntity(_0x168949,null))[_0x2d875b('0x61')](handleError(_0x168949,null));},exports['getQueues']=function(_0x464d47,_0x20459b){const _0x22211a=_0x1e0939;return db[_0x22211a('0x30')][_0x22211a('0x34')]({'where':{'id':_0x464d47['params']['id']}})[_0x22211a('0x66')](handleEntityNotFound(_0x20459b,null))[_0x22211a('0x66')](function(_0x5226fc){const _0x4a0138=_0x22211a;if(!_0x464d47[_0x4a0138('0x3a')][_0x4a0138('0x55')]||!utils['isValidChannel'](_0x464d47[_0x4a0138('0x3a')][_0x4a0138('0x55')]))throw new ValidationError(_0x4a0138('0x1e'));let _0x300e51={};const _0x13b1e8={};return _0x13b1e8['model']=_[_0x4a0138('0xb')](db[_[_0x4a0138('0x21')](_0x464d47[_0x4a0138('0x3a')][_0x4a0138('0x55')][_0x4a0138('0x38')]())+'Queue'][_0x4a0138('0x29')]),_0x13b1e8[_0x4a0138('0x3a')]=_[_0x4a0138('0xb')](_0x464d47[_0x4a0138('0x3a')]),_0x13b1e8['filters']=_['intersection'](_0x13b1e8[_0x4a0138('0x25')],_0x13b1e8['query']),_0x300e51[_0x4a0138('0x50')]=_[_0x4a0138('0x2f')](_0x13b1e8[_0x4a0138('0x25')],qs['fields'](_0x464d47[_0x4a0138('0x3a')][_0x4a0138('0x4')])),_0x300e51[_0x4a0138('0x50')]=_0x300e51[_0x4a0138('0x50')][_0x4a0138('0xd')]?_0x300e51[_0x4a0138('0x50')]:_0x13b1e8[_0x4a0138('0x25')],_0x300e51['limit']=qs['limit'](_0x464d47[_0x4a0138('0x3a')]['limit']),_0x300e51[_0x4a0138('0x47')]=qs[_0x4a0138('0x47')](_0x464d47['query'][_0x4a0138('0x47')]),_0x300e51['order']=qs['sort'](_0x464d47[_0x4a0138('0x3a')][_0x4a0138('0x1f')]),_0x300e51[_0x4a0138('0x2b')]=qs['filters'](_[_0x4a0138('0x51')](_0x464d47[_0x4a0138('0x3a')],_0x13b1e8[_0x4a0138('0x53')])),_0x300e51=_['merge']({},_0x300e51,_0x464d47[_0x4a0138('0x41')]),_0x5226fc[_0x4a0138('0x20')+_[_0x4a0138('0x21')](_0x464d47[_0x4a0138('0x3a')]['channel'][_0x4a0138('0x38')]())+_0x4a0138('0x24')](_0x300e51);})[_0x22211a('0x66')](respondWithResult(_0x20459b,null))[_0x22211a('0x61')](handleError(_0x20459b,null));},exports[_0x1e0939('0x19')]=function(_0x34ff18,_0x35c67d){const _0xa237a5=_0x1e0939;return db[_0xa237a5('0x30')][_0xa237a5('0x34')]({'where':{'id':_0x34ff18['params']['id']}})[_0xa237a5('0x66')](function(_0x515c10){const _0xe0630e=_0xa237a5;if(_0x515c10){if(!_0x34ff18[_0xe0630e('0x17')][_0xe0630e('0x55')]||!utils[_0xe0630e('0x2e')](_0x34ff18[_0xe0630e('0x17')][_0xe0630e('0x55')]))throw new ValidationError(_0xe0630e('0x1e'));return _0x515c10['add'+_['capitalize'](_0x34ff18['body'][_0xe0630e('0x55')][_0xe0630e('0x38')]())+_0xe0630e('0x24')](_0x34ff18['body'][_0xe0630e('0x6')]);}return null;})[_0xa237a5('0x66')](handleEntityNotFound(_0x35c67d,null))[_0xa237a5('0x66')](respondWithStatusCode(_0x35c67d,null))[_0xa237a5('0x61')](handleError(_0x35c67d,null));},exports[_0x1e0939('0x4c')]=function(_0x20eb82,_0x53ea64){const _0x3a552e=_0x1e0939;return db[_0x3a552e('0x30')][_0x3a552e('0x34')]({'where':{'id':_0x20eb82[_0x3a552e('0x5f')]['id']}})[_0x3a552e('0x66')](function(_0x5d2374){const _0x87f719=_0x3a552e;if(_0x5d2374){if(!_0x20eb82['query']['channel']||!utils[_0x87f719('0x2e')](_0x20eb82[_0x87f719('0x3a')]['channel']))throw new ValidationError(_0x87f719('0x1e'));return _0x5d2374[_0x87f719('0x26')+_[_0x87f719('0x21')](_0x20eb82['query'][_0x87f719('0x55')][_0x87f719('0x38')]())+_0x87f719('0x24')](_0x20eb82[_0x87f719('0x3a')]['ids']);}return null;})[_0x3a552e('0x66')](handleEntityNotFound(_0x53ea64,null))[_0x3a552e('0x66')](respondWithStatusCode(_0x53ea64,null))[_0x3a552e('0x61')](handleError(_0x53ea64,null));},exports['addAgents']=function(_0x5ba685,_0x599a51){const _0x8a919c=_0x1e0939;return db[_0x8a919c('0x30')][_0x8a919c('0x34')]({'where':{'id':_0x5ba685[_0x8a919c('0x5f')]['id']}})[_0x8a919c('0x66')](function(_0x51b9f1){const _0x552797=_0x8a919c;if(_0x51b9f1){const _0x533b88=[_0x552797('0x3d'),_0x552797('0x67'),_0x552797('0x23'),_0x552797('0x58'),_0x552797('0x2c'),_0x552797('0x36'),_0x552797('0x42')];return Promise[_0x552797('0x5a')](_0x533b88,function(_0xadfe34){const _0x45fab8=_0x552797;return _0x51b9f1[_0x45fab8('0x20')+_0xadfe34+'Queues']({'attributes':['id','name']})[_0x45fab8('0x66')](function(_0x56268c){return Promise['each'](_0x56268c,function(_0x33369d){const _0x81408c=a626_0xc10c;return _0x33369d[_0x81408c('0x3')](_0x5ba685[_0x81408c('0x17')][_0x81408c('0x6')])[_0x81408c('0x66')](function(){const _0x3adcbe=_0x81408c;if(_0xadfe34===_0x3adcbe('0x3d'))return db['User'][_0x3adcbe('0x5')]({'where':{'id':_0x5ba685[_0x3adcbe('0x17')][_0x3adcbe('0x6')]},'attributes':['id',_0x3adcbe('0x11'),_0x3adcbe('0xf'),_0x3adcbe('0x27'),_0x3adcbe('0x0')],'raw':!![]})[_0x3adcbe('0x66')](function(_0x194726){const _0x5ecc0a=_0x3adcbe;return Promise[_0x5ecc0a('0x5a')](_[_0x5ecc0a('0x48')](_0x194726,{'online':0x1}),function(_0x138566){const _0x45beca=_0x5ecc0a;return db[_0x45beca('0x46')][_0x45beca('0x2a')]({'membername':_0x138566['name'],'UserId':_0x138566['id'],'queue_name':_0x33369d['name'],'VoiceQueueId':_0x33369d['id'],'interface':_[_0x45beca('0x4e')](_0x138566[_0x45beca('0x0')])?util['format']('SIP/%s',_0x138566[_0x45beca('0x11')]):_0x138566[_0x45beca('0x0')],'paused':_0x138566['voicePause']||![],'penalty':0x0});});});});});})['then'](function(){return _0x51b9f1;});})[_0x552797('0x66')](function(){return _0x51b9f1;});}})[_0x8a919c('0x66')](function(_0x8189f0){const _0xd91120=_0x8a919c;if(_0x8189f0)return _0x8189f0[_0xd91120('0x3')](_0x5ba685['body'][_0xd91120('0x6')],{'through':_[_0xd91120('0x31')](_0x5ba685['body'],[_0xd91120('0x6'),'id'])})[_0xd91120('0x66')](function(_0x1037bf){const _0x207adb=_0xd91120;for(let _0x49899c=0x0;_0x49899c<_0x5ba685[_0x207adb('0x17')][_0x207adb('0x6')][_0x207adb('0xd')];_0x49899c+=0x1){socket[_0x207adb('0x4b')](_0x207adb('0x40'),{'UserId':_0x5ba685[_0x207adb('0x17')][_0x207adb('0x6')][_0x49899c],'TeamId':_0x5ba685[_0x207adb('0x5f')]['id']});}return _0x1037bf;});})[_0x8a919c('0x66')](respondWithResult(_0x599a51,null))[_0x8a919c('0x61')](handleError(_0x599a51,null));},exports[_0x1e0939('0x4f')]=function(_0x35e281,_0x2e73a4){const _0x56c98f=_0x1e0939;return db[_0x56c98f('0x30')][_0x56c98f('0x34')]({'where':{'id':_0x35e281[_0x56c98f('0x5f')]['id']}})[_0x56c98f('0x66')](handleEntityNotFound(_0x2e73a4,null))['then'](function(_0x14d131){const _0xd41c2d=_0x56c98f;if(_0x14d131)return Promise[_0xd41c2d('0x5a')]([_0xd41c2d('0x52'),_0xd41c2d('0x1c'),_0xd41c2d('0x1a'),_0xd41c2d('0x16'),_0xd41c2d('0x37'),_0xd41c2d('0x4a'),_0xd41c2d('0x5e')],function(_0x5dfb81){const _0x510114=_0xd41c2d;return _0x14d131[_0x510114('0x20')+_[_0x510114('0x21')](_0x5dfb81)+'Queues']({'attributes':['id',_0x510114('0x11')]})['then'](function(_0x7a568f){return Promise['each'](_0x7a568f,function(_0x5b1e21){const _0x194bae=a626_0xc10c;return _0x5b1e21[_0x194bae('0x4f')](_0x35e281[_0x194bae('0x3a')]['ids'])[_0x194bae('0x66')](function(){const _0x5cf147=_0x194bae;if(_0x5dfb81===_0x5cf147('0x52'))return db[_0x5cf147('0x46')]['destroy']({'where':{'VoiceQueueId':_0x5b1e21['id'],'UserId':_0x35e281[_0x5cf147('0x3a')]['ids']}});});});})[_0x510114('0x66')](function(){return _0x14d131;});})[_0xd41c2d('0x66')](function(){return _0x14d131;});})['then'](function(_0x25b69b){const _0xda3dbf=_0x56c98f;if(_0x25b69b)return _0x25b69b[_0xda3dbf('0x4f')](_0x35e281['query'][_0xda3dbf('0x6')])[_0xda3dbf('0x66')](function(){const _0x1a95e9=_0xda3dbf;if(_[_0x1a95e9('0x35')](_0x35e281[_0x1a95e9('0x3a')][_0x1a95e9('0x6')]))for(let _0x4d5442=0x0;_0x4d5442<_0x35e281[_0x1a95e9('0x3a')]['ids'][_0x1a95e9('0xd')];_0x4d5442+=0x1){socket[_0x1a95e9('0x4b')](_0x1a95e9('0x10'),{'UserId':Number(_0x35e281['query'][_0x1a95e9('0x6')][_0x4d5442]),'TeamId':Number(_0x35e281[_0x1a95e9('0x5f')]['id'])});}else socket[_0x1a95e9('0x4b')](_0x1a95e9('0x10'),{'UserId':Number(_0x35e281[_0x1a95e9('0x3a')][_0x1a95e9('0x6')]),'TeamId':Number(_0x35e281['params']['id'])});});})['then'](respondWithStatusCode(_0x2e73a4,null))[_0x56c98f('0x61')](handleError(_0x2e73a4,null));},exports[_0x1e0939('0x5d')]=function(_0xe2f98f,_0x1c2a34){const _0x478ce7=_0x1e0939;let _0x2fb1aa={};const _0x54a799={};let _0x1d8f94,_0x2ec8c9;return db[_0x478ce7('0x30')]['findOne']({'where':{'id':_0xe2f98f['params']['id']}})[_0x478ce7('0x66')](handleEntityNotFound(_0x1c2a34,null))[_0x478ce7('0x66')](function(_0x3350d6){const _0x47f277=_0x478ce7;if(_0x3350d6)return _0x1d8f94=_0x3350d6,_0x54a799[_0x47f277('0x25')]=_['keys'](db[_0x47f277('0x1b')][_0x47f277('0x29')]),_0x54a799[_0x47f277('0x3a')]=_['keys'](_0xe2f98f[_0x47f277('0x3a')]),_0x54a799[_0x47f277('0x53')]=_['intersection'](_0x54a799['model'],_0x54a799[_0x47f277('0x3a')]),_0x2fb1aa[_0x47f277('0x50')]=_[_0x47f277('0x2f')](_0x54a799[_0x47f277('0x25')],qs[_0x47f277('0x4')](_0xe2f98f[_0x47f277('0x3a')][_0x47f277('0x4')])),_0x2fb1aa[_0x47f277('0x50')]=_0x2fb1aa['attributes'][_0x47f277('0xd')]?_0x2fb1aa['attributes']:_0x54a799[_0x47f277('0x25')],_0x2fb1aa['order']=qs[_0x47f277('0x1f')](_0xe2f98f[_0x47f277('0x3a')][_0x47f277('0x1f')]),_0x2fb1aa['where']=qs['filters'](_['pick'](_0xe2f98f[_0x47f277('0x3a')],_0x54a799[_0x47f277('0x53')])),_0xe2f98f['query'][_0x47f277('0x48')]&&(_0x2fb1aa[_0x47f277('0x2b')]=_[_0x47f277('0x13')](_0x2fb1aa['where'],{[Op['or']]:_[_0x47f277('0x32')](_0x2fb1aa[_0x47f277('0x50')],function(_0x5bcd8b){const _0x12baf7=_0x47f277,_0x35ec6e={};return _0x35ec6e[_0x5bcd8b]={[Op['like']]:'%'+_0xe2f98f[_0x12baf7('0x3a')][_0x12baf7('0x48')]+'%'},_0x35ec6e;})})),_0x2fb1aa=_['merge']({},_0x2fb1aa,_0xe2f98f[_0x47f277('0x41')]),_0x1d8f94['getAgents'](_0x2fb1aa);})[_0x478ce7('0x66')](function(_0x4d8848){const _0x16be57=_0x478ce7;if(_0x4d8848)return _0x2ec8c9=_0x4d8848[_0x16be57('0xd')],typeof _0xe2f98f['query'][_0x16be57('0x3f')]===_0x16be57('0x8')&&(_0x2fb1aa['limit']=qs[_0x16be57('0x3e')](_0xe2f98f[_0x16be57('0x3a')][_0x16be57('0x3e')]),_0x2fb1aa['offset']=qs[_0x16be57('0x47')](_0xe2f98f[_0x16be57('0x3a')][_0x16be57('0x47')])),_0x1d8f94['getAgents'](_0x2fb1aa);})[_0x478ce7('0x66')](function(_0x11bdb6){if(_0x11bdb6)return _0x11bdb6?{'count':_0x2ec8c9,'rows':_0x11bdb6}:null;})[_0x478ce7('0x66')](respondWithResult(_0x1c2a34,null))[_0x478ce7('0x61')](handleError(_0x1c2a34,null));};
\ No newline at end of file