Built motion from commit f861bcb808219e66da88ba48b61bddb35224a65e. Version 3.0.0...
[motion-next.git] / server / api / openchannelQueue / openchannelQueue.controller.js
index 27ea9c2..cd257c5 100644 (file)
@@ -1 +1 @@
-'use strict';const a593_0x542a=['includeAll','fields','OpenchannelQueue','query','userOpenchannelQueue:remove','map','nolimit','81276NBBKQm','Agents','OpenchannelQueues','then','create','format','field','undefined','findAndCountAll','select','UserOpenchannelQueue','catch','intersection','findOne','index','openchannelPause','filter','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','ids','tq.TeamId','getAgents','value','order','UserProfileResource','sort','error','merge','end','stack','api','get','clone','name','getMembers','describe','rawAttributes','isEmpty','findOrCreate','lodash','interface','attributes','222719EGQEiv','voicePause','TeamId','limit','status','addTeams','OpenchannelQueueId\x20=\x20?','destroy','userOpenchannelQueue:save','includes','pick','User','every','1izfiFx','90603dbXCLn','removeTeams','update','./openchannelQueue.socket','@rediscache','addAgents','user','rows','body','count','keys','all','createdAt','include','role','type','328754QZQyaI','ut.UserId\x20=\x20?','126040fNkpaW','sendStatus','updatedAt','where','77teAqeR','UserProfileSection','@mysqldb','UserId','OpenchannelQueueId','findAll','filters','userProfileId','autoAssociation','SELECT','key','657559mJkfYT','getTeams','model','sequelize','Unable\x20to\x20retrieve\x20the\x20current\x20user','length','params','join','squel','1Umelkj','SIP','transaction','removeAgents','Team','3sNraFA','options','817XBsNlO','emit','offset','forEach','json','user_has_teams','online'];const a593_0x501e=function(_0x312cb6,_0x5a0f7e){_0x312cb6=_0x312cb6-0x108;let _0x542aec=a593_0x542a[_0x312cb6];return _0x542aec;};const a593_0x466c65=a593_0x501e;(function(_0x1b1784,_0x278cbe){const _0xbb08d5=a593_0x501e;while(!![]){try{const _0xe4c4f2=parseInt(_0xbb08d5(0x12b))+-parseInt(_0xbb08d5(0x161))*parseInt(_0xbb08d5(0x174))+-parseInt(_0xbb08d5(0x154))*-parseInt(_0xbb08d5(0x116))+-parseInt(_0xbb08d5(0x172))+-parseInt(_0xbb08d5(0x11b))*parseInt(_0xbb08d5(0x162))+parseInt(_0xbb08d5(0x11d))*-parseInt(_0xbb08d5(0x178))+parseInt(_0xbb08d5(0x10d));if(_0xe4c4f2===_0x278cbe)break;else _0x1b1784['push'](_0x1b1784['shift']());}catch(_0x1bf13f){_0x1b1784['push'](_0x1b1784['shift']());}}}(a593_0x542a,0x2a00a));const util=require('util'),_=require(a593_0x466c65(0x151)),squel=require(a593_0x466c65(0x115)),qs=require('@components/parsers/qs'),logger=require('@config/logger')(a593_0x466c65(0x148)),{getSocket}=require(a593_0x466c65(0x166)),socket=getSocket(),{db}=require(a593_0x466c65(0x17a)),{QueryTypes}=require(a593_0x466c65(0x110)),{filterAttributes}=require('@utils/filter-attributes');require(a593_0x466c65(0x165))['register'](socket);function respondWithStatusCode(_0x55a016,_0x15c48c){return _0x15c48c=_0x15c48c||0xcc,function(_0x461365){const _0x6152d0=a593_0x501e;if(_0x461365)return _0x55a016[_0x6152d0(0x175)](_0x15c48c);return _0x55a016[_0x6152d0(0x158)](_0x15c48c)[_0x6152d0(0x146)]();};}function respondWithResult(_0x77ebf,_0x24584a){return _0x24584a=_0x24584a||0xc8,function(_0x5ec54a){const _0x326e68=a593_0x501e;if(_0x5ec54a)return _0x77ebf[_0x326e68(0x158)](_0x24584a)[_0x326e68(0x121)](_0x5ec54a);};}function respondWithFilteredResult(_0x2c88b4,_0x53443e){return function(_0x560f0){const _0x444bff=a593_0x501e;if(_0x560f0){const _0x2f1b88=_0x560f0[_0x444bff(0x16b)],_0x5857aa=_0x53443e[_0x444bff(0x11f)];let _0x41ede8=_0x53443e[_0x444bff(0x11f)]+_0x53443e[_0x444bff(0x157)],_0x5d40eb;return _0x41ede8>=_0x2f1b88?(_0x41ede8=_0x2f1b88,_0x5d40eb=0xc8):_0x5d40eb=0xce,_0x2c88b4[_0x444bff(0x158)](_0x5d40eb),_0x2c88b4['set']('Content-Range',_0x5857aa+'-'+_0x41ede8+'/'+_0x2f1b88)['json'](_0x560f0);}return null;};}function saveUpdates(_0x29a8b7){return function(_0x20a1cc){const _0x41147a=a593_0x501e;if(_0x20a1cc)return _0x20a1cc['update'](_0x29a8b7)[_0x41147a(0x12e)](function(_0x43dc1f){return _0x43dc1f;});return null;};}function removeEntity(_0x1820f7){return function(_0x483d77){const _0x49ce85=a593_0x501e;if(_0x483d77)return _0x483d77[_0x49ce85(0x15b)]()['then'](function(){const _0x73bdc0=_0x49ce85,_0x27dd8c=_0x483d77[_0x73bdc0(0x149)]({'plain':!![]}),_0x3a69b6=_0x73bdc0(0x12d);return db[_0x73bdc0(0x142)]['destroy']({'where':{'type':_0x3a69b6,'resourceId':_0x27dd8c['id']}})[_0x73bdc0(0x12e)](function(){return _0x483d77;});})[_0x49ce85(0x12e)](function(){const _0x424331=_0x49ce85;_0x1820f7[_0x424331(0x158)](0xcc)['end']();});};}function handleEntityNotFound(_0x4b597a){return function(_0x15b6cf){const _0x282e18=a593_0x501e;return!_0x15b6cf&&_0x4b597a[_0x282e18(0x175)](0x194),_0x15b6cf;};}function handleError(_0x5b46b2,_0x4e2077){return _0x4e2077=_0x4e2077||0x1f4,function(_0x2a7581){const _0x4e1d83=a593_0x501e;logger[_0x4e1d83(0x144)](_0x2a7581[_0x4e1d83(0x147)]),_0x2a7581['name']&&delete _0x2a7581[_0x4e1d83(0x14b)],_0x5b46b2[_0x4e1d83(0x158)](_0x4e2077)['send'](_0x2a7581);};}exports[a593_0x466c65(0x139)]=function(_0x2fc3bb,_0x5b854c){const _0x3d02b8=a593_0x466c65;let _0x235dd9={};const _0x3f4c63={},_0x3016a0={'count':0x0,'rows':[]},_0x504708=_[_0x3d02b8(0x129)](db['OpenchannelQueue'][_0x3d02b8(0x14e)],function(_0x42052f){const _0x3b680a=_0x3d02b8;return{'name':_0x42052f['fieldName'],'type':_0x42052f[_0x3b680a(0x171)][_0x3b680a(0x10c)]};});_0x3f4c63[_0x3d02b8(0x10f)]=_[_0x3d02b8(0x129)](_0x504708,'name'),_0x3f4c63[_0x3d02b8(0x127)]=_[_0x3d02b8(0x16c)](_0x2fc3bb[_0x3d02b8(0x127)]),_0x3f4c63[_0x3d02b8(0x108)]=_[_0x3d02b8(0x137)](_0x3f4c63[_0x3d02b8(0x10f)],_0x3f4c63[_0x3d02b8(0x127)]),_0x235dd9['attributes']=_[_0x3d02b8(0x137)](_0x3f4c63[_0x3d02b8(0x10f)],qs[_0x3d02b8(0x125)](_0x2fc3bb['query'][_0x3d02b8(0x125)])),_0x235dd9[_0x3d02b8(0x153)]=_0x235dd9[_0x3d02b8(0x153)][_0x3d02b8(0x112)]?_0x235dd9[_0x3d02b8(0x153)]:_0x3f4c63[_0x3d02b8(0x10f)];typeof _0x2fc3bb[_0x3d02b8(0x127)][_0x3d02b8(0x12a)]==='undefined'&&(_0x235dd9[_0x3d02b8(0x157)]=qs['limit'](_0x2fc3bb[_0x3d02b8(0x127)][_0x3d02b8(0x157)]),_0x235dd9[_0x3d02b8(0x11f)]=qs['offset'](_0x2fc3bb[_0x3d02b8(0x127)][_0x3d02b8(0x11f)]));_0x235dd9[_0x3d02b8(0x141)]=qs[_0x3d02b8(0x143)](_0x2fc3bb[_0x3d02b8(0x127)][_0x3d02b8(0x143)]),_0x235dd9['where']=qs[_0x3d02b8(0x108)](_[_0x3d02b8(0x15e)](_0x2fc3bb[_0x3d02b8(0x127)],_0x3f4c63[_0x3d02b8(0x108)]),_0x504708),_0x235dd9=filterAttributes(_0x235dd9,_0x2fc3bb['query'][_0x3d02b8(0x13b)],_0x504708,_0x2fc3bb[_0x3d02b8(0x11c)]);const _0xe9aab4={'where':_0x235dd9[_0x3d02b8(0x177)]};return db['OpenchannelQueue'][_0x3d02b8(0x16b)](_0xe9aab4)[_0x3d02b8(0x12e)](function(_0x23ec19){const _0x171f95=_0x3d02b8;return _0x3016a0[_0x171f95(0x16b)]=_0x23ec19,_0x2fc3bb[_0x171f95(0x127)][_0x171f95(0x124)]&&(_0x235dd9[_0x171f95(0x16f)]=[{'all':!![]}]),db[_0x171f95(0x126)][_0x171f95(0x17d)](_0x235dd9);})[_0x3d02b8(0x12e)](function(_0x78b632){const _0x1df981=_0x3d02b8;return _0x3016a0[_0x1df981(0x169)]=_0x78b632,_0x3016a0;})[_0x3d02b8(0x12e)](respondWithFilteredResult(_0x5b854c,_0x235dd9))['catch'](handleError(_0x5b854c,null));},exports['show']=function(_0x3e93a0,_0x9b7a85){const _0x2f1065=a593_0x466c65;let _0x380f91={'raw':!![],'where':{'id':_0x3e93a0[_0x2f1065(0x113)]['id']}};const _0x2a320b={};return _0x2a320b[_0x2f1065(0x10f)]=_['keys'](db[_0x2f1065(0x126)]['rawAttributes']),_0x2a320b['query']=_[_0x2f1065(0x16c)](_0x3e93a0[_0x2f1065(0x127)]),_0x2a320b[_0x2f1065(0x108)]=_[_0x2f1065(0x137)](_0x2a320b['model'],_0x2a320b[_0x2f1065(0x127)]),_0x380f91[_0x2f1065(0x153)]=_[_0x2f1065(0x137)](_0x2a320b[_0x2f1065(0x10f)],qs[_0x2f1065(0x125)](_0x3e93a0['query']['fields'])),_0x380f91[_0x2f1065(0x153)]=_0x380f91[_0x2f1065(0x153)]['length']?_0x380f91[_0x2f1065(0x153)]:_0x2a320b['model'],_0x3e93a0[_0x2f1065(0x127)]['includeAll']&&(_0x380f91[_0x2f1065(0x16f)]=[{'all':!![]}]),_0x380f91=_[_0x2f1065(0x145)]({},_0x380f91,_0x3e93a0[_0x2f1065(0x11c)]),db[_0x2f1065(0x126)][_0x2f1065(0x138)](_0x380f91)[_0x2f1065(0x12e)](handleEntityNotFound(_0x9b7a85,null))['then'](respondWithResult(_0x9b7a85,null))[_0x2f1065(0x136)](handleError(_0x9b7a85,null));},exports['create']=function(_0x17caff,_0x468c31){const _0xe21000=a593_0x466c65;return db[_0xe21000(0x126)][_0xe21000(0x12f)](_0x17caff['body'],{})[_0xe21000(0x12e)](function(_0x54cbed){const _0x59ad16=_0xe21000,_0x21900e=_0x17caff[_0x59ad16(0x168)][_0x59ad16(0x149)]({'plain':!![]});if(!_0x21900e)throw new Error(_0x59ad16(0x111));if(_0x21900e[_0x59ad16(0x170)]==='user'){const _0x2474e0=_0x54cbed[_0x59ad16(0x149)]({'plain':!![]}),_0x981ea9=_0x59ad16(0x12d);return db[_0x59ad16(0x179)][_0x59ad16(0x138)]({'where':{'name':_0x981ea9,'userProfileId':_0x21900e[_0x59ad16(0x109)]},'raw':!![]})[_0x59ad16(0x12e)](function(_0x1fde22){const _0x3a4bb5=_0x59ad16;return _0x1fde22&&_0x1fde22[_0x3a4bb5(0x10a)]===0x0?db['UserProfileResource'][_0x3a4bb5(0x12f)]({'name':_0x2474e0['name'],'resourceId':_0x2474e0['id'],'type':_0x1fde22['name'],'sectionId':_0x1fde22['id']},{})['then'](function(){return _0x54cbed;}):_0x54cbed;})[_0x59ad16(0x136)](function(_0x5f11d0){const _0x370389=_0x59ad16;logger[_0x370389(0x144)](_0x370389(0x13c),_0x5f11d0);throw _0x5f11d0;});}return _0x54cbed;})['then'](respondWithResult(_0x468c31,0xc9))[_0xe21000(0x136)](handleError(_0x468c31,null));},exports[a593_0x466c65(0x164)]=function(_0x57d0ea,_0x52b239){const _0x2907a4=a593_0x466c65;return _0x57d0ea[_0x2907a4(0x16a)]['id']&&delete _0x57d0ea[_0x2907a4(0x16a)]['id'],db[_0x2907a4(0x126)][_0x2907a4(0x138)]({'where':{'id':_0x57d0ea[_0x2907a4(0x113)]['id']}})[_0x2907a4(0x12e)](handleEntityNotFound(_0x52b239,null))['then'](saveUpdates(_0x57d0ea[_0x2907a4(0x16a)],null))['then'](respondWithResult(_0x52b239,null))[_0x2907a4(0x136)](handleError(_0x52b239,null));},exports[a593_0x466c65(0x15b)]=function(_0x2560eb,_0x1d897d){const _0x5e5eeb=a593_0x466c65;return db[_0x5e5eeb(0x126)]['findOne']({'where':{'id':_0x2560eb['params']['id']}})[_0x5e5eeb(0x12e)](handleEntityNotFound(_0x1d897d,null))[_0x5e5eeb(0x12e)](removeEntity(_0x1d897d,null))[_0x5e5eeb(0x136)](handleError(_0x1d897d,null));},exports['describe']=function(_0x148405,_0x522190){const _0x15ade6=a593_0x466c65;return db[_0x15ade6(0x126)][_0x15ade6(0x14d)]()[_0x15ade6(0x12e)](respondWithResult(_0x522190,null))[_0x15ade6(0x136)](handleError(_0x522190,null));},exports[a593_0x466c65(0x14c)]=function(_0x23e850,_0x2145c8){const _0x448c18=a593_0x466c65;let _0x386af9={'raw':!![],'where':{}};const _0x4b5829={};let _0x31659c;return db[_0x448c18(0x126)][_0x448c18(0x138)]({'where':{'id':_0x23e850['params']['id']}})['then'](handleEntityNotFound(_0x2145c8,null))[_0x448c18(0x12e)](function(_0x5d793c){const _0x364220=_0x448c18;if(_0x5d793c)return _0x31659c=_0x5d793c[_0x364220(0x149)]({'plain':!![]}),_0x4b5829['model']=_[_0x364220(0x16c)](db[_0x364220(0x135)]['rawAttributes']),_0x4b5829[_0x364220(0x127)]=_[_0x364220(0x16c)](_0x23e850[_0x364220(0x127)]),_0x4b5829['filters']=_[_0x364220(0x137)](_0x4b5829[_0x364220(0x10f)],_0x4b5829['query']),_0x386af9[_0x364220(0x153)]=_[_0x364220(0x137)](_0x4b5829[_0x364220(0x10f)],qs[_0x364220(0x125)](_0x23e850[_0x364220(0x127)][_0x364220(0x125)])),_0x386af9[_0x364220(0x153)]=_0x386af9[_0x364220(0x153)][_0x364220(0x112)]?_0x386af9[_0x364220(0x153)]:_0x4b5829['model'],typeof _0x23e850['query'][_0x364220(0x12a)]===_0x364220(0x132)&&(_0x386af9['limit']=qs['limit'](_0x23e850[_0x364220(0x127)][_0x364220(0x157)]),_0x386af9['offset']=qs[_0x364220(0x11f)](_0x23e850[_0x364220(0x127)][_0x364220(0x11f)])),_0x386af9[_0x364220(0x141)]=qs[_0x364220(0x143)](_0x23e850[_0x364220(0x127)][_0x364220(0x143)]),_0x386af9['where']=qs['filters'](_[_0x364220(0x15e)](_0x23e850[_0x364220(0x127)],_0x4b5829[_0x364220(0x108)])),_0x386af9['where'][_0x364220(0x17c)]=_0x5d793c['id'],_0x386af9=filterAttributes(_0x386af9,_0x23e850['query']['filter'],_0x386af9['attributes'],_0x23e850[_0x364220(0x11c)],![]),db[_0x364220(0x135)][_0x364220(0x17d)](_0x386af9);})[_0x448c18(0x12e)](function(_0x2358b4){const _0x468e7b=_0x448c18;if(_0x2358b4)return db[_0x468e7b(0x15f)][_0x468e7b(0x133)]({'where':{'id':_[_0x468e7b(0x129)](_0x2358b4,_0x468e7b(0x17b)),'role':'agent'},'attributes':['id','name',_0x468e7b(0x13a),_0x468e7b(0x176),_0x468e7b(0x16e)]});})['then'](function(_0x1770e0){const _0x31ef95=_0x448c18;return _0x1770e0?{'count':_0x1770e0[_0x31ef95(0x16b)],'rows':_['map'](_0x1770e0[_0x31ef95(0x169)],function(_0x31ebf5){const _0x309bf4=_0x31ef95;return{'membername':_0x31ebf5[_0x309bf4(0x14b)],'UserId':_0x31ebf5['id'],'queue_name':_0x31659c[_0x309bf4(0x14b)],'OpenchannelQueueId':_0x31659c['id'],'interface':util[_0x309bf4(0x130)]('%s/%s',_0x309bf4(0x117),_0x31ebf5['name']),'penalty':0x0,'paused':_0x31ebf5[_0x309bf4(0x13a)],'createdAt':_0x31ebf5[_0x309bf4(0x16e)],'updatedAt':_0x31ebf5[_0x309bf4(0x176)]};})}:{'count':0x0,'rows':[]};})[_0x448c18(0x12e)](respondWithFilteredResult(_0x2145c8,_0x386af9))[_0x448c18(0x136)](handleError(_0x2145c8,null));},exports[a593_0x466c65(0x10e)]=function(_0x35ffbd,_0x5cf259){const _0x84b902=a593_0x466c65;let _0x189404={};const _0x39a9d2={};let _0x4e58e4,_0x22dc67;return db[_0x84b902(0x126)][_0x84b902(0x138)]({'where':{'id':_0x35ffbd[_0x84b902(0x113)]['id']}})[_0x84b902(0x12e)](handleEntityNotFound(_0x5cf259,null))['then'](function(_0x4a9fe7){const _0x24a0ce=_0x84b902;if(_0x4a9fe7)return _0x4e58e4=_0x4a9fe7,_0x39a9d2[_0x24a0ce(0x10f)]=_[_0x24a0ce(0x16c)](db[_0x24a0ce(0x11a)]['rawAttributes']),_0x39a9d2[_0x24a0ce(0x127)]=_['keys'](_0x35ffbd[_0x24a0ce(0x127)]),_0x39a9d2[_0x24a0ce(0x108)]=_[_0x24a0ce(0x137)](_0x39a9d2[_0x24a0ce(0x10f)],_0x39a9d2['query']),_0x189404[_0x24a0ce(0x153)]=_[_0x24a0ce(0x137)](_0x39a9d2[_0x24a0ce(0x10f)],qs[_0x24a0ce(0x125)](_0x35ffbd['query']['fields'])),_0x189404['attributes']=_0x189404[_0x24a0ce(0x153)][_0x24a0ce(0x112)]?_0x189404[_0x24a0ce(0x153)]:_0x39a9d2['model'],_0x189404[_0x24a0ce(0x141)]=qs[_0x24a0ce(0x143)](_0x35ffbd[_0x24a0ce(0x127)][_0x24a0ce(0x143)]),_0x189404[_0x24a0ce(0x177)]=qs['filters'](_[_0x24a0ce(0x15e)](_0x35ffbd[_0x24a0ce(0x127)],_0x39a9d2['filters'])),_0x189404=filterAttributes(_0x189404,_0x35ffbd['query'][_0x24a0ce(0x13b)],_0x189404[_0x24a0ce(0x153)],_0x35ffbd['options'],![]),_0x4e58e4[_0x24a0ce(0x10e)](_0x189404);})['then'](function(_0xb2c937){const _0x4f7566=_0x84b902;if(_0xb2c937)return _0x22dc67=_0xb2c937[_0x4f7566(0x112)],typeof _0x35ffbd[_0x4f7566(0x127)]['nolimit']===_0x4f7566(0x132)&&(_0x189404[_0x4f7566(0x157)]=qs[_0x4f7566(0x157)](_0x35ffbd[_0x4f7566(0x127)][_0x4f7566(0x157)]),_0x189404['offset']=qs[_0x4f7566(0x11f)](_0x35ffbd[_0x4f7566(0x127)][_0x4f7566(0x11f)])),_0x4e58e4['getTeams'](_0x189404);})[_0x84b902(0x12e)](function(_0x28d92a){if(_0x28d92a)return _0x28d92a?{'count':_0x22dc67,'rows':_0x28d92a}:null;})[_0x84b902(0x12e)](respondWithResult(_0x5cf259,null))[_0x84b902(0x136)](handleError(_0x5cf259,null));},exports[a593_0x466c65(0x159)]=function(_0x472218,_0x243a98){const _0x472c2e=a593_0x466c65,_0x38130d=_0x472218[_0x472c2e(0x16a)][_0x472c2e(0x13d)];return db[_0x472c2e(0x11a)][_0x472c2e(0x17d)]({'where':{'id':_0x38130d},'attributes':['id'],'include':[{'model':db['User'],'as':_0x472c2e(0x12c),'attributes':['id','name',_0x472c2e(0x123),_0x472c2e(0x155),_0x472c2e(0x152)],'raw':!![]}]})['then'](function(_0x4da9ed){const _0x3a4a8e=_0x472c2e;if(_0x4da9ed){const _0x5ad040=_['flatMap'](_0x4da9ed,function(_0x23df38){const _0x2e245e=a593_0x501e,_0x20c2cb=_0x23df38['get']({'plain':!![]});return _0x20c2cb[_0x2e245e(0x12c)];});return db[_0x3a4a8e(0x126)][_0x3a4a8e(0x138)]({'where':{'id':_0x472218[_0x3a4a8e(0x113)]['id']}})[_0x3a4a8e(0x12e)](function(_0x403df7){const _0x1fd96e=_0x3a4a8e;return db['sequelize'][_0x1fd96e(0x118)](function(_0x232f01){const _0x9ed6cd=_0x1fd96e;return _0x403df7[_0x9ed6cd(0x159)](_0x38130d,{'transaction':_0x232f01})[_0x9ed6cd(0x12e)](function(){const _0x9f3faf=_0x9ed6cd;return Promise[_0x9f3faf(0x16d)](_0x5ad040[_0x9f3faf(0x129)](_0x4989a3=>{const _0xc6af79=_0x9f3faf;return db['UserOpenchannelQueue'][_0xc6af79(0x150)]({'where':{'UserId':_0x4989a3['id'],'OpenchannelQueueId':_0x472218[_0xc6af79(0x113)]['id']},'transaction':_0x232f01});}));})[_0x9ed6cd(0x12e)](function(){_0x5ad040['forEach'](function(_0x34ff15){const _0x4791b3=a593_0x501e;socket[_0x4791b3(0x11e)](_0x4791b3(0x15c),{'UserId':_0x34ff15['id'],'OpenchannelQueueId':_0x403df7['id']});});});});});}})['then'](respondWithStatusCode(_0x243a98,null))[_0x472c2e(0x136)](handleError(_0x243a98,null));},exports[a593_0x466c65(0x163)]=function(_0x25e7a8,_0x1db839){const _0x2aefb3=a593_0x466c65;return db[_0x2aefb3(0x11a)][_0x2aefb3(0x17d)]({'where':{'id':_0x25e7a8[_0x2aefb3(0x127)][_0x2aefb3(0x13d)]},'attributes':['id'],'include':[{'model':db[_0x2aefb3(0x15f)],'as':_0x2aefb3(0x12c),'attributes':['id'],'raw':!![]}]})[_0x2aefb3(0x12e)](handleEntityNotFound(_0x1db839,null))[_0x2aefb3(0x12e)](function(_0x5cf610){const _0x17b731=_0x2aefb3,_0x5cb803=_[_0x17b731(0x129)](_0x5cf610,'id');let _0xd9f4bd=[];const _0x43c66d=[],_0xfccc2c=squel[_0x17b731(0x134)]();_0xfccc2c[_0x17b731(0x131)](_0x17b731(0x13e))['from']('team_has_openchannel_queues','tq')[_0x17b731(0x114)](_0x17b731(0x122),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x17b731(0x177)](_0x17b731(0x15a),_0x25e7a8[_0x17b731(0x113)]['id']);for(let _0x230317=0x0;_0x230317<_0x5cf610[_0x17b731(0x112)];_0x230317+=0x1){const _0x27be2a=_0x5cf610[_0x230317];for(let _0x5dfcbf=0x0;_0x5dfcbf<_0x27be2a[_0x17b731(0x12c)][_0x17b731(0x112)];_0x5dfcbf+=0x1){const _0x584488=_0x27be2a[_0x17b731(0x12c)][_0x5dfcbf],_0x3413ec=_0xfccc2c[_0x17b731(0x14a)]();_0x3413ec['where'](_0x17b731(0x173),_0x584488['id']),_0x43c66d['push'](db[_0x17b731(0x110)][_0x17b731(0x127)](_0x3413ec['toString'](),{'type':QueryTypes[_0x17b731(0x10b)]})['then'](function(_0x22192f){const _0x2224cc=_0x17b731;if(_0x22192f['length']===0x1)return _0x584488['id'];else{const _0x34f74e=_[_0x2224cc(0x160)](_['map'](_0x22192f,_0x2224cc(0x156)),function(_0x5287c9){const _0x110b4e=_0x2224cc;return _[_0x110b4e(0x15d)](_0x5cb803,_0x5287c9);});if(_0x34f74e)return _0x584488['id'];}}));}}return Promise[_0x17b731(0x16d)](_0x43c66d)[_0x17b731(0x12e)](function(_0x4fd3ae){const _0x45455e=_0x17b731;return _0xd9f4bd=_(_0xd9f4bd)['union'](_0x4fd3ae)['compact']()[_0x45455e(0x140)](),db[_0x45455e(0x126)][_0x45455e(0x138)]({'where':{'id':_0x25e7a8[_0x45455e(0x113)]['id']}})[_0x45455e(0x12e)](function(_0x49f7c2){const _0x4594e9=_0x45455e;return db[_0x4594e9(0x110)]['transaction'](function(_0x540392){const _0x370835=_0x4594e9;return _0x49f7c2[_0x370835(0x163)](_0x25e7a8[_0x370835(0x127)][_0x370835(0x13d)],{'transaction':_0x540392})['then'](function(){const _0x368aab=_0x370835;if(!_[_0x368aab(0x14f)](_0xd9f4bd))return _0x49f7c2['removeAgents'](_0xd9f4bd,{'transaction':_0x540392});})[_0x370835(0x12e)](function(){const _0x4ce87c=_0x370835;_0xd9f4bd[_0x4ce87c(0x120)](function(_0x50a094){const _0x5f0b80=_0x4ce87c;socket[_0x5f0b80(0x11e)](_0x5f0b80(0x128),{'UserId':_0x50a094,'OpenchannelQueueId':_0x49f7c2['id']});});});});});});})[_0x2aefb3(0x12e)](respondWithStatusCode(_0x1db839,null))['catch'](handleError(_0x1db839,null));},exports[a593_0x466c65(0x167)]=function(_0x170b29,_0x4a52d3){const _0x580d5c=a593_0x466c65;return db[_0x580d5c(0x126)][_0x580d5c(0x138)]({'where':{'id':_0x170b29['params']['id']}})[_0x580d5c(0x12e)](function(_0x544e68){const _0x44eda4=_0x580d5c;if(_0x544e68)return _0x544e68[_0x44eda4(0x167)](_0x170b29['body'][_0x44eda4(0x13d)],{'through':_['omit'](_0x170b29[_0x44eda4(0x16a)],[_0x44eda4(0x13d),'id'])})[_0x44eda4(0x12e)](function(_0x401b98){const _0x3836d6=_0x44eda4;for(let _0x330925=0x0;_0x330925<_0x170b29[_0x3836d6(0x16a)][_0x3836d6(0x13d)][_0x3836d6(0x112)];_0x330925+=0x1){socket[_0x3836d6(0x11e)]('userOpenchannelQueue:save',{'UserId':_0x170b29[_0x3836d6(0x16a)]['ids'][_0x330925],'OpenchannelQueueId':_0x170b29[_0x3836d6(0x113)]['id']});}return _0x401b98;});})[_0x580d5c(0x12e)](respondWithResult(_0x4a52d3,null))[_0x580d5c(0x136)](handleError(_0x4a52d3,null));},exports[a593_0x466c65(0x119)]=function(_0x5a11e5,_0x23f81c){const _0x5536d5=a593_0x466c65;return db['OpenchannelQueue'][_0x5536d5(0x138)]({'where':{'id':_0x5a11e5[_0x5536d5(0x113)]['id']}})[_0x5536d5(0x12e)](handleEntityNotFound(_0x23f81c,null))[_0x5536d5(0x12e)](function(_0x553d5d){const _0x201cb3=_0x5536d5;if(_0x553d5d)return _0x553d5d['removeAgents'](_0x5a11e5[_0x201cb3(0x127)][_0x201cb3(0x13d)])['then'](function(){const _0x45b1d5=_0x201cb3;if(_['isArray'](_0x5a11e5[_0x45b1d5(0x127)]['ids']))for(let _0x4b4a34=0x0;_0x4b4a34<_0x5a11e5[_0x45b1d5(0x127)]['ids'][_0x45b1d5(0x112)];_0x4b4a34+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x5a11e5[_0x45b1d5(0x127)]['ids'][_0x4b4a34]),'OpenchannelQueueId':Number(_0x5a11e5['params']['id'])});}else socket[_0x45b1d5(0x11e)]('userOpenchannelQueue:remove',{'UserId':Number(_0x5a11e5[_0x45b1d5(0x127)][_0x45b1d5(0x13d)]),'OpenchannelQueueId':Number(_0x5a11e5['params']['id'])});});})['then'](respondWithStatusCode(_0x23f81c,null))[_0x5536d5(0x136)](handleError(_0x23f81c,null));},exports[a593_0x466c65(0x13f)]=function(_0x105291,_0x730efe){const _0x18aa2c=a593_0x466c65;let _0x68dcb6={};const _0x5b450d={};let _0x3e7c88,_0xb1094a;return db[_0x18aa2c(0x126)][_0x18aa2c(0x138)]({'where':{'id':_0x105291[_0x18aa2c(0x113)]['id']}})[_0x18aa2c(0x12e)](handleEntityNotFound(_0x730efe,null))[_0x18aa2c(0x12e)](function(_0x2a7466){const _0x19da73=_0x18aa2c;if(_0x2a7466)return _0x3e7c88=_0x2a7466,_0x5b450d['model']=_[_0x19da73(0x16c)](db[_0x19da73(0x15f)]['rawAttributes']),_0x5b450d[_0x19da73(0x127)]=_[_0x19da73(0x16c)](_0x105291[_0x19da73(0x127)]),_0x5b450d[_0x19da73(0x108)]=_[_0x19da73(0x137)](_0x5b450d[_0x19da73(0x10f)],_0x5b450d[_0x19da73(0x127)]),_0x68dcb6[_0x19da73(0x153)]=_[_0x19da73(0x137)](_0x5b450d[_0x19da73(0x10f)],qs[_0x19da73(0x125)](_0x105291[_0x19da73(0x127)][_0x19da73(0x125)])),_0x68dcb6[_0x19da73(0x153)]=_0x68dcb6[_0x19da73(0x153)]['length']?_0x68dcb6[_0x19da73(0x153)]:_0x5b450d['model'],_0x68dcb6[_0x19da73(0x141)]=qs[_0x19da73(0x143)](_0x105291[_0x19da73(0x127)][_0x19da73(0x143)]),_0x68dcb6['where']=qs[_0x19da73(0x108)](_[_0x19da73(0x15e)](_0x105291['query'],_0x5b450d[_0x19da73(0x108)])),_0x68dcb6=filterAttributes(_0x68dcb6,_0x105291[_0x19da73(0x127)][_0x19da73(0x13b)],_0x68dcb6[_0x19da73(0x153)],_0x105291[_0x19da73(0x11c)],![]),_0x3e7c88[_0x19da73(0x13f)](_0x68dcb6);})[_0x18aa2c(0x12e)](function(_0x4ba67d){const _0x5b38ed=_0x18aa2c;if(_0x4ba67d)return _0xb1094a=_0x4ba67d[_0x5b38ed(0x112)],typeof _0x105291[_0x5b38ed(0x127)]['nolimit']===_0x5b38ed(0x132)&&(_0x68dcb6['limit']=qs[_0x5b38ed(0x157)](_0x105291[_0x5b38ed(0x127)]['limit']),_0x68dcb6['offset']=qs[_0x5b38ed(0x11f)](_0x105291['query'][_0x5b38ed(0x11f)])),_0x3e7c88[_0x5b38ed(0x13f)](_0x68dcb6);})[_0x18aa2c(0x12e)](function(_0x55512e){if(_0x55512e)return _0x55512e?{'count':_0xb1094a,'rows':_0x55512e}:null;})[_0x18aa2c(0x12e)](respondWithResult(_0x730efe,null))[_0x18aa2c(0x136)](handleError(_0x730efe,null));};
\ No newline at end of file
+'use strict';const a585_0x3407=['addAgents','UserId','model','filter','create','body','order','from','stack','OpenchannelQueues','autoAssociation','register','findOne','merge','User','voicePause','updatedAt','interface','nolimit','includeAll','key','createdAt','transaction','destroy','37192hMrBwb','Content-Range','query','UserOpenchannelQueue','emit','19RjDLEl','flatMap','get','addTeams','undefined','1PXhWgG','pick','removeTeams','include','set','TeamId','catch','84319qMKSAU','SELECT','isEmpty','send','type','length','offset','intersection','OpenchannelQueueId','3fNrZxK','agent','map','tq.TeamId','lodash','findOrCreate','count','ut.TeamId\x20=\x20tq.TeamId','isArray','fieldName','fields','11555tVBIdu','openchannelPause','getMembers','compact','ut.UserId\x20=\x20?','rows','167LiFGOZ','options','getAgents','userOpenchannelQueue:save','join','311MkzjnP','status','getTeams','json','8pUCqGL','Team','sort','where','update','name','describe','api','all','select','attributes','Agents','keys','push','limit','union','removeAgents','end','filters','forEach','then','online','format','findAll','userProfileId','225753CymTIE','164551iUIrwQ','OpenchannelQueue','ids','params','show','error','user_has_teams','sendStatus','user','UserProfileSection','289919ymrdmY','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','@mysqldb','userOpenchannelQueue:remove','util','squel','every','sequelize','rawAttributes','./openchannelQueue.socket','@utils/filter-attributes'];const a585_0x4335=function(_0x3bccd6,_0x9cc2e1){_0x3bccd6=_0x3bccd6-0x1e6;let _0x340729=a585_0x3407[_0x3bccd6];return _0x340729;};const a585_0xba6e0=a585_0x4335;(function(_0x473ecd,_0x26ee77){const _0x21b9d3=a585_0x4335;while(!![]){try{const _0x524cc9=parseInt(_0x21b9d3(0x1e6))*parseInt(_0x21b9d3(0x1ef))+-parseInt(_0x21b9d3(0x222))*-parseInt(_0x21b9d3(0x25a))+parseInt(_0x21b9d3(0x209))*parseInt(_0x21b9d3(0x250))+-parseInt(_0x21b9d3(0x22d))+parseInt(_0x21b9d3(0x205))*parseInt(_0x21b9d3(0x200))+parseInt(_0x21b9d3(0x255))*-parseInt(_0x21b9d3(0x1fa))+-parseInt(_0x21b9d3(0x223));if(_0x524cc9===_0x26ee77)break;else _0x473ecd['push'](_0x473ecd['shift']());}catch(_0x491ffd){_0x473ecd['push'](_0x473ecd['shift']());}}}(a585_0x3407,0x25a38));const util=require(a585_0xba6e0(0x231)),_=require(a585_0xba6e0(0x1f3)),squel=require(a585_0xba6e0(0x232)),qs=require('@components/parsers/qs'),logger=require('@config/logger')(a585_0xba6e0(0x210)),{getSocket}=require('@rediscache'),socket=getSocket(),{db}=require(a585_0xba6e0(0x22f)),{QueryTypes}=require('sequelize'),{filterAttributes}=require(a585_0xba6e0(0x237));require(a585_0xba6e0(0x236))[a585_0xba6e0(0x243)](socket);function respondWithStatusCode(_0xbd7e31,_0x583ef4){return _0x583ef4=_0x583ef4||0xcc,function(_0x216908){const _0x2ec1cd=a585_0x4335;if(_0x216908)return _0xbd7e31[_0x2ec1cd(0x22a)](_0x583ef4);return _0xbd7e31['status'](_0x583ef4)['end']();};}function respondWithResult(_0x33178d,_0xd71efc){return _0xd71efc=_0xd71efc||0xc8,function(_0x40289a){const _0x1806bf=a585_0x4335;if(_0x40289a)return _0x33178d[_0x1806bf(0x206)](_0xd71efc)['json'](_0x40289a);};}function respondWithFilteredResult(_0x4f9305,_0x1a22b1){return function(_0x45802e){const _0x1f5cb5=a585_0x4335;if(_0x45802e){const _0x231b2d=_0x45802e[_0x1f5cb5(0x1f5)],_0x27d5e1=_0x1a22b1['offset'];let _0x17b239=_0x1a22b1[_0x1f5cb5(0x1ec)]+_0x1a22b1[_0x1f5cb5(0x217)],_0x3131ad;return _0x17b239>=_0x231b2d?(_0x17b239=_0x231b2d,_0x3131ad=0xc8):_0x3131ad=0xce,_0x4f9305['status'](_0x3131ad),_0x4f9305[_0x1f5cb5(0x25e)](_0x1f5cb5(0x251),_0x27d5e1+'-'+_0x17b239+'/'+_0x231b2d)[_0x1f5cb5(0x208)](_0x45802e);}return null;};}function saveUpdates(_0x11561a){return function(_0x339087){const _0x5468d7=a585_0x4335;if(_0x339087)return _0x339087[_0x5468d7(0x20d)](_0x11561a)[_0x5468d7(0x21d)](function(_0x13d434){return _0x13d434;});return null;};}function removeEntity(_0x239279){return function(_0x406ad5){const _0x716f85=a585_0x4335;if(_0x406ad5)return _0x406ad5[_0x716f85(0x24f)]()[_0x716f85(0x21d)](function(){const _0x25efd9=_0x716f85,_0x1b76a4=_0x406ad5[_0x25efd9(0x257)]({'plain':!![]}),_0x378a06=_0x25efd9(0x241);return db['UserProfileResource']['destroy']({'where':{'type':_0x378a06,'resourceId':_0x1b76a4['id']}})[_0x25efd9(0x21d)](function(){return _0x406ad5;});})[_0x716f85(0x21d)](function(){const _0x3ee414=_0x716f85;_0x239279[_0x3ee414(0x206)](0xcc)[_0x3ee414(0x21a)]();});};}function handleEntityNotFound(_0x818f7d){return function(_0x5256ec){const _0xdf62da=a585_0x4335;return!_0x5256ec&&_0x818f7d[_0xdf62da(0x22a)](0x194),_0x5256ec;};}function handleError(_0x41e060,_0x55e9b4){return _0x55e9b4=_0x55e9b4||0x1f4,function(_0x18f338){const _0x16fc2f=a585_0x4335;logger[_0x16fc2f(0x228)](_0x18f338[_0x16fc2f(0x240)]),_0x18f338[_0x16fc2f(0x20e)]&&delete _0x18f338['name'],_0x41e060[_0x16fc2f(0x206)](_0x55e9b4)[_0x16fc2f(0x1e9)](_0x18f338);};}exports['index']=function(_0x5fee6,_0x5511f2){const _0x7f3138=a585_0xba6e0;let _0x230a57={};const _0x469360={},_0x5ed93c={'count':0x0,'rows':[]},_0x1a84d8=_[_0x7f3138(0x1f1)](db['OpenchannelQueue'][_0x7f3138(0x235)],function(_0x30cc4c){const _0xb67073=_0x7f3138;return{'name':_0x30cc4c[_0xb67073(0x1f8)],'type':_0x30cc4c[_0xb67073(0x1ea)][_0xb67073(0x24c)]};});_0x469360[_0x7f3138(0x23a)]=_[_0x7f3138(0x1f1)](_0x1a84d8,'name'),_0x469360[_0x7f3138(0x252)]=_[_0x7f3138(0x215)](_0x5fee6[_0x7f3138(0x252)]),_0x469360['filters']=_[_0x7f3138(0x1ed)](_0x469360[_0x7f3138(0x23a)],_0x469360[_0x7f3138(0x252)]),_0x230a57[_0x7f3138(0x213)]=_[_0x7f3138(0x1ed)](_0x469360[_0x7f3138(0x23a)],qs[_0x7f3138(0x1f9)](_0x5fee6[_0x7f3138(0x252)]['fields'])),_0x230a57['attributes']=_0x230a57['attributes'][_0x7f3138(0x1eb)]?_0x230a57['attributes']:_0x469360[_0x7f3138(0x23a)];typeof _0x5fee6[_0x7f3138(0x252)][_0x7f3138(0x24a)]===_0x7f3138(0x259)&&(_0x230a57[_0x7f3138(0x217)]=qs[_0x7f3138(0x217)](_0x5fee6[_0x7f3138(0x252)]['limit']),_0x230a57[_0x7f3138(0x1ec)]=qs[_0x7f3138(0x1ec)](_0x5fee6[_0x7f3138(0x252)][_0x7f3138(0x1ec)]));_0x230a57[_0x7f3138(0x23e)]=qs['sort'](_0x5fee6[_0x7f3138(0x252)][_0x7f3138(0x20b)]),_0x230a57[_0x7f3138(0x20c)]=qs['filters'](_[_0x7f3138(0x25b)](_0x5fee6['query'],_0x469360['filters']),_0x1a84d8),_0x230a57=filterAttributes(_0x230a57,_0x5fee6[_0x7f3138(0x252)]['filter'],_0x1a84d8,_0x5fee6[_0x7f3138(0x201)]);const _0x166708={'where':_0x230a57[_0x7f3138(0x20c)]};return db[_0x7f3138(0x224)][_0x7f3138(0x1f5)](_0x166708)[_0x7f3138(0x21d)](function(_0x423fd6){const _0x4d88a7=_0x7f3138;return _0x5ed93c['count']=_0x423fd6,_0x5fee6['query']['includeAll']&&(_0x230a57[_0x4d88a7(0x25d)]=[{'all':!![]}]),db[_0x4d88a7(0x224)][_0x4d88a7(0x220)](_0x230a57);})[_0x7f3138(0x21d)](function(_0x18382e){return _0x5ed93c['rows']=_0x18382e,_0x5ed93c;})['then'](respondWithFilteredResult(_0x5511f2,_0x230a57))[_0x7f3138(0x260)](handleError(_0x5511f2,null));},exports[a585_0xba6e0(0x227)]=function(_0x3d6c8f,_0x4c31a4){const _0xd5bf86=a585_0xba6e0;let _0x138212={'raw':!![],'where':{'id':_0x3d6c8f[_0xd5bf86(0x226)]['id']}};const _0x3a251c={};return _0x3a251c['model']=_[_0xd5bf86(0x215)](db[_0xd5bf86(0x224)][_0xd5bf86(0x235)]),_0x3a251c[_0xd5bf86(0x252)]=_[_0xd5bf86(0x215)](_0x3d6c8f[_0xd5bf86(0x252)]),_0x3a251c[_0xd5bf86(0x21b)]=_['intersection'](_0x3a251c[_0xd5bf86(0x23a)],_0x3a251c[_0xd5bf86(0x252)]),_0x138212[_0xd5bf86(0x213)]=_['intersection'](_0x3a251c[_0xd5bf86(0x23a)],qs[_0xd5bf86(0x1f9)](_0x3d6c8f[_0xd5bf86(0x252)][_0xd5bf86(0x1f9)])),_0x138212[_0xd5bf86(0x213)]=_0x138212['attributes']['length']?_0x138212[_0xd5bf86(0x213)]:_0x3a251c['model'],_0x3d6c8f['query'][_0xd5bf86(0x24b)]&&(_0x138212['include']=[{'all':!![]}]),_0x138212=_[_0xd5bf86(0x245)]({},_0x138212,_0x3d6c8f[_0xd5bf86(0x201)]),db[_0xd5bf86(0x224)][_0xd5bf86(0x244)](_0x138212)[_0xd5bf86(0x21d)](handleEntityNotFound(_0x4c31a4,null))[_0xd5bf86(0x21d)](respondWithResult(_0x4c31a4,null))[_0xd5bf86(0x260)](handleError(_0x4c31a4,null));},exports[a585_0xba6e0(0x23c)]=function(_0x370719,_0x79ef8c){const _0x3549ef=a585_0xba6e0;return db[_0x3549ef(0x224)]['create'](_0x370719[_0x3549ef(0x23d)],{})['then'](function(_0x5cd732){const _0x29c3e9=_0x3549ef,_0x5c301a=_0x370719[_0x29c3e9(0x22b)][_0x29c3e9(0x257)]({'plain':!![]});if(!_0x5c301a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c301a['role']===_0x29c3e9(0x22b)){const _0x4db65d=_0x5cd732[_0x29c3e9(0x257)]({'plain':!![]}),_0x306ce9=_0x29c3e9(0x241);return db[_0x29c3e9(0x22c)]['findOne']({'where':{'name':_0x306ce9,'userProfileId':_0x5c301a[_0x29c3e9(0x221)]},'raw':!![]})['then'](function(_0x14c57c){const _0x240547=_0x29c3e9;return _0x14c57c&&_0x14c57c[_0x240547(0x242)]===0x0?db['UserProfileResource'][_0x240547(0x23c)]({'name':_0x4db65d['name'],'resourceId':_0x4db65d['id'],'type':_0x14c57c[_0x240547(0x20e)],'sectionId':_0x14c57c['id']},{})[_0x240547(0x21d)](function(){return _0x5cd732;}):_0x5cd732;})[_0x29c3e9(0x260)](function(_0x16d8d5){const _0x11488a=_0x29c3e9;logger['error'](_0x11488a(0x22e),_0x16d8d5);throw _0x16d8d5;});}return _0x5cd732;})[_0x3549ef(0x21d)](respondWithResult(_0x79ef8c,0xc9))[_0x3549ef(0x260)](handleError(_0x79ef8c,null));},exports[a585_0xba6e0(0x20d)]=function(_0x5aa5ff,_0x5e912f){const _0x29777a=a585_0xba6e0;return _0x5aa5ff['body']['id']&&delete _0x5aa5ff[_0x29777a(0x23d)]['id'],db[_0x29777a(0x224)][_0x29777a(0x244)]({'where':{'id':_0x5aa5ff[_0x29777a(0x226)]['id']}})[_0x29777a(0x21d)](handleEntityNotFound(_0x5e912f,null))['then'](saveUpdates(_0x5aa5ff[_0x29777a(0x23d)],null))['then'](respondWithResult(_0x5e912f,null))['catch'](handleError(_0x5e912f,null));},exports['destroy']=function(_0x4eeb6c,_0xb250b5){const _0x100b83=a585_0xba6e0;return db[_0x100b83(0x224)][_0x100b83(0x244)]({'where':{'id':_0x4eeb6c[_0x100b83(0x226)]['id']}})[_0x100b83(0x21d)](handleEntityNotFound(_0xb250b5,null))['then'](removeEntity(_0xb250b5,null))['catch'](handleError(_0xb250b5,null));},exports[a585_0xba6e0(0x20f)]=function(_0x48dc67,_0x285030){const _0x4fb7f4=a585_0xba6e0;return db[_0x4fb7f4(0x224)][_0x4fb7f4(0x20f)]()['then'](respondWithResult(_0x285030,null))[_0x4fb7f4(0x260)](handleError(_0x285030,null));},exports[a585_0xba6e0(0x1fc)]=function(_0x5c451f,_0x191b66){const _0x12c6fc=a585_0xba6e0;let _0x5abc3e={'raw':!![],'where':{}};const _0x2b1b8c={};let _0x2e7c75;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x5c451f[_0x12c6fc(0x226)]['id']}})[_0x12c6fc(0x21d)](handleEntityNotFound(_0x191b66,null))[_0x12c6fc(0x21d)](function(_0xcd06bc){const _0x3db8b4=_0x12c6fc;if(_0xcd06bc)return _0x2e7c75=_0xcd06bc['get']({'plain':!![]}),_0x2b1b8c[_0x3db8b4(0x23a)]=_[_0x3db8b4(0x215)](db[_0x3db8b4(0x253)][_0x3db8b4(0x235)]),_0x2b1b8c['query']=_['keys'](_0x5c451f[_0x3db8b4(0x252)]),_0x2b1b8c['filters']=_['intersection'](_0x2b1b8c[_0x3db8b4(0x23a)],_0x2b1b8c[_0x3db8b4(0x252)]),_0x5abc3e[_0x3db8b4(0x213)]=_[_0x3db8b4(0x1ed)](_0x2b1b8c[_0x3db8b4(0x23a)],qs[_0x3db8b4(0x1f9)](_0x5c451f['query'][_0x3db8b4(0x1f9)])),_0x5abc3e[_0x3db8b4(0x213)]=_0x5abc3e[_0x3db8b4(0x213)][_0x3db8b4(0x1eb)]?_0x5abc3e[_0x3db8b4(0x213)]:_0x2b1b8c['model'],typeof _0x5c451f[_0x3db8b4(0x252)]['nolimit']===_0x3db8b4(0x259)&&(_0x5abc3e[_0x3db8b4(0x217)]=qs[_0x3db8b4(0x217)](_0x5c451f[_0x3db8b4(0x252)][_0x3db8b4(0x217)]),_0x5abc3e[_0x3db8b4(0x1ec)]=qs[_0x3db8b4(0x1ec)](_0x5c451f[_0x3db8b4(0x252)][_0x3db8b4(0x1ec)])),_0x5abc3e['order']=qs[_0x3db8b4(0x20b)](_0x5c451f['query']['sort']),_0x5abc3e[_0x3db8b4(0x20c)]=qs['filters'](_[_0x3db8b4(0x25b)](_0x5c451f[_0x3db8b4(0x252)],_0x2b1b8c['filters'])),_0x5abc3e[_0x3db8b4(0x20c)][_0x3db8b4(0x1ee)]=_0xcd06bc['id'],_0x5abc3e=filterAttributes(_0x5abc3e,_0x5c451f[_0x3db8b4(0x252)][_0x3db8b4(0x23b)],_0x5abc3e[_0x3db8b4(0x213)],_0x5c451f['options'],![]),db[_0x3db8b4(0x253)][_0x3db8b4(0x220)](_0x5abc3e);})[_0x12c6fc(0x21d)](function(_0x5c038a){const _0xf79ab3=_0x12c6fc;if(_0x5c038a)return db['User']['findAndCountAll']({'where':{'id':_[_0xf79ab3(0x1f1)](_0x5c038a,_0xf79ab3(0x239)),'role':_0xf79ab3(0x1f0)},'attributes':['id',_0xf79ab3(0x20e),_0xf79ab3(0x1fb),_0xf79ab3(0x248),_0xf79ab3(0x24d)]});})['then'](function(_0x2dfa9a){const _0x52a87e=_0x12c6fc;return _0x2dfa9a?{'count':_0x2dfa9a[_0x52a87e(0x1f5)],'rows':_[_0x52a87e(0x1f1)](_0x2dfa9a[_0x52a87e(0x1ff)],function(_0x28b69b){const _0xdd3bdd=_0x52a87e;return{'membername':_0x28b69b[_0xdd3bdd(0x20e)],'UserId':_0x28b69b['id'],'queue_name':_0x2e7c75[_0xdd3bdd(0x20e)],'OpenchannelQueueId':_0x2e7c75['id'],'interface':util[_0xdd3bdd(0x21f)]('%s/%s','SIP',_0x28b69b[_0xdd3bdd(0x20e)]),'penalty':0x0,'paused':_0x28b69b[_0xdd3bdd(0x1fb)],'createdAt':_0x28b69b[_0xdd3bdd(0x24d)],'updatedAt':_0x28b69b[_0xdd3bdd(0x248)]};})}:{'count':0x0,'rows':[]};})[_0x12c6fc(0x21d)](respondWithFilteredResult(_0x191b66,_0x5abc3e))[_0x12c6fc(0x260)](handleError(_0x191b66,null));},exports[a585_0xba6e0(0x207)]=function(_0x2c5b6c,_0xedbe65){const _0x4a919a=a585_0xba6e0;let _0xf9063c={};const _0x5e331b={};let _0x49249f,_0x111cdc;return db[_0x4a919a(0x224)]['findOne']({'where':{'id':_0x2c5b6c['params']['id']}})['then'](handleEntityNotFound(_0xedbe65,null))[_0x4a919a(0x21d)](function(_0x392d4c){const _0x3a675a=_0x4a919a;if(_0x392d4c)return _0x49249f=_0x392d4c,_0x5e331b[_0x3a675a(0x23a)]=_['keys'](db[_0x3a675a(0x20a)]['rawAttributes']),_0x5e331b[_0x3a675a(0x252)]=_[_0x3a675a(0x215)](_0x2c5b6c[_0x3a675a(0x252)]),_0x5e331b[_0x3a675a(0x21b)]=_[_0x3a675a(0x1ed)](_0x5e331b[_0x3a675a(0x23a)],_0x5e331b['query']),_0xf9063c[_0x3a675a(0x213)]=_[_0x3a675a(0x1ed)](_0x5e331b[_0x3a675a(0x23a)],qs[_0x3a675a(0x1f9)](_0x2c5b6c[_0x3a675a(0x252)]['fields'])),_0xf9063c[_0x3a675a(0x213)]=_0xf9063c['attributes'][_0x3a675a(0x1eb)]?_0xf9063c[_0x3a675a(0x213)]:_0x5e331b['model'],_0xf9063c[_0x3a675a(0x23e)]=qs[_0x3a675a(0x20b)](_0x2c5b6c[_0x3a675a(0x252)][_0x3a675a(0x20b)]),_0xf9063c[_0x3a675a(0x20c)]=qs[_0x3a675a(0x21b)](_[_0x3a675a(0x25b)](_0x2c5b6c['query'],_0x5e331b[_0x3a675a(0x21b)])),_0xf9063c=filterAttributes(_0xf9063c,_0x2c5b6c['query'][_0x3a675a(0x23b)],_0xf9063c[_0x3a675a(0x213)],_0x2c5b6c[_0x3a675a(0x201)],![]),_0x49249f['getTeams'](_0xf9063c);})[_0x4a919a(0x21d)](function(_0x2aea16){const _0x4602b5=_0x4a919a;if(_0x2aea16)return _0x111cdc=_0x2aea16[_0x4602b5(0x1eb)],typeof _0x2c5b6c[_0x4602b5(0x252)][_0x4602b5(0x24a)]==='undefined'&&(_0xf9063c[_0x4602b5(0x217)]=qs['limit'](_0x2c5b6c['query'][_0x4602b5(0x217)]),_0xf9063c[_0x4602b5(0x1ec)]=qs[_0x4602b5(0x1ec)](_0x2c5b6c['query'][_0x4602b5(0x1ec)])),_0x49249f[_0x4602b5(0x207)](_0xf9063c);})[_0x4a919a(0x21d)](function(_0x493383){if(_0x493383)return _0x493383?{'count':_0x111cdc,'rows':_0x493383}:null;})[_0x4a919a(0x21d)](respondWithResult(_0xedbe65,null))[_0x4a919a(0x260)](handleError(_0xedbe65,null));},exports[a585_0xba6e0(0x258)]=function(_0x29778d,_0x7ef601){const _0x4259fc=a585_0xba6e0,_0x50917e=_0x29778d[_0x4259fc(0x23d)]['ids'];return db[_0x4259fc(0x20a)][_0x4259fc(0x220)]({'where':{'id':_0x50917e},'attributes':['id'],'include':[{'model':db[_0x4259fc(0x246)],'as':_0x4259fc(0x214),'attributes':['id',_0x4259fc(0x20e),_0x4259fc(0x21e),_0x4259fc(0x247),_0x4259fc(0x249)],'raw':!![]}]})['then'](function(_0x25cf9d){const _0xae6a94=_0x4259fc;if(_0x25cf9d){const _0x5a7eea=_[_0xae6a94(0x256)](_0x25cf9d,function(_0x607a37){const _0x4077fd=_0xae6a94,_0xdce196=_0x607a37[_0x4077fd(0x257)]({'plain':!![]});return _0xdce196[_0x4077fd(0x214)];});return db[_0xae6a94(0x224)][_0xae6a94(0x244)]({'where':{'id':_0x29778d['params']['id']}})['then'](function(_0x22a259){const _0x458782=_0xae6a94;return db[_0x458782(0x234)][_0x458782(0x24e)](function(_0x5a7ddd){const _0x163266=_0x458782;return _0x22a259['addTeams'](_0x50917e,{'transaction':_0x5a7ddd})[_0x163266(0x21d)](function(){const _0x6e498a=_0x163266;return Promise[_0x6e498a(0x211)](_0x5a7eea[_0x6e498a(0x1f1)](_0x1f4c10=>{const _0x132b89=_0x6e498a;return db['UserOpenchannelQueue'][_0x132b89(0x1f4)]({'where':{'UserId':_0x1f4c10['id'],'OpenchannelQueueId':_0x29778d[_0x132b89(0x226)]['id']},'transaction':_0x5a7ddd});}));})['then'](function(){const _0x178a1e=_0x163266;_0x5a7eea[_0x178a1e(0x21c)](function(_0x5dbb10){const _0x28f157=_0x178a1e;socket[_0x28f157(0x254)]('userOpenchannelQueue:save',{'UserId':_0x5dbb10['id'],'OpenchannelQueueId':_0x22a259['id']});});});});});}})[_0x4259fc(0x21d)](respondWithStatusCode(_0x7ef601,null))[_0x4259fc(0x260)](handleError(_0x7ef601,null));},exports[a585_0xba6e0(0x25c)]=function(_0x346024,_0x2197d2){const _0x319758=a585_0xba6e0;return db['Team'][_0x319758(0x220)]({'where':{'id':_0x346024['query'][_0x319758(0x225)]},'attributes':['id'],'include':[{'model':db[_0x319758(0x246)],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2197d2,null))[_0x319758(0x21d)](function(_0x5dc0b5){const _0x430911=_0x319758,_0x2ec665=_[_0x430911(0x1f1)](_0x5dc0b5,'id');let _0x253837=[];const _0x2ef5a5=[],_0x142e32=squel[_0x430911(0x212)]();_0x142e32['field'](_0x430911(0x1f2))[_0x430911(0x23f)]('team_has_openchannel_queues','tq')[_0x430911(0x204)](_0x430911(0x229),'ut',_0x430911(0x1f6))[_0x430911(0x20c)]('OpenchannelQueueId\x20=\x20?',_0x346024['params']['id']);for(let _0x560b0f=0x0;_0x560b0f<_0x5dc0b5[_0x430911(0x1eb)];_0x560b0f+=0x1){const _0x56efc6=_0x5dc0b5[_0x560b0f];for(let _0x37adfb=0x0;_0x37adfb<_0x56efc6[_0x430911(0x214)][_0x430911(0x1eb)];_0x37adfb+=0x1){const _0x4eb891=_0x56efc6[_0x430911(0x214)][_0x37adfb],_0x228b77=_0x142e32['clone']();_0x228b77[_0x430911(0x20c)](_0x430911(0x1fe),_0x4eb891['id']),_0x2ef5a5[_0x430911(0x216)](db['sequelize']['query'](_0x228b77['toString'](),{'type':QueryTypes[_0x430911(0x1e7)]})[_0x430911(0x21d)](function(_0x4335fc){const _0x28cd76=_0x430911;if(_0x4335fc[_0x28cd76(0x1eb)]===0x1)return _0x4eb891['id'];else{const _0x580320=_[_0x28cd76(0x233)](_[_0x28cd76(0x1f1)](_0x4335fc,_0x28cd76(0x25f)),function(_0x58b7f1){return _['includes'](_0x2ec665,_0x58b7f1);});if(_0x580320)return _0x4eb891['id'];}}));}}return Promise[_0x430911(0x211)](_0x2ef5a5)['then'](function(_0x496b9b){const _0x4a9cf5=_0x430911;return _0x253837=_(_0x253837)[_0x4a9cf5(0x218)](_0x496b9b)[_0x4a9cf5(0x1fd)]()['value'](),db[_0x4a9cf5(0x224)][_0x4a9cf5(0x244)]({'where':{'id':_0x346024[_0x4a9cf5(0x226)]['id']}})[_0x4a9cf5(0x21d)](function(_0x5db3c5){return db['sequelize']['transaction'](function(_0x3af74e){const _0x32ccac=a585_0x4335;return _0x5db3c5[_0x32ccac(0x25c)](_0x346024[_0x32ccac(0x252)][_0x32ccac(0x225)],{'transaction':_0x3af74e})[_0x32ccac(0x21d)](function(){const _0x4e6aeb=_0x32ccac;if(!_[_0x4e6aeb(0x1e8)](_0x253837))return _0x5db3c5['removeAgents'](_0x253837,{'transaction':_0x3af74e});})['then'](function(){const _0x10a128=_0x32ccac;_0x253837[_0x10a128(0x21c)](function(_0x47367e){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x47367e,'OpenchannelQueueId':_0x5db3c5['id']});});});});});});})[_0x319758(0x21d)](respondWithStatusCode(_0x2197d2,null))[_0x319758(0x260)](handleError(_0x2197d2,null));},exports[a585_0xba6e0(0x238)]=function(_0x2c0cae,_0x5ec338){const _0x4e4335=a585_0xba6e0;return db[_0x4e4335(0x224)][_0x4e4335(0x244)]({'where':{'id':_0x2c0cae[_0x4e4335(0x226)]['id']}})[_0x4e4335(0x21d)](function(_0x23ccc1){const _0x17fda8=_0x4e4335;if(_0x23ccc1)return _0x23ccc1[_0x17fda8(0x238)](_0x2c0cae[_0x17fda8(0x23d)][_0x17fda8(0x225)],{'through':_['omit'](_0x2c0cae['body'],['ids','id'])})['then'](function(_0xc44d72){const _0x5105bf=_0x17fda8;for(let _0x4d334a=0x0;_0x4d334a<_0x2c0cae[_0x5105bf(0x23d)]['ids']['length'];_0x4d334a+=0x1){socket[_0x5105bf(0x254)](_0x5105bf(0x203),{'UserId':_0x2c0cae[_0x5105bf(0x23d)][_0x5105bf(0x225)][_0x4d334a],'OpenchannelQueueId':_0x2c0cae[_0x5105bf(0x226)]['id']});}return _0xc44d72;});})['then'](respondWithResult(_0x5ec338,null))[_0x4e4335(0x260)](handleError(_0x5ec338,null));},exports[a585_0xba6e0(0x219)]=function(_0xa2081c,_0x3cbe10){const _0x117cf4=a585_0xba6e0;return db[_0x117cf4(0x224)][_0x117cf4(0x244)]({'where':{'id':_0xa2081c[_0x117cf4(0x226)]['id']}})[_0x117cf4(0x21d)](handleEntityNotFound(_0x3cbe10,null))[_0x117cf4(0x21d)](function(_0x4713fb){const _0x43abf2=_0x117cf4;if(_0x4713fb)return _0x4713fb[_0x43abf2(0x219)](_0xa2081c[_0x43abf2(0x252)][_0x43abf2(0x225)])[_0x43abf2(0x21d)](function(){const _0x5a3351=_0x43abf2;if(_[_0x5a3351(0x1f7)](_0xa2081c[_0x5a3351(0x252)][_0x5a3351(0x225)]))for(let _0x57c046=0x0;_0x57c046<_0xa2081c[_0x5a3351(0x252)]['ids']['length'];_0x57c046+=0x1){socket[_0x5a3351(0x254)](_0x5a3351(0x230),{'UserId':Number(_0xa2081c[_0x5a3351(0x252)][_0x5a3351(0x225)][_0x57c046]),'OpenchannelQueueId':Number(_0xa2081c['params']['id'])});}else socket[_0x5a3351(0x254)](_0x5a3351(0x230),{'UserId':Number(_0xa2081c[_0x5a3351(0x252)][_0x5a3351(0x225)]),'OpenchannelQueueId':Number(_0xa2081c['params']['id'])});});})[_0x117cf4(0x21d)](respondWithStatusCode(_0x3cbe10,null))[_0x117cf4(0x260)](handleError(_0x3cbe10,null));},exports[a585_0xba6e0(0x202)]=function(_0x52e5ce,_0x320ab4){const _0x39eb58=a585_0xba6e0;let _0x492ddd={};const _0x42eef1={};let _0x2a996a,_0x285fec;return db[_0x39eb58(0x224)][_0x39eb58(0x244)]({'where':{'id':_0x52e5ce[_0x39eb58(0x226)]['id']}})[_0x39eb58(0x21d)](handleEntityNotFound(_0x320ab4,null))[_0x39eb58(0x21d)](function(_0x4b7f08){const _0x3c44f6=_0x39eb58;if(_0x4b7f08)return _0x2a996a=_0x4b7f08,_0x42eef1[_0x3c44f6(0x23a)]=_['keys'](db[_0x3c44f6(0x246)][_0x3c44f6(0x235)]),_0x42eef1['query']=_['keys'](_0x52e5ce[_0x3c44f6(0x252)]),_0x42eef1[_0x3c44f6(0x21b)]=_[_0x3c44f6(0x1ed)](_0x42eef1['model'],_0x42eef1[_0x3c44f6(0x252)]),_0x492ddd['attributes']=_[_0x3c44f6(0x1ed)](_0x42eef1[_0x3c44f6(0x23a)],qs[_0x3c44f6(0x1f9)](_0x52e5ce[_0x3c44f6(0x252)]['fields'])),_0x492ddd[_0x3c44f6(0x213)]=_0x492ddd[_0x3c44f6(0x213)][_0x3c44f6(0x1eb)]?_0x492ddd['attributes']:_0x42eef1[_0x3c44f6(0x23a)],_0x492ddd['order']=qs['sort'](_0x52e5ce[_0x3c44f6(0x252)]['sort']),_0x492ddd[_0x3c44f6(0x20c)]=qs['filters'](_[_0x3c44f6(0x25b)](_0x52e5ce[_0x3c44f6(0x252)],_0x42eef1[_0x3c44f6(0x21b)])),_0x492ddd=filterAttributes(_0x492ddd,_0x52e5ce['query']['filter'],_0x492ddd['attributes'],_0x52e5ce['options'],![]),_0x2a996a[_0x3c44f6(0x202)](_0x492ddd);})[_0x39eb58(0x21d)](function(_0x3dd0c2){const _0x56558d=_0x39eb58;if(_0x3dd0c2)return _0x285fec=_0x3dd0c2['length'],typeof _0x52e5ce[_0x56558d(0x252)][_0x56558d(0x24a)]==='undefined'&&(_0x492ddd[_0x56558d(0x217)]=qs[_0x56558d(0x217)](_0x52e5ce[_0x56558d(0x252)][_0x56558d(0x217)]),_0x492ddd[_0x56558d(0x1ec)]=qs[_0x56558d(0x1ec)](_0x52e5ce[_0x56558d(0x252)][_0x56558d(0x1ec)])),_0x2a996a[_0x56558d(0x202)](_0x492ddd);})[_0x39eb58(0x21d)](function(_0x3f5988){if(_0x3f5988)return _0x3f5988?{'count':_0x285fec,'rows':_0x3f5988}:null;})[_0x39eb58(0x21d)](respondWithResult(_0x320ab4,null))[_0x39eb58(0x260)](handleError(_0x320ab4,null));};
\ No newline at end of file