Built motion from commit ecdc8e66766c75b1b08288b0ea13eb12d42606b4. Version 3.0.0...
[motion-next.git] / server / api / faxQueue / faxQueue.controller.js
index 7932ed1..748d7ac 100644 (file)
@@ -1 +1 @@
-const a212_0x1e88=['getTeams','forEach','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','ut.UserId\x20=\x20?','nolimit','FaxQueueId','filters','findAndCountAll','get','addTeams','params','FaxQueues','team_has_fax_queues','userFaxQueue:save','all','send','catch','agent','UserProfileSection','SELECT','status','Agents','create','index','../../rediscache','util','createdAt','voicePause','user_has_teams','model','Team','lodash','transaction','type','includes','value','rows','user','removeAgents','ids','../../components/parsers/qs','limit','like','from','select','fields','Content-Range','join','tq.TeamId','%s/%s','sort','where','userFaxQueue:remove','UserFaxQueue','then','../../mysqldb','show','sequelize','SIP','query','rawAttributes','destroy','User','field','userProfileId','options','intersection','FaxQueue','keys','end','undefined','TeamId','name','describe','union','isEmpty','order','key','length','push','each','format','removeTeams','fieldName','pick','isArray','includeAll','every','getAgents','findOne','toString','register','addAgents','offset','attributes','sendStatus','filter','merge','faxPause','./faxQueue.socket','findAll','flatMap','getMembers','count','updatedAt','map','emit','ut.TeamId\x20=\x20tq.TeamId','update','findOrCreate','body','role','json'];(function(_0x594008,_0x1e88e8){const _0x434d3b=function(_0x2d9e08){while(--_0x2d9e08){_0x594008['push'](_0x594008['shift']());}};_0x434d3b(++_0x1e88e8);}(a212_0x1e88,0x8d));const a212_0x434d=function(_0x594008,_0x1e88e8){_0x594008=_0x594008-0x0;let _0x434d3b=a212_0x1e88[_0x594008];return _0x434d3b;};const _0x3ed893=a212_0x434d;'use strict';const util=require(_0x3ed893('0x6e')),_=require(_0x3ed893('0x3')),squel=require('squel'),qs=require(_0x3ed893('0xc')),logger=require('../../config/logger')('api'),{getSocket}=require(_0x3ed893('0x6d')),socket=getSocket(),db=require(_0x3ed893('0x1b'))['db'],{Op,QueryTypes}=require(_0x3ed893('0x1d'));require(_0x3ed893('0x47'))[_0x3ed893('0x3f')](socket);function respondWithStatusCode(_0x2d9e08,_0x40d6a5){return _0x40d6a5=_0x40d6a5||0xcc,function(_0x16e90f){const _0x34ae9b=a212_0x434d;if(_0x16e90f)return _0x2d9e08[_0x34ae9b('0x43')](_0x40d6a5);return _0x2d9e08[_0x34ae9b('0x69')](_0x40d6a5)[_0x34ae9b('0x29')]();};}function respondWithResult(_0x21afc0,_0x3c8d79){return _0x3c8d79=_0x3c8d79||0xc8,function(_0x20a058){const _0x416589=a212_0x434d;if(_0x20a058)return _0x21afc0[_0x416589('0x69')](_0x3c8d79)[_0x416589('0x54')](_0x20a058);};}function respondWithFilteredResult(_0x1c15bd,_0x46becc){return function(_0x5c1d7a){const _0x481fbc=a212_0x434d;if(_0x5c1d7a){const _0x44d1b2=_0x5c1d7a[_0x481fbc('0x4b')],_0x2bea25=_0x46becc[_0x481fbc('0x41')];let _0x12dab6=_0x46becc['offset']+_0x46becc[_0x481fbc('0xd')],_0x5bc47e;return _0x12dab6>=_0x44d1b2?(_0x12dab6=_0x44d1b2,_0x5bc47e=0xc8):_0x5bc47e=0xce,_0x1c15bd[_0x481fbc('0x69')](_0x5bc47e),_0x1c15bd['set'](_0x481fbc('0x12'),_0x2bea25+'-'+_0x12dab6+'/'+_0x44d1b2)[_0x481fbc('0x54')](_0x5c1d7a);}return null;};}function saveUpdates(_0x3e5bf8){return function(_0x3b748c){const _0x16294f=a212_0x434d;if(_0x3b748c)return _0x3b748c[_0x16294f('0x50')](_0x3e5bf8)[_0x16294f('0x1a')](function(_0x18e4c8){return _0x18e4c8;});return null;};}function removeEntity(_0x5d2486){return function(_0x25f9ae){const _0x30035a=a212_0x434d;if(_0x25f9ae)return _0x25f9ae[_0x30035a('0x21')]()['then'](function(){const _0xddb8bd=_0x30035a,_0x580886=_0x25f9ae[_0xddb8bd('0x5d')]({'plain':!![]}),_0x365fb8='FaxQueues';return db['UserProfileResource'][_0xddb8bd('0x21')]({'where':{'type':_0x365fb8,'resourceId':_0x580886['id']}})['then'](function(){return _0x25f9ae;});})[_0x30035a('0x1a')](function(){_0x5d2486['status'](0xcc)['end']();});};}function handleEntityNotFound(_0x582152){return function(_0x3e81f7){return!_0x3e81f7&&_0x582152['sendStatus'](0x194),_0x3e81f7;};}function handleError(_0x1a72ef,_0x1a67c6){return _0x1a67c6=_0x1a67c6||0x1f4,function(_0x1afad2){const _0x424f30=a212_0x434d;logger['error'](_0x1afad2['stack']),_0x1afad2[_0x424f30('0x2c')]&&delete _0x1afad2[_0x424f30('0x2c')],_0x1a72ef[_0x424f30('0x69')](_0x1a67c6)[_0x424f30('0x64')](_0x1afad2);};}exports[_0x3ed893('0x6c')]=function(_0x578765,_0x2ef16a){const _0x45c14e=_0x3ed893;let _0x5aaba2={};const _0x3f8e0b={},_0x5e7138={'count':0x0,'rows':[]},_0x507a58=_[_0x45c14e('0x4d')](db['FaxQueue'][_0x45c14e('0x20')],function(_0x39cf1d){const _0x4f49c8=_0x45c14e;return{'name':_0x39cf1d[_0x4f49c8('0x37')],'type':_0x39cf1d[_0x4f49c8('0x5')][_0x4f49c8('0x31')]};});_0x3f8e0b[_0x45c14e('0x1')]=_['map'](_0x507a58,_0x45c14e('0x2c')),_0x3f8e0b[_0x45c14e('0x1f')]=_[_0x45c14e('0x28')](_0x578765[_0x45c14e('0x1f')]),_0x3f8e0b[_0x45c14e('0x5b')]=_[_0x45c14e('0x26')](_0x3f8e0b['model'],_0x3f8e0b[_0x45c14e('0x1f')]),_0x5aaba2[_0x45c14e('0x42')]=_['intersection'](_0x3f8e0b[_0x45c14e('0x1')],qs[_0x45c14e('0x11')](_0x578765[_0x45c14e('0x1f')][_0x45c14e('0x11')])),_0x5aaba2[_0x45c14e('0x42')]=_0x5aaba2[_0x45c14e('0x42')][_0x45c14e('0x32')]?_0x5aaba2[_0x45c14e('0x42')]:_0x3f8e0b[_0x45c14e('0x1')];typeof _0x578765[_0x45c14e('0x1f')][_0x45c14e('0x59')]===_0x45c14e('0x2a')&&(_0x5aaba2['limit']=qs['limit'](_0x578765['query'][_0x45c14e('0xd')]),_0x5aaba2[_0x45c14e('0x41')]=qs[_0x45c14e('0x41')](_0x578765[_0x45c14e('0x1f')][_0x45c14e('0x41')]));_0x5aaba2[_0x45c14e('0x30')]=qs[_0x45c14e('0x16')](_0x578765[_0x45c14e('0x1f')][_0x45c14e('0x16')]),_0x5aaba2[_0x45c14e('0x17')]=qs[_0x45c14e('0x5b')](_[_0x45c14e('0x38')](_0x578765['query'],_0x3f8e0b[_0x45c14e('0x5b')]),_0x507a58);_0x578765[_0x45c14e('0x1f')][_0x45c14e('0x44')]&&(_0x5aaba2[_0x45c14e('0x17')]=_[_0x45c14e('0x45')](_0x5aaba2['where'],{[Op['or']]:_[_0x45c14e('0x4d')](_0x507a58,function(_0xf42323){const _0x182e95=_0x45c14e;if(_0xf42323[_0x182e95('0x5')]!=='VIRTUAL'){const _0x5ca313={};return _0x5ca313[_0xf42323['name']]={[Op['like']]:'%'+_0x578765[_0x182e95('0x1f')][_0x182e95('0x44')]+'%'},_0x5ca313;}})}));_0x5aaba2=_['merge']({},_0x5aaba2,_0x578765[_0x45c14e('0x25')]);const _0x481e63={'where':_0x5aaba2[_0x45c14e('0x17')]};return db[_0x45c14e('0x27')][_0x45c14e('0x4b')](_0x481e63)[_0x45c14e('0x1a')](function(_0xcbf80c){const _0x5dbc6f=_0x45c14e;return _0x5e7138[_0x5dbc6f('0x4b')]=_0xcbf80c,_0x578765['query'][_0x5dbc6f('0x3a')]&&(_0x5aaba2['include']=[{'all':!![]}]),db[_0x5dbc6f('0x27')][_0x5dbc6f('0x48')](_0x5aaba2);})[_0x45c14e('0x1a')](function(_0x2b71de){return _0x5e7138['rows']=_0x2b71de,_0x5e7138;})['then'](respondWithFilteredResult(_0x2ef16a,_0x5aaba2))['catch'](handleError(_0x2ef16a,null));},exports[_0x3ed893('0x1c')]=function(_0x2272e7,_0x49fd16){const _0x1a0593=_0x3ed893;let _0x22d54f={'raw':!![],'where':{'id':_0x2272e7[_0x1a0593('0x5f')]['id']}};const _0x20963f={};return _0x20963f[_0x1a0593('0x1')]=_[_0x1a0593('0x28')](db['FaxQueue'][_0x1a0593('0x20')]),_0x20963f[_0x1a0593('0x1f')]=_['keys'](_0x2272e7[_0x1a0593('0x1f')]),_0x20963f[_0x1a0593('0x5b')]=_[_0x1a0593('0x26')](_0x20963f[_0x1a0593('0x1')],_0x20963f['query']),_0x22d54f[_0x1a0593('0x42')]=_[_0x1a0593('0x26')](_0x20963f[_0x1a0593('0x1')],qs['fields'](_0x2272e7[_0x1a0593('0x1f')][_0x1a0593('0x11')])),_0x22d54f[_0x1a0593('0x42')]=_0x22d54f['attributes'][_0x1a0593('0x32')]?_0x22d54f['attributes']:_0x20963f[_0x1a0593('0x1')],_0x2272e7['query']['includeAll']&&(_0x22d54f['include']=[{'all':!![]}]),_0x22d54f=_[_0x1a0593('0x45')]({},_0x22d54f,_0x2272e7[_0x1a0593('0x25')]),db[_0x1a0593('0x27')][_0x1a0593('0x3d')](_0x22d54f)[_0x1a0593('0x1a')](handleEntityNotFound(_0x49fd16,null))[_0x1a0593('0x1a')](respondWithResult(_0x49fd16,null))[_0x1a0593('0x65')](handleError(_0x49fd16,null));},exports[_0x3ed893('0x6b')]=function(_0x46b1c6,_0x584f64){const _0x581b0a=_0x3ed893;return db['FaxQueue'][_0x581b0a('0x6b')](_0x46b1c6[_0x581b0a('0x52')],{})[_0x581b0a('0x1a')](function(_0x1785b3){const _0x311d28=_0x581b0a,_0x429f78=_0x46b1c6[_0x311d28('0x9')][_0x311d28('0x5d')]({'plain':!![]});if(!_0x429f78)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x429f78[_0x311d28('0x53')]==='user'){const _0x2f7cef=_0x1785b3[_0x311d28('0x5d')]({'plain':!![]}),_0x49e92f=_0x311d28('0x60');return db[_0x311d28('0x67')][_0x311d28('0x3d')]({'where':{'name':_0x49e92f,'userProfileId':_0x429f78[_0x311d28('0x24')]},'raw':!![]})['then'](function(_0x4a2ce1){const _0x4beef7=_0x311d28;return _0x4a2ce1&&_0x4a2ce1['autoAssociation']===0x0?db['UserProfileResource'][_0x4beef7('0x6b')]({'name':_0x2f7cef[_0x4beef7('0x2c')],'resourceId':_0x2f7cef['id'],'type':_0x4a2ce1[_0x4beef7('0x2c')],'sectionId':_0x4a2ce1['id']},{})[_0x4beef7('0x1a')](function(){return _0x1785b3;}):_0x1785b3;})[_0x311d28('0x65')](function(_0x1acc71){const _0x197b72=_0x311d28;logger['error'](_0x197b72('0x57'),_0x1acc71);throw _0x1acc71;});}return _0x1785b3;})[_0x581b0a('0x1a')](respondWithResult(_0x584f64,0xc9))['catch'](handleError(_0x584f64,null));},exports[_0x3ed893('0x50')]=function(_0x39377e,_0x41c376){const _0xc85dff=_0x3ed893;return _0x39377e['body']['id']&&delete _0x39377e[_0xc85dff('0x52')]['id'],db[_0xc85dff('0x27')]['findOne']({'where':{'id':_0x39377e[_0xc85dff('0x5f')]['id']}})[_0xc85dff('0x1a')](handleEntityNotFound(_0x41c376,null))[_0xc85dff('0x1a')](saveUpdates(_0x39377e[_0xc85dff('0x52')],null))[_0xc85dff('0x1a')](respondWithResult(_0x41c376,null))['catch'](handleError(_0x41c376,null));},exports['destroy']=function(_0x5a1387,_0x39dd6c){const _0x577f96=_0x3ed893;return db['FaxQueue'][_0x577f96('0x3d')]({'where':{'id':_0x5a1387[_0x577f96('0x5f')]['id']}})['then'](handleEntityNotFound(_0x39dd6c,null))[_0x577f96('0x1a')](removeEntity(_0x39dd6c,null))[_0x577f96('0x65')](handleError(_0x39dd6c,null));},exports['describe']=function(_0x26ecba,_0x96e2b){const _0x508e10=_0x3ed893;return db['FaxQueue'][_0x508e10('0x2d')]()[_0x508e10('0x1a')](respondWithResult(_0x96e2b,null))['catch'](handleError(_0x96e2b,null));},exports[_0x3ed893('0x4a')]=function(_0x360aae,_0x5cf422){const _0xbb1ea6=_0x3ed893;let _0x19ed45={'raw':!![],'where':{}};const _0xea525e={};let _0x285f9e;return db[_0xbb1ea6('0x27')][_0xbb1ea6('0x3d')]({'where':{'id':_0x360aae[_0xbb1ea6('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5cf422,null))['then'](function(_0xc374a2){const _0x43c899=_0xbb1ea6;if(_0xc374a2)return _0x285f9e=_0xc374a2['get']({'plain':!![]}),_0xea525e[_0x43c899('0x1')]=_[_0x43c899('0x28')](db['UserFaxQueue'][_0x43c899('0x20')]),_0xea525e[_0x43c899('0x1f')]=_[_0x43c899('0x28')](_0x360aae['query']),_0xea525e['filters']=_[_0x43c899('0x26')](_0xea525e['model'],_0xea525e['query']),_0x19ed45[_0x43c899('0x42')]=_[_0x43c899('0x26')](_0xea525e[_0x43c899('0x1')],qs['fields'](_0x360aae[_0x43c899('0x1f')][_0x43c899('0x11')])),_0x19ed45[_0x43c899('0x42')]=_0x19ed45[_0x43c899('0x42')][_0x43c899('0x32')]?_0x19ed45[_0x43c899('0x42')]:_0xea525e['model'],typeof _0x360aae[_0x43c899('0x1f')]['nolimit']===_0x43c899('0x2a')&&(_0x19ed45[_0x43c899('0xd')]=qs[_0x43c899('0xd')](_0x360aae[_0x43c899('0x1f')][_0x43c899('0xd')]),_0x19ed45[_0x43c899('0x41')]=qs['offset'](_0x360aae['query']['offset'])),_0x19ed45['order']=qs[_0x43c899('0x16')](_0x360aae[_0x43c899('0x1f')]['sort']),_0x19ed45[_0x43c899('0x17')]=qs['filters'](_['pick'](_0x360aae[_0x43c899('0x1f')],_0xea525e['filters'])),_0x19ed45[_0x43c899('0x17')][_0x43c899('0x5a')]=_0xc374a2['id'],_0x360aae[_0x43c899('0x1f')]['filter']&&(_0x19ed45[_0x43c899('0x17')]=_[_0x43c899('0x45')](_0x19ed45[_0x43c899('0x17')],{[Op['or']]:_['map'](_0x19ed45[_0x43c899('0x42')],function(_0x4edfef){const _0x4d734d=_0x43c899,_0x418b46={};return _0x418b46[_0x4edfef]={[Op[_0x4d734d('0xe')]]:'%'+_0x360aae['query'][_0x4d734d('0x44')]+'%'},_0x418b46;})})),_0x19ed45=_['merge']({},_0x19ed45,_0x360aae[_0x43c899('0x25')]),db['UserFaxQueue'][_0x43c899('0x48')](_0x19ed45);})[_0xbb1ea6('0x1a')](function(_0x53763c){const _0x5a3c96=_0xbb1ea6;if(_0x53763c)return db['User'][_0x5a3c96('0x5c')]({'where':{'id':_['map'](_0x53763c,'UserId'),'role':_0x5a3c96('0x66')},'attributes':['id','name',_0x5a3c96('0x46'),_0x5a3c96('0x4c'),_0x5a3c96('0x6f')]});})['then'](function(_0x25e42b){const _0x27496b=_0xbb1ea6;return _0x25e42b?{'count':_0x25e42b[_0x27496b('0x4b')],'rows':_[_0x27496b('0x4d')](_0x25e42b[_0x27496b('0x8')],function(_0x44daa8){const _0x5a4951=_0x27496b;return{'membername':_0x44daa8[_0x5a4951('0x2c')],'UserId':_0x44daa8['id'],'queue_name':_0x285f9e[_0x5a4951('0x2c')],'FaxQueueId':_0x285f9e['id'],'interface':util[_0x5a4951('0x35')](_0x5a4951('0x15'),_0x5a4951('0x1e'),_0x44daa8[_0x5a4951('0x2c')]),'penalty':0x0,'paused':_0x44daa8[_0x5a4951('0x46')],'createdAt':_0x44daa8['createdAt'],'updatedAt':_0x44daa8[_0x5a4951('0x4c')]};})}:{'count':0x0,'rows':[]};})['then'](respondWithFilteredResult(_0x5cf422,_0x19ed45))['catch'](handleError(_0x5cf422,null));},exports[_0x3ed893('0x55')]=function(_0x567e8b,_0x2e4471){const _0x476080=_0x3ed893;let _0x5ab1a3={};const _0x337def={};let _0x56b19f,_0x5d275d;return db[_0x476080('0x27')][_0x476080('0x3d')]({'where':{'id':_0x567e8b[_0x476080('0x5f')]['id']}})[_0x476080('0x1a')](handleEntityNotFound(_0x2e4471,null))[_0x476080('0x1a')](function(_0x3e6941){const _0x2eb1f5=_0x476080;if(_0x3e6941)return _0x56b19f=_0x3e6941,_0x337def[_0x2eb1f5('0x1')]=_[_0x2eb1f5('0x28')](db['Team'][_0x2eb1f5('0x20')]),_0x337def[_0x2eb1f5('0x1f')]=_[_0x2eb1f5('0x28')](_0x567e8b[_0x2eb1f5('0x1f')]),_0x337def[_0x2eb1f5('0x5b')]=_[_0x2eb1f5('0x26')](_0x337def[_0x2eb1f5('0x1')],_0x337def[_0x2eb1f5('0x1f')]),_0x5ab1a3[_0x2eb1f5('0x42')]=_[_0x2eb1f5('0x26')](_0x337def[_0x2eb1f5('0x1')],qs[_0x2eb1f5('0x11')](_0x567e8b[_0x2eb1f5('0x1f')][_0x2eb1f5('0x11')])),_0x5ab1a3['attributes']=_0x5ab1a3[_0x2eb1f5('0x42')][_0x2eb1f5('0x32')]?_0x5ab1a3[_0x2eb1f5('0x42')]:_0x337def[_0x2eb1f5('0x1')],_0x5ab1a3[_0x2eb1f5('0x30')]=qs[_0x2eb1f5('0x16')](_0x567e8b[_0x2eb1f5('0x1f')][_0x2eb1f5('0x16')]),_0x5ab1a3['where']=qs['filters'](_[_0x2eb1f5('0x38')](_0x567e8b['query'],_0x337def[_0x2eb1f5('0x5b')])),_0x567e8b[_0x2eb1f5('0x1f')]['filter']&&(_0x5ab1a3[_0x2eb1f5('0x17')]=_['merge'](_0x5ab1a3['where'],{[Op['or']]:_[_0x2eb1f5('0x4d')](_0x5ab1a3['attributes'],function(_0x4744b5){const _0x53fbcf=_0x2eb1f5,_0x4bad84={};return _0x4bad84[_0x4744b5]={[Op['like']]:'%'+_0x567e8b[_0x53fbcf('0x1f')][_0x53fbcf('0x44')]+'%'},_0x4bad84;})})),_0x5ab1a3=_['merge']({},_0x5ab1a3,_0x567e8b[_0x2eb1f5('0x25')]),_0x56b19f[_0x2eb1f5('0x55')](_0x5ab1a3);})['then'](function(_0x2ecd71){const _0x1cd4a4=_0x476080;if(_0x2ecd71)return _0x5d275d=_0x2ecd71[_0x1cd4a4('0x32')],typeof _0x567e8b[_0x1cd4a4('0x1f')][_0x1cd4a4('0x59')]===_0x1cd4a4('0x2a')&&(_0x5ab1a3[_0x1cd4a4('0xd')]=qs['limit'](_0x567e8b[_0x1cd4a4('0x1f')][_0x1cd4a4('0xd')]),_0x5ab1a3['offset']=qs[_0x1cd4a4('0x41')](_0x567e8b['query'][_0x1cd4a4('0x41')])),_0x56b19f[_0x1cd4a4('0x55')](_0x5ab1a3);})[_0x476080('0x1a')](function(_0x4626e5){if(_0x4626e5)return _0x4626e5?{'count':_0x5d275d,'rows':_0x4626e5}:null;})[_0x476080('0x1a')](respondWithResult(_0x2e4471,null))[_0x476080('0x65')](handleError(_0x2e4471,null));},exports['addTeams']=function(_0x56c4a5,_0x1191dc){const _0x2f35cc=_0x3ed893,_0x15da1a=_0x56c4a5['body'][_0x2f35cc('0xb')];return db['Team']['findAll']({'where':{'id':_0x15da1a},'attributes':['id'],'include':[{'model':db[_0x2f35cc('0x22')],'as':_0x2f35cc('0x6a'),'attributes':['id',_0x2f35cc('0x2c'),'online',_0x2f35cc('0x70'),'interface'],'raw':!![]}]})[_0x2f35cc('0x1a')](function(_0x4e0020){const _0x51170e=_0x2f35cc;if(_0x4e0020){const _0x17895d=_[_0x51170e('0x49')](_0x4e0020,function(_0x508add){const _0x3bb48d=_0x51170e,_0x45344a=_0x508add[_0x3bb48d('0x5d')]({'plain':!![]});return _0x45344a['Agents'];});return db[_0x51170e('0x27')][_0x51170e('0x3d')]({'where':{'id':_0x56c4a5[_0x51170e('0x5f')]['id']}})[_0x51170e('0x1a')](function(_0x43ed63){const _0x1cf928=_0x51170e;return db[_0x1cf928('0x1d')][_0x1cf928('0x4')](function(_0x3dea89){const _0x3096a6=_0x1cf928;return _0x43ed63[_0x3096a6('0x5e')](_0x15da1a,{'transaction':_0x3dea89})[_0x3096a6('0x1a')](function(){const _0x1f1dc5=_0x3096a6;return Promise[_0x1f1dc5('0x34')](_0x17895d,function(_0x356f88){const _0x1a278b=_0x1f1dc5;return db[_0x1a278b('0x19')][_0x1a278b('0x51')]({'where':{'UserId':_0x356f88['id'],'FaxQueueId':_0x56c4a5[_0x1a278b('0x5f')]['id']},'transaction':_0x3dea89});});})[_0x3096a6('0x1a')](function(){const _0x3f1ea0=_0x3096a6;_0x17895d[_0x3f1ea0('0x56')](function(_0x429df5){const _0x50d729=_0x3f1ea0;socket[_0x50d729('0x4e')]('userFaxQueue:save',{'UserId':_0x429df5['id'],'FaxQueueId':_0x43ed63['id']});});});});});}})[_0x2f35cc('0x1a')](respondWithStatusCode(_0x1191dc,null))['catch'](handleError(_0x1191dc,null));},exports[_0x3ed893('0x36')]=function(_0x1c7509,_0x33f074){const _0x3bbdbd=_0x3ed893;return db[_0x3bbdbd('0x2')]['findAll']({'where':{'id':_0x1c7509[_0x3bbdbd('0x1f')][_0x3bbdbd('0xb')]},'attributes':['id'],'include':[{'model':db[_0x3bbdbd('0x22')],'as':_0x3bbdbd('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x3bbdbd('0x1a')](handleEntityNotFound(_0x33f074,null))[_0x3bbdbd('0x1a')](function(_0x2cbbd2){const _0x5b4185=_0x3bbdbd,_0xc5bbf8=_[_0x5b4185('0x4d')](_0x2cbbd2,'id');let _0x218118=[];const _0x21fb5b=[],_0x48be7f=squel[_0x5b4185('0x10')]();_0x48be7f[_0x5b4185('0x23')](_0x5b4185('0x14'))[_0x5b4185('0xf')](_0x5b4185('0x61'),'tq')[_0x5b4185('0x13')](_0x5b4185('0x0'),'ut',_0x5b4185('0x4f'))['where']('FaxQueueId\x20=\x20?',_0x1c7509[_0x5b4185('0x5f')]['id']);for(let _0x456845=0x0;_0x456845<_0x2cbbd2[_0x5b4185('0x32')];_0x456845+=0x1){const _0x574355=_0x2cbbd2[_0x456845];for(let _0xa1ea9e=0x0;_0xa1ea9e<_0x574355[_0x5b4185('0x6a')][_0x5b4185('0x32')];_0xa1ea9e+=0x1){const _0x23bf69=_0x574355[_0x5b4185('0x6a')][_0xa1ea9e],_0x3888a8=_0x48be7f['clone']();_0x3888a8['where'](_0x5b4185('0x58'),_0x23bf69['id']),_0x21fb5b[_0x5b4185('0x33')](db['sequelize'][_0x5b4185('0x1f')](_0x3888a8[_0x5b4185('0x3e')](),{'type':QueryTypes[_0x5b4185('0x68')]})[_0x5b4185('0x1a')](function(_0x49fc81){const _0x4119b2=_0x5b4185;if(_0x49fc81[_0x4119b2('0x32')]===0x1)return _0x23bf69['id'];else{const _0x1ac9db=_[_0x4119b2('0x3b')](_[_0x4119b2('0x4d')](_0x49fc81,_0x4119b2('0x2b')),function(_0x33119d){const _0xd27398=_0x4119b2;return _[_0xd27398('0x6')](_0xc5bbf8,_0x33119d);});if(_0x1ac9db)return _0x23bf69['id'];}}));}}return Promise[_0x5b4185('0x63')](_0x21fb5b)[_0x5b4185('0x1a')](function(_0x361fa0){const _0x2e2fe3=_0x5b4185;return _0x218118=_(_0x218118)[_0x2e2fe3('0x2e')](_0x361fa0)['compact']()[_0x2e2fe3('0x7')](),db['FaxQueue'][_0x2e2fe3('0x3d')]({'where':{'id':_0x1c7509[_0x2e2fe3('0x5f')]['id']}})['then'](function(_0x5cf8b3){const _0x56cba8=_0x2e2fe3;return db[_0x56cba8('0x1d')]['transaction'](function(_0x57fc42){const _0x5dd5c9=_0x56cba8;return _0x5cf8b3['removeTeams'](_0x1c7509[_0x5dd5c9('0x1f')][_0x5dd5c9('0xb')],{'transaction':_0x57fc42})[_0x5dd5c9('0x1a')](function(){const _0x658fef=_0x5dd5c9;if(!_[_0x658fef('0x2f')](_0x218118))return _0x5cf8b3['removeAgents'](_0x218118,{'transaction':_0x57fc42});})[_0x5dd5c9('0x1a')](function(){const _0x5f7a1b=_0x5dd5c9;_0x218118[_0x5f7a1b('0x56')](function(_0x66c998){const _0x82821a=_0x5f7a1b;socket[_0x82821a('0x4e')](_0x82821a('0x18'),{'UserId':_0x66c998,'FaxQueueId':_0x5cf8b3['id']});});});});});});})['then'](respondWithStatusCode(_0x33f074,null))[_0x3bbdbd('0x65')](handleError(_0x33f074,null));},exports[_0x3ed893('0x40')]=function(_0x561063,_0x40191a){const _0x2bc86c=_0x3ed893;return db[_0x2bc86c('0x27')][_0x2bc86c('0x3d')]({'where':{'id':_0x561063[_0x2bc86c('0x5f')]['id']}})[_0x2bc86c('0x1a')](function(_0x4c5205){const _0x404294=_0x2bc86c;if(_0x4c5205)return _0x4c5205['addAgents'](_0x561063[_0x404294('0x52')][_0x404294('0xb')],{'through':_['omit'](_0x561063[_0x404294('0x52')],[_0x404294('0xb'),'id'])})['then'](function(_0x257527){const _0x55cf7d=_0x404294;for(let _0x325918=0x0;_0x325918<_0x561063[_0x55cf7d('0x52')][_0x55cf7d('0xb')][_0x55cf7d('0x32')];_0x325918+=0x1){socket[_0x55cf7d('0x4e')](_0x55cf7d('0x62'),{'UserId':_0x561063[_0x55cf7d('0x52')][_0x55cf7d('0xb')][_0x325918],'FaxQueueId':_0x561063['params']['id']});}return _0x257527;});})[_0x2bc86c('0x1a')](respondWithResult(_0x40191a,null))[_0x2bc86c('0x65')](handleError(_0x40191a,null));},exports[_0x3ed893('0xa')]=function(_0x30fd86,_0x356147){const _0x44b05d=_0x3ed893;return db[_0x44b05d('0x27')]['findOne']({'where':{'id':_0x30fd86[_0x44b05d('0x5f')]['id']}})['then'](handleEntityNotFound(_0x356147,null))['then'](function(_0x1db6f3){const _0x588b3f=_0x44b05d;if(_0x1db6f3)return _0x1db6f3['removeAgents'](_0x30fd86[_0x588b3f('0x1f')][_0x588b3f('0xb')])[_0x588b3f('0x1a')](function(){const _0x415e78=_0x588b3f;if(_[_0x415e78('0x39')](_0x30fd86[_0x415e78('0x1f')][_0x415e78('0xb')]))for(let _0x4a0372=0x0;_0x4a0372<_0x30fd86[_0x415e78('0x1f')][_0x415e78('0xb')][_0x415e78('0x32')];_0x4a0372+=0x1){socket[_0x415e78('0x4e')](_0x415e78('0x18'),{'UserId':Number(_0x30fd86[_0x415e78('0x1f')][_0x415e78('0xb')][_0x4a0372]),'FaxQueueId':Number(_0x30fd86[_0x415e78('0x5f')]['id'])});}else socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x30fd86[_0x415e78('0x1f')]['ids']),'FaxQueueId':Number(_0x30fd86[_0x415e78('0x5f')]['id'])});});})[_0x44b05d('0x1a')](respondWithStatusCode(_0x356147,null))[_0x44b05d('0x65')](handleError(_0x356147,null));},exports['getAgents']=function(_0x2617d0,_0x43280f){const _0xc6a3f4=_0x3ed893;let _0x500f8c={};const _0x50551c={};let _0x501b14,_0x9c2444;return db['FaxQueue']['findOne']({'where':{'id':_0x2617d0[_0xc6a3f4('0x5f')]['id']}})[_0xc6a3f4('0x1a')](handleEntityNotFound(_0x43280f,null))[_0xc6a3f4('0x1a')](function(_0x310262){const _0x4d4e39=_0xc6a3f4;if(_0x310262)return _0x501b14=_0x310262,_0x50551c[_0x4d4e39('0x1')]=_[_0x4d4e39('0x28')](db[_0x4d4e39('0x22')][_0x4d4e39('0x20')]),_0x50551c[_0x4d4e39('0x1f')]=_[_0x4d4e39('0x28')](_0x2617d0[_0x4d4e39('0x1f')]),_0x50551c[_0x4d4e39('0x5b')]=_[_0x4d4e39('0x26')](_0x50551c[_0x4d4e39('0x1')],_0x50551c['query']),_0x500f8c[_0x4d4e39('0x42')]=_['intersection'](_0x50551c[_0x4d4e39('0x1')],qs['fields'](_0x2617d0[_0x4d4e39('0x1f')][_0x4d4e39('0x11')])),_0x500f8c[_0x4d4e39('0x42')]=_0x500f8c[_0x4d4e39('0x42')][_0x4d4e39('0x32')]?_0x500f8c[_0x4d4e39('0x42')]:_0x50551c['model'],_0x500f8c[_0x4d4e39('0x30')]=qs[_0x4d4e39('0x16')](_0x2617d0[_0x4d4e39('0x1f')][_0x4d4e39('0x16')]),_0x500f8c[_0x4d4e39('0x17')]=qs['filters'](_[_0x4d4e39('0x38')](_0x2617d0[_0x4d4e39('0x1f')],_0x50551c[_0x4d4e39('0x5b')])),_0x2617d0[_0x4d4e39('0x1f')][_0x4d4e39('0x44')]&&(_0x500f8c[_0x4d4e39('0x17')]=_[_0x4d4e39('0x45')](_0x500f8c[_0x4d4e39('0x17')],{[Op['or']]:_[_0x4d4e39('0x4d')](_0x500f8c[_0x4d4e39('0x42')],function(_0x59afff){const _0x3281e4=_0x4d4e39,_0x345138={};return _0x345138[_0x59afff]={[Op[_0x3281e4('0xe')]]:'%'+_0x2617d0['query'][_0x3281e4('0x44')]+'%'},_0x345138;})})),_0x500f8c=_[_0x4d4e39('0x45')]({},_0x500f8c,_0x2617d0[_0x4d4e39('0x25')]),_0x501b14[_0x4d4e39('0x3c')](_0x500f8c);})[_0xc6a3f4('0x1a')](function(_0x288a71){const _0x127a9b=_0xc6a3f4;if(_0x288a71)return _0x9c2444=_0x288a71[_0x127a9b('0x32')],typeof _0x2617d0['query'][_0x127a9b('0x59')]==='undefined'&&(_0x500f8c[_0x127a9b('0xd')]=qs['limit'](_0x2617d0[_0x127a9b('0x1f')][_0x127a9b('0xd')]),_0x500f8c[_0x127a9b('0x41')]=qs[_0x127a9b('0x41')](_0x2617d0[_0x127a9b('0x1f')][_0x127a9b('0x41')])),_0x501b14[_0x127a9b('0x3c')](_0x500f8c);})[_0xc6a3f4('0x1a')](function(_0x3963ee){if(_0x3963ee)return _0x3963ee?{'count':_0x9c2444,'rows':_0x3963ee}:null;})[_0xc6a3f4('0x1a')](respondWithResult(_0x43280f,null))['catch'](handleError(_0x43280f,null));};
\ No newline at end of file
+const a212_0x226f=['FaxQueue','includeAll','update','online','catch','offset','like','sequelize','../../mysqldb','user_has_teams','format','UserId','team_has_fax_queues','Team','stack','UserFaxQueue','removeTeams','rawAttributes','order','compact','from','addAgents','every','forEach','rows','json','UserProfileResource','../../config/logger','keys','transaction','fields','model','addTeams','Content-Range','getAgents','createdAt','create','FaxQueueId','nolimit','status','limit','tq.TeamId','filter','userProfileId','VIRTUAL','all','%s/%s','register','sendStatus','end','removeAgents','merge','findOrCreate','../../components/parsers/qs','undefined','Agents','field','fieldName','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','count','intersection','key','body','then','userFaxQueue:save','./faxQueue.socket','where','attributes','destroy','util','map','role','interface','omit','set','updatedAt','UserProfileSection','emit','getMembers','length','index','userFaxQueue:remove','getTeams','findOne','name','faxPause','pick','sort','Unable\x20to\x20retrieve\x20the\x20current\x20user','describe','error','get','autoAssociation','value','each','TeamId','FaxQueues','select','params','findAll','query','filters','agent','SELECT','findAndCountAll','api','User','user','ids','toString','push','options'];(function(_0x11db7b,_0x226f06){const _0x291c76=function(_0x45db9d){while(--_0x45db9d){_0x11db7b['push'](_0x11db7b['shift']());}};_0x291c76(++_0x226f06);}(a212_0x226f,0xa3));const a212_0x291c=function(_0x11db7b,_0x226f06){_0x11db7b=_0x11db7b-0x0;let _0x291c76=a212_0x226f[_0x11db7b];return _0x291c76;};const _0x3df809=a212_0x291c;'use strict';const util=require(_0x3df809('0x12')),_=require('lodash'),squel=require('squel'),qs=require(_0x3df809('0x2')),logger=require(_0x3df809('0x58'))(_0x3df809('0x36')),{getSocket}=require('../../rediscache'),socket=getSocket(),db=require(_0x3df809('0x45'))['db'],{Op,QueryTypes}=require(_0x3df809('0x44'));require(_0x3df809('0xe'))[_0x3df809('0x6c')](socket);function respondWithStatusCode(_0x45db9d,_0x556bd9){return _0x556bd9=_0x556bd9||0xcc,function(_0x55ef33){const _0x54d347=a212_0x291c;if(_0x55ef33)return _0x45db9d[_0x54d347('0x6d')](_0x556bd9);return _0x45db9d[_0x54d347('0x64')](_0x556bd9)[_0x54d347('0x6e')]();};}function respondWithResult(_0x68d6dc,_0x419305){return _0x419305=_0x419305||0xc8,function(_0x338263){const _0x21c75d=a212_0x291c;if(_0x338263)return _0x68d6dc[_0x21c75d('0x64')](_0x419305)[_0x21c75d('0x56')](_0x338263);};}function respondWithFilteredResult(_0x247493,_0x34bfa9){return function(_0x3e2b61){const _0x20670a=a212_0x291c;if(_0x3e2b61){const _0x4c47f1=_0x3e2b61['count'],_0x190b26=_0x34bfa9[_0x20670a('0x42')];let _0x47af9e=_0x34bfa9[_0x20670a('0x42')]+_0x34bfa9[_0x20670a('0x65')],_0x12d93a;return _0x47af9e>=_0x4c47f1?(_0x47af9e=_0x4c47f1,_0x12d93a=0xc8):_0x12d93a=0xce,_0x247493[_0x20670a('0x64')](_0x12d93a),_0x247493[_0x20670a('0x17')](_0x20670a('0x5e'),_0x190b26+'-'+_0x47af9e+'/'+_0x4c47f1)[_0x20670a('0x56')](_0x3e2b61);}return null;};}function saveUpdates(_0x137681){return function(_0x339e98){const _0x1839f6=a212_0x291c;if(_0x339e98)return _0x339e98[_0x1839f6('0x3f')](_0x137681)['then'](function(_0x1e449b){return _0x1e449b;});return null;};}function removeEntity(_0xac545e){return function(_0x37638b){const _0x22a726=a212_0x291c;if(_0x37638b)return _0x37638b[_0x22a726('0x11')]()[_0x22a726('0xc')](function(){const _0x11e822=_0x22a726,_0x37807c=_0x37638b[_0x11e822('0x28')]({'plain':!![]}),_0x532706=_0x11e822('0x2d');return db[_0x11e822('0x57')]['destroy']({'where':{'type':_0x532706,'resourceId':_0x37807c['id']}})[_0x11e822('0xc')](function(){return _0x37638b;});})[_0x22a726('0xc')](function(){const _0x22a128=_0x22a726;_0xac545e[_0x22a128('0x64')](0xcc)[_0x22a128('0x6e')]();});};}function handleEntityNotFound(_0x2957ee){return function(_0xdec440){const _0x575693=a212_0x291c;return!_0xdec440&&_0x2957ee[_0x575693('0x6d')](0x194),_0xdec440;};}function handleError(_0x201dc2,_0x3c24f5){return _0x3c24f5=_0x3c24f5||0x1f4,function(_0x4b76fd){const _0x2414bd=a212_0x291c;logger[_0x2414bd('0x27')](_0x4b76fd[_0x2414bd('0x4b')]),_0x4b76fd['name']&&delete _0x4b76fd[_0x2414bd('0x21')],_0x201dc2[_0x2414bd('0x64')](_0x3c24f5)['send'](_0x4b76fd);};}exports[_0x3df809('0x1d')]=function(_0x518770,_0x45f44a){const _0x29c334=_0x3df809;let _0x5ba6b8={};const _0x3e5ecd={},_0x4155e5={'count':0x0,'rows':[]},_0x13e10b=_[_0x29c334('0x13')](db[_0x29c334('0x3d')]['rawAttributes'],function(_0x22d916){const _0x372b64=_0x29c334;return{'name':_0x22d916[_0x372b64('0x6')],'type':_0x22d916['type'][_0x372b64('0xa')]};});_0x3e5ecd[_0x29c334('0x5c')]=_[_0x29c334('0x13')](_0x13e10b,_0x29c334('0x21')),_0x3e5ecd['query']=_[_0x29c334('0x59')](_0x518770[_0x29c334('0x31')]),_0x3e5ecd[_0x29c334('0x32')]=_['intersection'](_0x3e5ecd[_0x29c334('0x5c')],_0x3e5ecd[_0x29c334('0x31')]),_0x5ba6b8[_0x29c334('0x10')]=_['intersection'](_0x3e5ecd[_0x29c334('0x5c')],qs['fields'](_0x518770[_0x29c334('0x31')]['fields'])),_0x5ba6b8[_0x29c334('0x10')]=_0x5ba6b8[_0x29c334('0x10')]['length']?_0x5ba6b8[_0x29c334('0x10')]:_0x3e5ecd[_0x29c334('0x5c')];typeof _0x518770[_0x29c334('0x31')][_0x29c334('0x63')]===_0x29c334('0x3')&&(_0x5ba6b8['limit']=qs[_0x29c334('0x65')](_0x518770['query'][_0x29c334('0x65')]),_0x5ba6b8[_0x29c334('0x42')]=qs[_0x29c334('0x42')](_0x518770[_0x29c334('0x31')]['offset']));_0x5ba6b8[_0x29c334('0x4f')]=qs[_0x29c334('0x24')](_0x518770[_0x29c334('0x31')][_0x29c334('0x24')]),_0x5ba6b8[_0x29c334('0xf')]=qs[_0x29c334('0x32')](_[_0x29c334('0x23')](_0x518770[_0x29c334('0x31')],_0x3e5ecd[_0x29c334('0x32')]),_0x13e10b);_0x518770['query']['filter']&&(_0x5ba6b8[_0x29c334('0xf')]=_[_0x29c334('0x0')](_0x5ba6b8[_0x29c334('0xf')],{[Op['or']]:_[_0x29c334('0x13')](_0x13e10b,function(_0x473acc){const _0x3074d6=_0x29c334;if(_0x473acc['type']!==_0x3074d6('0x69')){const _0x3b5f7e={};return _0x3b5f7e[_0x473acc[_0x3074d6('0x21')]]={[Op[_0x3074d6('0x43')]]:'%'+_0x518770[_0x3074d6('0x31')][_0x3074d6('0x67')]+'%'},_0x3b5f7e;}})}));_0x5ba6b8=_[_0x29c334('0x0')]({},_0x5ba6b8,_0x518770[_0x29c334('0x3c')]);const _0x5c9f47={'where':_0x5ba6b8[_0x29c334('0xf')]};return db[_0x29c334('0x3d')][_0x29c334('0x8')](_0x5c9f47)[_0x29c334('0xc')](function(_0x43ea57){const _0x5b3ed6=_0x29c334;return _0x4155e5[_0x5b3ed6('0x8')]=_0x43ea57,_0x518770[_0x5b3ed6('0x31')][_0x5b3ed6('0x3e')]&&(_0x5ba6b8['include']=[{'all':!![]}]),db['FaxQueue']['findAll'](_0x5ba6b8);})[_0x29c334('0xc')](function(_0x7af20b){const _0x426f68=_0x29c334;return _0x4155e5[_0x426f68('0x55')]=_0x7af20b,_0x4155e5;})[_0x29c334('0xc')](respondWithFilteredResult(_0x45f44a,_0x5ba6b8))['catch'](handleError(_0x45f44a,null));},exports['show']=function(_0x7a2741,_0xdbcc50){const _0x3efb4b=_0x3df809;let _0x2ae531={'raw':!![],'where':{'id':_0x7a2741[_0x3efb4b('0x2f')]['id']}};const _0x26fb65={};return _0x26fb65['model']=_[_0x3efb4b('0x59')](db[_0x3efb4b('0x3d')][_0x3efb4b('0x4e')]),_0x26fb65[_0x3efb4b('0x31')]=_[_0x3efb4b('0x59')](_0x7a2741[_0x3efb4b('0x31')]),_0x26fb65[_0x3efb4b('0x32')]=_[_0x3efb4b('0x9')](_0x26fb65[_0x3efb4b('0x5c')],_0x26fb65[_0x3efb4b('0x31')]),_0x2ae531['attributes']=_[_0x3efb4b('0x9')](_0x26fb65[_0x3efb4b('0x5c')],qs[_0x3efb4b('0x5b')](_0x7a2741[_0x3efb4b('0x31')][_0x3efb4b('0x5b')])),_0x2ae531['attributes']=_0x2ae531[_0x3efb4b('0x10')]['length']?_0x2ae531['attributes']:_0x26fb65['model'],_0x7a2741[_0x3efb4b('0x31')][_0x3efb4b('0x3e')]&&(_0x2ae531['include']=[{'all':!![]}]),_0x2ae531=_[_0x3efb4b('0x0')]({},_0x2ae531,_0x7a2741['options']),db[_0x3efb4b('0x3d')]['findOne'](_0x2ae531)[_0x3efb4b('0xc')](handleEntityNotFound(_0xdbcc50,null))[_0x3efb4b('0xc')](respondWithResult(_0xdbcc50,null))['catch'](handleError(_0xdbcc50,null));},exports[_0x3df809('0x61')]=function(_0x249bc5,_0xb56936){const _0x458e84=_0x3df809;return db[_0x458e84('0x3d')][_0x458e84('0x61')](_0x249bc5[_0x458e84('0xb')],{})['then'](function(_0x332d0b){const _0x24a80f=_0x458e84,_0x48b93f=_0x249bc5[_0x24a80f('0x38')][_0x24a80f('0x28')]({'plain':!![]});if(!_0x48b93f)throw new Error(_0x24a80f('0x25'));if(_0x48b93f[_0x24a80f('0x14')]===_0x24a80f('0x38')){const _0x5f1831=_0x332d0b[_0x24a80f('0x28')]({'plain':!![]}),_0x480d79=_0x24a80f('0x2d');return db[_0x24a80f('0x19')][_0x24a80f('0x20')]({'where':{'name':_0x480d79,'userProfileId':_0x48b93f[_0x24a80f('0x68')]},'raw':!![]})[_0x24a80f('0xc')](function(_0x4b1947){const _0x248efe=_0x24a80f;return _0x4b1947&&_0x4b1947[_0x248efe('0x29')]===0x0?db[_0x248efe('0x57')][_0x248efe('0x61')]({'name':_0x5f1831['name'],'resourceId':_0x5f1831['id'],'type':_0x4b1947['name'],'sectionId':_0x4b1947['id']},{})[_0x248efe('0xc')](function(){return _0x332d0b;}):_0x332d0b;})[_0x24a80f('0x41')](function(_0x3c5925){const _0x54243a=_0x24a80f;logger[_0x54243a('0x27')](_0x54243a('0x7'),_0x3c5925);throw _0x3c5925;});}return _0x332d0b;})[_0x458e84('0xc')](respondWithResult(_0xb56936,0xc9))[_0x458e84('0x41')](handleError(_0xb56936,null));},exports[_0x3df809('0x3f')]=function(_0x489b46,_0x38d6b3){const _0x19ed2f=_0x3df809;return _0x489b46[_0x19ed2f('0xb')]['id']&&delete _0x489b46[_0x19ed2f('0xb')]['id'],db[_0x19ed2f('0x3d')][_0x19ed2f('0x20')]({'where':{'id':_0x489b46[_0x19ed2f('0x2f')]['id']}})[_0x19ed2f('0xc')](handleEntityNotFound(_0x38d6b3,null))[_0x19ed2f('0xc')](saveUpdates(_0x489b46[_0x19ed2f('0xb')],null))[_0x19ed2f('0xc')](respondWithResult(_0x38d6b3,null))[_0x19ed2f('0x41')](handleError(_0x38d6b3,null));},exports['destroy']=function(_0x28c452,_0x45f667){const _0x25dbb3=_0x3df809;return db[_0x25dbb3('0x3d')][_0x25dbb3('0x20')]({'where':{'id':_0x28c452[_0x25dbb3('0x2f')]['id']}})[_0x25dbb3('0xc')](handleEntityNotFound(_0x45f667,null))[_0x25dbb3('0xc')](removeEntity(_0x45f667,null))['catch'](handleError(_0x45f667,null));},exports[_0x3df809('0x26')]=function(_0x53dcf9,_0x521a0e){const _0x11e62e=_0x3df809;return db[_0x11e62e('0x3d')][_0x11e62e('0x26')]()[_0x11e62e('0xc')](respondWithResult(_0x521a0e,null))[_0x11e62e('0x41')](handleError(_0x521a0e,null));},exports[_0x3df809('0x1b')]=function(_0x4888f1,_0x2b61be){const _0x2b1bf9=_0x3df809;let _0x3371ff={'raw':!![],'where':{}};const _0xff02f6={};let _0x519b1c;return db[_0x2b1bf9('0x3d')][_0x2b1bf9('0x20')]({'where':{'id':_0x4888f1[_0x2b1bf9('0x2f')]['id']}})[_0x2b1bf9('0xc')](handleEntityNotFound(_0x2b61be,null))[_0x2b1bf9('0xc')](function(_0x470b73){const _0x2b5159=_0x2b1bf9;if(_0x470b73)return _0x519b1c=_0x470b73['get']({'plain':!![]}),_0xff02f6['model']=_[_0x2b5159('0x59')](db[_0x2b5159('0x4c')][_0x2b5159('0x4e')]),_0xff02f6[_0x2b5159('0x31')]=_['keys'](_0x4888f1[_0x2b5159('0x31')]),_0xff02f6[_0x2b5159('0x32')]=_[_0x2b5159('0x9')](_0xff02f6[_0x2b5159('0x5c')],_0xff02f6[_0x2b5159('0x31')]),_0x3371ff['attributes']=_[_0x2b5159('0x9')](_0xff02f6[_0x2b5159('0x5c')],qs[_0x2b5159('0x5b')](_0x4888f1[_0x2b5159('0x31')][_0x2b5159('0x5b')])),_0x3371ff['attributes']=_0x3371ff[_0x2b5159('0x10')][_0x2b5159('0x1c')]?_0x3371ff['attributes']:_0xff02f6[_0x2b5159('0x5c')],typeof _0x4888f1[_0x2b5159('0x31')][_0x2b5159('0x63')]===_0x2b5159('0x3')&&(_0x3371ff[_0x2b5159('0x65')]=qs['limit'](_0x4888f1['query']['limit']),_0x3371ff[_0x2b5159('0x42')]=qs[_0x2b5159('0x42')](_0x4888f1[_0x2b5159('0x31')][_0x2b5159('0x42')])),_0x3371ff[_0x2b5159('0x4f')]=qs[_0x2b5159('0x24')](_0x4888f1[_0x2b5159('0x31')]['sort']),_0x3371ff[_0x2b5159('0xf')]=qs[_0x2b5159('0x32')](_[_0x2b5159('0x23')](_0x4888f1[_0x2b5159('0x31')],_0xff02f6[_0x2b5159('0x32')])),_0x3371ff[_0x2b5159('0xf')][_0x2b5159('0x62')]=_0x470b73['id'],_0x4888f1['query'][_0x2b5159('0x67')]&&(_0x3371ff[_0x2b5159('0xf')]=_['merge'](_0x3371ff[_0x2b5159('0xf')],{[Op['or']]:_[_0x2b5159('0x13')](_0x3371ff[_0x2b5159('0x10')],function(_0x455b7d){const _0x4b0987=_0x2b5159,_0x3fc71e={};return _0x3fc71e[_0x455b7d]={[Op[_0x4b0987('0x43')]]:'%'+_0x4888f1['query'][_0x4b0987('0x67')]+'%'},_0x3fc71e;})})),_0x3371ff=_['merge']({},_0x3371ff,_0x4888f1[_0x2b5159('0x3c')]),db[_0x2b5159('0x4c')][_0x2b5159('0x30')](_0x3371ff);})[_0x2b1bf9('0xc')](function(_0xb5d198){const _0x866989=_0x2b1bf9;if(_0xb5d198)return db[_0x866989('0x37')][_0x866989('0x35')]({'where':{'id':_[_0x866989('0x13')](_0xb5d198,_0x866989('0x48')),'role':_0x866989('0x33')},'attributes':['id',_0x866989('0x21'),_0x866989('0x22'),_0x866989('0x18'),_0x866989('0x60')]});})['then'](function(_0x4cf20a){const _0xf6dfad=_0x2b1bf9;return _0x4cf20a?{'count':_0x4cf20a['count'],'rows':_[_0xf6dfad('0x13')](_0x4cf20a[_0xf6dfad('0x55')],function(_0x2cc9e6){const _0x199f0b=_0xf6dfad;return{'membername':_0x2cc9e6[_0x199f0b('0x21')],'UserId':_0x2cc9e6['id'],'queue_name':_0x519b1c[_0x199f0b('0x21')],'FaxQueueId':_0x519b1c['id'],'interface':util[_0x199f0b('0x47')](_0x199f0b('0x6b'),'SIP',_0x2cc9e6[_0x199f0b('0x21')]),'penalty':0x0,'paused':_0x2cc9e6[_0x199f0b('0x22')],'createdAt':_0x2cc9e6[_0x199f0b('0x60')],'updatedAt':_0x2cc9e6[_0x199f0b('0x18')]};})}:{'count':0x0,'rows':[]};})[_0x2b1bf9('0xc')](respondWithFilteredResult(_0x2b61be,_0x3371ff))[_0x2b1bf9('0x41')](handleError(_0x2b61be,null));},exports[_0x3df809('0x1f')]=function(_0x188398,_0x473e4d){const _0x4cb35b=_0x3df809;let _0x5906b8={};const _0x3b4721={};let _0x504539,_0x5741ed;return db[_0x4cb35b('0x3d')][_0x4cb35b('0x20')]({'where':{'id':_0x188398[_0x4cb35b('0x2f')]['id']}})[_0x4cb35b('0xc')](handleEntityNotFound(_0x473e4d,null))[_0x4cb35b('0xc')](function(_0x519844){const _0x4703e6=_0x4cb35b;if(_0x519844)return _0x504539=_0x519844,_0x3b4721['model']=_[_0x4703e6('0x59')](db['Team'][_0x4703e6('0x4e')]),_0x3b4721[_0x4703e6('0x31')]=_[_0x4703e6('0x59')](_0x188398[_0x4703e6('0x31')]),_0x3b4721[_0x4703e6('0x32')]=_[_0x4703e6('0x9')](_0x3b4721[_0x4703e6('0x5c')],_0x3b4721['query']),_0x5906b8[_0x4703e6('0x10')]=_['intersection'](_0x3b4721['model'],qs[_0x4703e6('0x5b')](_0x188398[_0x4703e6('0x31')][_0x4703e6('0x5b')])),_0x5906b8[_0x4703e6('0x10')]=_0x5906b8[_0x4703e6('0x10')][_0x4703e6('0x1c')]?_0x5906b8['attributes']:_0x3b4721[_0x4703e6('0x5c')],_0x5906b8[_0x4703e6('0x4f')]=qs[_0x4703e6('0x24')](_0x188398['query'][_0x4703e6('0x24')]),_0x5906b8['where']=qs[_0x4703e6('0x32')](_[_0x4703e6('0x23')](_0x188398[_0x4703e6('0x31')],_0x3b4721[_0x4703e6('0x32')])),_0x188398[_0x4703e6('0x31')][_0x4703e6('0x67')]&&(_0x5906b8[_0x4703e6('0xf')]=_[_0x4703e6('0x0')](_0x5906b8[_0x4703e6('0xf')],{[Op['or']]:_[_0x4703e6('0x13')](_0x5906b8[_0x4703e6('0x10')],function(_0x5487df){const _0x53dfe4=_0x4703e6,_0x11c2d5={};return _0x11c2d5[_0x5487df]={[Op[_0x53dfe4('0x43')]]:'%'+_0x188398[_0x53dfe4('0x31')][_0x53dfe4('0x67')]+'%'},_0x11c2d5;})})),_0x5906b8=_[_0x4703e6('0x0')]({},_0x5906b8,_0x188398['options']),_0x504539['getTeams'](_0x5906b8);})['then'](function(_0x52ad1e){const _0x20dc2c=_0x4cb35b;if(_0x52ad1e)return _0x5741ed=_0x52ad1e[_0x20dc2c('0x1c')],typeof _0x188398[_0x20dc2c('0x31')][_0x20dc2c('0x63')]===_0x20dc2c('0x3')&&(_0x5906b8['limit']=qs['limit'](_0x188398['query']['limit']),_0x5906b8['offset']=qs[_0x20dc2c('0x42')](_0x188398[_0x20dc2c('0x31')][_0x20dc2c('0x42')])),_0x504539[_0x20dc2c('0x1f')](_0x5906b8);})[_0x4cb35b('0xc')](function(_0x483a8b){if(_0x483a8b)return _0x483a8b?{'count':_0x5741ed,'rows':_0x483a8b}:null;})[_0x4cb35b('0xc')](respondWithResult(_0x473e4d,null))[_0x4cb35b('0x41')](handleError(_0x473e4d,null));},exports[_0x3df809('0x5d')]=function(_0x3b2d09,_0x12f632){const _0x2b2ff=_0x3df809,_0x5c7f9d=_0x3b2d09[_0x2b2ff('0xb')][_0x2b2ff('0x39')];return db[_0x2b2ff('0x4a')]['findAll']({'where':{'id':_0x5c7f9d},'attributes':['id'],'include':[{'model':db[_0x2b2ff('0x37')],'as':'Agents','attributes':['id',_0x2b2ff('0x21'),_0x2b2ff('0x40'),'voicePause',_0x2b2ff('0x15')],'raw':!![]}]})[_0x2b2ff('0xc')](function(_0x571ddf){const _0x9bb6b7=_0x2b2ff;if(_0x571ddf){const _0x18c1c3=_['flatMap'](_0x571ddf,function(_0x35ee9e){const _0x24dafb=a212_0x291c,_0x13780d=_0x35ee9e[_0x24dafb('0x28')]({'plain':!![]});return _0x13780d['Agents'];});return db[_0x9bb6b7('0x3d')][_0x9bb6b7('0x20')]({'where':{'id':_0x3b2d09[_0x9bb6b7('0x2f')]['id']}})[_0x9bb6b7('0xc')](function(_0x41317e){const _0x27bd51=_0x9bb6b7;return db[_0x27bd51('0x44')][_0x27bd51('0x5a')](function(_0x275622){const _0x2a54f7=_0x27bd51;return _0x41317e[_0x2a54f7('0x5d')](_0x5c7f9d,{'transaction':_0x275622})[_0x2a54f7('0xc')](function(){const _0x5c939e=_0x2a54f7;return Promise[_0x5c939e('0x2b')](_0x18c1c3,function(_0x3b8f09){const _0x570882=_0x5c939e;return db[_0x570882('0x4c')][_0x570882('0x1')]({'where':{'UserId':_0x3b8f09['id'],'FaxQueueId':_0x3b2d09[_0x570882('0x2f')]['id']},'transaction':_0x275622});});})[_0x2a54f7('0xc')](function(){const _0x284e42=_0x2a54f7;_0x18c1c3[_0x284e42('0x54')](function(_0x5a089a){const _0x5714d=_0x284e42;socket['emit'](_0x5714d('0xd'),{'UserId':_0x5a089a['id'],'FaxQueueId':_0x41317e['id']});});});});});}})[_0x2b2ff('0xc')](respondWithStatusCode(_0x12f632,null))[_0x2b2ff('0x41')](handleError(_0x12f632,null));},exports[_0x3df809('0x4d')]=function(_0x54d608,_0x3b7b8a){const _0x147a96=_0x3df809;return db[_0x147a96('0x4a')][_0x147a96('0x30')]({'where':{'id':_0x54d608[_0x147a96('0x31')][_0x147a96('0x39')]},'attributes':['id'],'include':[{'model':db[_0x147a96('0x37')],'as':_0x147a96('0x4'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3b7b8a,null))[_0x147a96('0xc')](function(_0x561408){const _0x76e796=_0x147a96,_0xb23ba7=_['map'](_0x561408,'id');let _0xf38673=[];const _0x4a35df=[],_0x5ed9be=squel[_0x76e796('0x2e')]();_0x5ed9be[_0x76e796('0x5')](_0x76e796('0x66'))[_0x76e796('0x51')](_0x76e796('0x49'),'tq')['join'](_0x76e796('0x46'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x76e796('0xf')]('FaxQueueId\x20=\x20?',_0x54d608[_0x76e796('0x2f')]['id']);for(let _0x5708d3=0x0;_0x5708d3<_0x561408[_0x76e796('0x1c')];_0x5708d3+=0x1){const _0x29c62b=_0x561408[_0x5708d3];for(let _0x6337b1=0x0;_0x6337b1<_0x29c62b['Agents'][_0x76e796('0x1c')];_0x6337b1+=0x1){const _0x27a487=_0x29c62b[_0x76e796('0x4')][_0x6337b1],_0x226b32=_0x5ed9be['clone']();_0x226b32[_0x76e796('0xf')]('ut.UserId\x20=\x20?',_0x27a487['id']),_0x4a35df[_0x76e796('0x3b')](db['sequelize'][_0x76e796('0x31')](_0x226b32[_0x76e796('0x3a')](),{'type':QueryTypes[_0x76e796('0x34')]})['then'](function(_0x5b00d8){const _0x245c9a=_0x76e796;if(_0x5b00d8[_0x245c9a('0x1c')]===0x1)return _0x27a487['id'];else{const _0x30b312=_[_0x245c9a('0x53')](_['map'](_0x5b00d8,_0x245c9a('0x2c')),function(_0x2950bd){return _['includes'](_0xb23ba7,_0x2950bd);});if(_0x30b312)return _0x27a487['id'];}}));}}return Promise[_0x76e796('0x6a')](_0x4a35df)[_0x76e796('0xc')](function(_0x5d3d4f){const _0x5809d2=_0x76e796;return _0xf38673=_(_0xf38673)['union'](_0x5d3d4f)[_0x5809d2('0x50')]()[_0x5809d2('0x2a')](),db[_0x5809d2('0x3d')][_0x5809d2('0x20')]({'where':{'id':_0x54d608['params']['id']}})[_0x5809d2('0xc')](function(_0x4697e5){const _0x5937a7=_0x5809d2;return db['sequelize'][_0x5937a7('0x5a')](function(_0x4c86b6){const _0x43f892=_0x5937a7;return _0x4697e5['removeTeams'](_0x54d608[_0x43f892('0x31')][_0x43f892('0x39')],{'transaction':_0x4c86b6})[_0x43f892('0xc')](function(){const _0x5704ed=_0x43f892;if(!_['isEmpty'](_0xf38673))return _0x4697e5[_0x5704ed('0x6f')](_0xf38673,{'transaction':_0x4c86b6});})[_0x43f892('0xc')](function(){const _0x4c0f65=_0x43f892;_0xf38673[_0x4c0f65('0x54')](function(_0xd9edfb){socket['emit']('userFaxQueue:remove',{'UserId':_0xd9edfb,'FaxQueueId':_0x4697e5['id']});});});});});});})[_0x147a96('0xc')](respondWithStatusCode(_0x3b7b8a,null))[_0x147a96('0x41')](handleError(_0x3b7b8a,null));},exports['addAgents']=function(_0x54a0f2,_0x4229a3){const _0xb327a6=_0x3df809;return db[_0xb327a6('0x3d')]['findOne']({'where':{'id':_0x54a0f2['params']['id']}})['then'](function(_0x46e918){const _0xc23efa=_0xb327a6;if(_0x46e918)return _0x46e918[_0xc23efa('0x52')](_0x54a0f2[_0xc23efa('0xb')][_0xc23efa('0x39')],{'through':_[_0xc23efa('0x16')](_0x54a0f2['body'],[_0xc23efa('0x39'),'id'])})[_0xc23efa('0xc')](function(_0x1f66e3){const _0x5c1b46=_0xc23efa;for(let _0xbf7a30=0x0;_0xbf7a30<_0x54a0f2[_0x5c1b46('0xb')][_0x5c1b46('0x39')][_0x5c1b46('0x1c')];_0xbf7a30+=0x1){socket[_0x5c1b46('0x1a')](_0x5c1b46('0xd'),{'UserId':_0x54a0f2[_0x5c1b46('0xb')][_0x5c1b46('0x39')][_0xbf7a30],'FaxQueueId':_0x54a0f2[_0x5c1b46('0x2f')]['id']});}return _0x1f66e3;});})[_0xb327a6('0xc')](respondWithResult(_0x4229a3,null))[_0xb327a6('0x41')](handleError(_0x4229a3,null));},exports['removeAgents']=function(_0x1525b6,_0x3154e0){const _0x5018ca=_0x3df809;return db[_0x5018ca('0x3d')]['findOne']({'where':{'id':_0x1525b6['params']['id']}})['then'](handleEntityNotFound(_0x3154e0,null))[_0x5018ca('0xc')](function(_0x26e4ea){const _0x56af8a=_0x5018ca;if(_0x26e4ea)return _0x26e4ea[_0x56af8a('0x6f')](_0x1525b6[_0x56af8a('0x31')]['ids'])[_0x56af8a('0xc')](function(){const _0x605468=_0x56af8a;if(_['isArray'](_0x1525b6[_0x605468('0x31')]['ids']))for(let _0xedb1bb=0x0;_0xedb1bb<_0x1525b6[_0x605468('0x31')][_0x605468('0x39')][_0x605468('0x1c')];_0xedb1bb+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x1525b6['query']['ids'][_0xedb1bb]),'FaxQueueId':Number(_0x1525b6[_0x605468('0x2f')]['id'])});}else socket[_0x605468('0x1a')](_0x605468('0x1e'),{'UserId':Number(_0x1525b6[_0x605468('0x31')]['ids']),'FaxQueueId':Number(_0x1525b6['params']['id'])});});})[_0x5018ca('0xc')](respondWithStatusCode(_0x3154e0,null))[_0x5018ca('0x41')](handleError(_0x3154e0,null));},exports[_0x3df809('0x5f')]=function(_0x177b54,_0xe54fe){const _0x3abf1c=_0x3df809;let _0x194e6a={};const _0x1c7c56={};let _0x5c16af,_0x583917;return db[_0x3abf1c('0x3d')][_0x3abf1c('0x20')]({'where':{'id':_0x177b54[_0x3abf1c('0x2f')]['id']}})['then'](handleEntityNotFound(_0xe54fe,null))[_0x3abf1c('0xc')](function(_0x506238){const _0x22f3ab=_0x3abf1c;if(_0x506238)return _0x5c16af=_0x506238,_0x1c7c56['model']=_[_0x22f3ab('0x59')](db[_0x22f3ab('0x37')][_0x22f3ab('0x4e')]),_0x1c7c56[_0x22f3ab('0x31')]=_['keys'](_0x177b54[_0x22f3ab('0x31')]),_0x1c7c56[_0x22f3ab('0x32')]=_[_0x22f3ab('0x9')](_0x1c7c56[_0x22f3ab('0x5c')],_0x1c7c56[_0x22f3ab('0x31')]),_0x194e6a[_0x22f3ab('0x10')]=_[_0x22f3ab('0x9')](_0x1c7c56[_0x22f3ab('0x5c')],qs[_0x22f3ab('0x5b')](_0x177b54[_0x22f3ab('0x31')][_0x22f3ab('0x5b')])),_0x194e6a[_0x22f3ab('0x10')]=_0x194e6a[_0x22f3ab('0x10')][_0x22f3ab('0x1c')]?_0x194e6a[_0x22f3ab('0x10')]:_0x1c7c56['model'],_0x194e6a[_0x22f3ab('0x4f')]=qs[_0x22f3ab('0x24')](_0x177b54[_0x22f3ab('0x31')][_0x22f3ab('0x24')]),_0x194e6a[_0x22f3ab('0xf')]=qs[_0x22f3ab('0x32')](_[_0x22f3ab('0x23')](_0x177b54[_0x22f3ab('0x31')],_0x1c7c56[_0x22f3ab('0x32')])),_0x177b54[_0x22f3ab('0x31')][_0x22f3ab('0x67')]&&(_0x194e6a[_0x22f3ab('0xf')]=_[_0x22f3ab('0x0')](_0x194e6a[_0x22f3ab('0xf')],{[Op['or']]:_[_0x22f3ab('0x13')](_0x194e6a[_0x22f3ab('0x10')],function(_0x5d259c){const _0x5cdcd4=_0x22f3ab,_0x43b45f={};return _0x43b45f[_0x5d259c]={[Op[_0x5cdcd4('0x43')]]:'%'+_0x177b54['query'][_0x5cdcd4('0x67')]+'%'},_0x43b45f;})})),_0x194e6a=_['merge']({},_0x194e6a,_0x177b54[_0x22f3ab('0x3c')]),_0x5c16af['getAgents'](_0x194e6a);})['then'](function(_0x31e78d){const _0x2b1f03=_0x3abf1c;if(_0x31e78d)return _0x583917=_0x31e78d['length'],typeof _0x177b54[_0x2b1f03('0x31')]['nolimit']===_0x2b1f03('0x3')&&(_0x194e6a[_0x2b1f03('0x65')]=qs[_0x2b1f03('0x65')](_0x177b54[_0x2b1f03('0x31')]['limit']),_0x194e6a['offset']=qs[_0x2b1f03('0x42')](_0x177b54['query'][_0x2b1f03('0x42')])),_0x5c16af['getAgents'](_0x194e6a);})['then'](function(_0x4033da){if(_0x4033da)return _0x4033da?{'count':_0x583917,'rows':_0x4033da}:null;})[_0x3abf1c('0xc')](respondWithResult(_0xe54fe,null))[_0x3abf1c('0x41')](handleError(_0xe54fe,null));};
\ No newline at end of file