Built motion from commit 709aa6fb5ed03aa61bc373fcdbf622215d37d30b. Version 3.0.0...
[motion-next.git] / server / api / team / team.controller.js
1 const a626_0x3794=['pick','../../mysqldb','userTeam:save','end','like','./team.socket','UserProfileSection','UserProfileResource','params','sendStatus','user','openchannel','User','model','all','voicePause','Teams','removeQueues','index','body','whatsapp','type','mail','send','merge','update','fieldName','addAgents','util','rows','userTeam:remove','includeAll','include','add','removeAgents','channel','filters','fields','Unable\x20to\x20retrieve\x20the\x20current\x20user','sms','show','interface','destroy','isNil','fax','query','order','options','map','json','register','findAll','lodash','get','ids','Unknown\x20channel','error','where','upsert','omit','catch','role','count','../../config/logger','chat','create','findOne','then','voice','SIP/%s','Queues','limit','name','Queue','Team','length','sequelize','nolimit','api','toLowerCase','attributes','undefined','stack','remove','emit','keys','UserVoiceQueueRt','VIRTUAL','getQueues','status','sort','filter','offset','capitalize','Content-Range','isValidChannel','getAgents','intersection','key','rawAttributes'];(function(_0xd83a12,_0x3794e5){const _0x2ba9a3=function(_0x54f608){while(--_0x54f608){_0xd83a12['push'](_0xd83a12['shift']());}};_0x2ba9a3(++_0x3794e5);}(a626_0x3794,0x159));const a626_0x2ba9=function(_0xd83a12,_0x3794e5){_0xd83a12=_0xd83a12-0x0;let _0x2ba9a3=a626_0x3794[_0xd83a12];return _0x2ba9a3;};const _0x167b31=a626_0x2ba9;'use strict';const util=require(_0x167b31('0x53')),_=require(_0x167b31('0x7')),qs=require('../../components/parsers/qs'),logger=require(_0x167b31('0x12'))(_0x167b31('0x21')),utils=require('../../config/utils'),{getSocket}=require('../../rediscache'),socket=getSocket(),db=require(_0x167b31('0x38'))['db'],{Op,ValidationError}=require(_0x167b31('0x1f'));require(_0x167b31('0x3c'))[_0x167b31('0x5')](socket);function respondWithStatusCode(_0x54f608,_0x35d790){return _0x35d790=_0x35d790||0xcc,function(_0x23b0ce){const _0x572cf2=a626_0x2ba9;if(_0x23b0ce)return _0x54f608[_0x572cf2('0x40')](_0x35d790);return _0x54f608[_0x572cf2('0x2c')](_0x35d790)[_0x572cf2('0x3a')]();};}function respondWithResult(_0x1bc2d1,_0x3ea46a){return _0x3ea46a=_0x3ea46a||0xc8,function(_0x463599){const _0x41456a=a626_0x2ba9;if(_0x463599)return _0x1bc2d1['status'](_0x3ea46a)[_0x41456a('0x4')](_0x463599);};}function respondWithFilteredResult(_0x58bd80,_0x1ca534){return function(_0x347131){const _0x51de55=a626_0x2ba9;if(_0x347131){const _0x542d9d=_0x347131[_0x51de55('0x11')],_0x26578a=_0x1ca534[_0x51de55('0x2f')];let _0x1fec8b=_0x1ca534[_0x51de55('0x2f')]+_0x1ca534[_0x51de55('0x1a')],_0x41406;return _0x1fec8b>=_0x542d9d?(_0x1fec8b=_0x542d9d,_0x41406=0xc8):_0x41406=0xce,_0x58bd80[_0x51de55('0x2c')](_0x41406),_0x58bd80['set'](_0x51de55('0x31'),_0x26578a+'-'+_0x1fec8b+'/'+_0x542d9d)[_0x51de55('0x4')](_0x347131);}return null;};}function saveUpdates(_0x49af57){return function(_0x232ea5){if(_0x232ea5)return _0x232ea5['update'](_0x49af57)['then'](function(_0x164225){return _0x164225;});return null;};}function removeEntity(_0x39d616){return function(_0x565f01){const _0x53e31b=a626_0x2ba9;if(_0x565f01)return _0x565f01['destroy']()[_0x53e31b('0x16')](function(){const _0x209615=_0x53e31b,_0xdbd457=_0x565f01[_0x209615('0x8')]({'plain':!![]}),_0x3ca415='Teams';return db[_0x209615('0x3e')][_0x209615('0x61')]({'where':{'type':_0x3ca415,'resourceId':_0xdbd457['id']}})[_0x209615('0x16')](function(){return _0x565f01;});})[_0x53e31b('0x16')](function(){const _0x345401=_0x53e31b;_0x39d616[_0x345401('0x2c')](0xcc)[_0x345401('0x3a')]();});};}function handleEntityNotFound(_0x3e0f26){return function(_0x402fbe){const _0x5a9826=a626_0x2ba9;return!_0x402fbe&&_0x3e0f26[_0x5a9826('0x40')](0x194),_0x402fbe;};}function handleError(_0x463f96,_0xb4f135){return _0xb4f135=_0xb4f135||0x1f4,function(_0x14b032){const _0x13a1e1=a626_0x2ba9;logger['error'](_0x14b032[_0x13a1e1('0x25')]),_0x14b032[_0x13a1e1('0x1b')]&&delete _0x14b032['name'],_0x463f96[_0x13a1e1('0x2c')](_0xb4f135)[_0x13a1e1('0x4e')](_0x14b032);};}exports[_0x167b31('0x49')]=function(_0x298181,_0x1f920a){const _0x24de59=_0x167b31;let _0x4c2413={};const _0x50a01b={},_0x164b21={'count':0x0,'rows':[]},_0x46a70a=_[_0x24de59('0x3')](db['Team'][_0x24de59('0x36')],function(_0x45ef06){const _0x44a555=_0x24de59;return{'name':_0x45ef06[_0x44a555('0x51')],'type':_0x45ef06[_0x44a555('0x4c')][_0x44a555('0x35')]};});_0x50a01b[_0x24de59('0x44')]=_['map'](_0x46a70a,_0x24de59('0x1b')),_0x50a01b['query']=_['keys'](_0x298181['query']),_0x50a01b[_0x24de59('0x5b')]=_[_0x24de59('0x34')](_0x50a01b[_0x24de59('0x44')],_0x50a01b[_0x24de59('0x0')]),_0x4c2413['attributes']=_['intersection'](_0x50a01b[_0x24de59('0x44')],qs[_0x24de59('0x5c')](_0x298181[_0x24de59('0x0')][_0x24de59('0x5c')])),_0x4c2413[_0x24de59('0x23')]=_0x4c2413[_0x24de59('0x23')][_0x24de59('0x1e')]?_0x4c2413[_0x24de59('0x23')]:_0x50a01b['model'];typeof _0x298181[_0x24de59('0x0')]['nolimit']===_0x24de59('0x24')&&(_0x4c2413[_0x24de59('0x1a')]=qs[_0x24de59('0x1a')](_0x298181[_0x24de59('0x0')][_0x24de59('0x1a')]),_0x4c2413[_0x24de59('0x2f')]=qs[_0x24de59('0x2f')](_0x298181[_0x24de59('0x0')][_0x24de59('0x2f')]));_0x4c2413[_0x24de59('0x1')]=qs['sort'](_0x298181[_0x24de59('0x0')][_0x24de59('0x2d')]),_0x4c2413[_0x24de59('0xc')]=qs[_0x24de59('0x5b')](_[_0x24de59('0x37')](_0x298181[_0x24de59('0x0')],_0x50a01b[_0x24de59('0x5b')]),_0x46a70a);_0x298181[_0x24de59('0x0')][_0x24de59('0x2e')]&&(_0x4c2413['where']=_['merge'](_0x4c2413[_0x24de59('0xc')],{[Op['or']]:_[_0x24de59('0x3')](_0x46a70a,function(_0x2821f5){const _0x5efeb=_0x24de59;if(_0x2821f5[_0x5efeb('0x4c')]!==_0x5efeb('0x2a')){const _0x23d852={};return _0x23d852[_0x2821f5[_0x5efeb('0x1b')]]={[Op['like']]:'%'+_0x298181['query']['filter']+'%'},_0x23d852;}})}));_0x4c2413=_[_0x24de59('0x4f')]({},_0x4c2413,_0x298181['options']);const _0x37307f={'where':_0x4c2413[_0x24de59('0xc')]};return db['Team'][_0x24de59('0x11')](_0x37307f)['then'](function(_0x25d668){const _0x4e9c44=_0x24de59;return _0x164b21[_0x4e9c44('0x11')]=_0x25d668,_0x298181[_0x4e9c44('0x0')][_0x4e9c44('0x56')]&&(_0x4c2413[_0x4e9c44('0x57')]=[{'all':!![]}]),db[_0x4e9c44('0x1d')]['findAll'](_0x4c2413);})[_0x24de59('0x16')](function(_0x3ff0f8){const _0x258b86=_0x24de59;return _0x164b21[_0x258b86('0x54')]=_0x3ff0f8,_0x164b21;})[_0x24de59('0x16')](respondWithFilteredResult(_0x1f920a,_0x4c2413))[_0x24de59('0xf')](handleError(_0x1f920a,null));},exports[_0x167b31('0x5f')]=function(_0x27a5f0,_0x3fa4e2){const _0x4ca548=_0x167b31;let _0x474256={'raw':![],'where':{'id':_0x27a5f0['params']['id']}};const _0x32ab81={};return _0x32ab81[_0x4ca548('0x44')]=_['keys'](db[_0x4ca548('0x1d')]['rawAttributes']),_0x32ab81['query']=_['keys'](_0x27a5f0['query']),_0x32ab81[_0x4ca548('0x5b')]=_[_0x4ca548('0x34')](_0x32ab81[_0x4ca548('0x44')],_0x32ab81[_0x4ca548('0x0')]),_0x474256['attributes']=_['intersection'](_0x32ab81[_0x4ca548('0x44')],qs[_0x4ca548('0x5c')](_0x27a5f0['query']['fields'])),_0x474256['attributes']=_0x474256[_0x4ca548('0x23')][_0x4ca548('0x1e')]?_0x474256['attributes']:_0x32ab81[_0x4ca548('0x44')],_0x27a5f0['query'][_0x4ca548('0x56')]&&(_0x474256['include']=[{'all':!![]}]),_0x474256=_['merge']({},_0x474256,_0x27a5f0['options']),db[_0x4ca548('0x1d')][_0x4ca548('0x15')](_0x474256)[_0x4ca548('0x16')](handleEntityNotFound(_0x3fa4e2,null))[_0x4ca548('0x16')](respondWithResult(_0x3fa4e2,null))['catch'](handleError(_0x3fa4e2,null));},exports[_0x167b31('0x14')]=function(_0xfd4193,_0x4fb64b){const _0x82bf58=_0x167b31;return db['Team'][_0x82bf58('0x14')](_0xfd4193['body'],{})[_0x82bf58('0x16')](function(_0x6da405){const _0x39ca8b=_0x82bf58,_0x209aad=_0xfd4193[_0x39ca8b('0x41')][_0x39ca8b('0x8')]({'plain':!![]});if(!_0x209aad)throw new Error(_0x39ca8b('0x5d'));if(_0x209aad[_0x39ca8b('0x10')]===_0x39ca8b('0x41')){const _0x24e5b8=_0x6da405[_0x39ca8b('0x8')]({'plain':!![]}),_0x3f738f=_0x39ca8b('0x47');return db[_0x39ca8b('0x3d')][_0x39ca8b('0x15')]({'where':{'name':_0x3f738f,'userProfileId':_0x209aad['userProfileId']},'raw':!![]})['then'](function(_0x57b087){const _0x2ddcd5=_0x39ca8b;return _0x57b087&&_0x57b087['autoAssociation']===0x0?db[_0x2ddcd5('0x3e')][_0x2ddcd5('0x14')]({'name':_0x24e5b8[_0x2ddcd5('0x1b')],'resourceId':_0x24e5b8['id'],'type':_0x57b087[_0x2ddcd5('0x1b')],'sectionId':_0x57b087['id']},{})['then'](function(){return _0x6da405;}):_0x6da405;})[_0x39ca8b('0xf')](function(_0x5b9e70){const _0x33b83f=_0x39ca8b;logger[_0x33b83f('0xb')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b9e70);throw _0x5b9e70;});}return _0x6da405;})[_0x82bf58('0x16')](respondWithResult(_0x4fb64b,0xc9))[_0x82bf58('0xf')](handleError(_0x4fb64b,null));},exports[_0x167b31('0x50')]=function(_0x10b110,_0xa342cf){const _0xe73db3=_0x167b31;return _0x10b110[_0xe73db3('0x4a')]['id']&&delete _0x10b110['body']['id'],db[_0xe73db3('0x1d')]['findOne']({'where':{'id':_0x10b110[_0xe73db3('0x3f')]['id']}})['then'](handleEntityNotFound(_0xa342cf,null))[_0xe73db3('0x16')](saveUpdates(_0x10b110[_0xe73db3('0x4a')],null))[_0xe73db3('0x16')](respondWithResult(_0xa342cf,null))[_0xe73db3('0xf')](handleError(_0xa342cf,null));},exports[_0x167b31('0x61')]=function(_0x2ada8d,_0x43c341){const _0x9b55e3=_0x167b31;return db[_0x9b55e3('0x1d')][_0x9b55e3('0x15')]({'where':{'id':_0x2ada8d[_0x9b55e3('0x3f')]['id']}})[_0x9b55e3('0x16')](handleEntityNotFound(_0x43c341,null))[_0x9b55e3('0x16')](removeEntity(_0x43c341,null))[_0x9b55e3('0xf')](handleError(_0x43c341,null));},exports[_0x167b31('0x2b')]=function(_0x13ba06,_0x19dd20){const _0x759e46=_0x167b31;return db['Team'][_0x759e46('0x15')]({'where':{'id':_0x13ba06[_0x759e46('0x3f')]['id']}})[_0x759e46('0x16')](handleEntityNotFound(_0x19dd20,null))[_0x759e46('0x16')](function(_0x1db6fc){const _0x46d65e=_0x759e46;if(!_0x13ba06[_0x46d65e('0x0')]['channel']||!utils[_0x46d65e('0x32')](_0x13ba06['query']['channel']))throw new ValidationError(_0x46d65e('0xa'));let _0x4c2243={};const _0x311f13={};return _0x311f13[_0x46d65e('0x44')]=_[_0x46d65e('0x28')](db[_['capitalize'](_0x13ba06[_0x46d65e('0x0')][_0x46d65e('0x5a')][_0x46d65e('0x22')]())+_0x46d65e('0x1c')][_0x46d65e('0x36')]),_0x311f13[_0x46d65e('0x0')]=_[_0x46d65e('0x28')](_0x13ba06[_0x46d65e('0x0')]),_0x311f13['filters']=_[_0x46d65e('0x34')](_0x311f13[_0x46d65e('0x44')],_0x311f13[_0x46d65e('0x0')]),_0x4c2243[_0x46d65e('0x23')]=_[_0x46d65e('0x34')](_0x311f13['model'],qs['fields'](_0x13ba06[_0x46d65e('0x0')][_0x46d65e('0x5c')])),_0x4c2243[_0x46d65e('0x23')]=_0x4c2243[_0x46d65e('0x23')][_0x46d65e('0x1e')]?_0x4c2243['attributes']:_0x311f13[_0x46d65e('0x44')],_0x4c2243[_0x46d65e('0x1a')]=qs['limit'](_0x13ba06['query'][_0x46d65e('0x1a')]),_0x4c2243[_0x46d65e('0x2f')]=qs[_0x46d65e('0x2f')](_0x13ba06[_0x46d65e('0x0')][_0x46d65e('0x2f')]),_0x4c2243[_0x46d65e('0x1')]=qs[_0x46d65e('0x2d')](_0x13ba06['query'][_0x46d65e('0x2d')]),_0x4c2243[_0x46d65e('0xc')]=qs[_0x46d65e('0x5b')](_[_0x46d65e('0x37')](_0x13ba06['query'],_0x311f13[_0x46d65e('0x5b')])),_0x4c2243=_[_0x46d65e('0x4f')]({},_0x4c2243,_0x13ba06[_0x46d65e('0x2')]),_0x1db6fc[_0x46d65e('0x8')+_[_0x46d65e('0x30')](_0x13ba06[_0x46d65e('0x0')][_0x46d65e('0x5a')][_0x46d65e('0x22')]())+_0x46d65e('0x19')](_0x4c2243);})[_0x759e46('0x16')](respondWithResult(_0x19dd20,null))[_0x759e46('0xf')](handleError(_0x19dd20,null));},exports['addQueues']=function(_0x28d12b,_0x5139fd){const _0x2bbb86=_0x167b31;return db[_0x2bbb86('0x1d')][_0x2bbb86('0x15')]({'where':{'id':_0x28d12b[_0x2bbb86('0x3f')]['id']}})[_0x2bbb86('0x16')](function(_0x3d733d){const _0x55bbb2=_0x2bbb86;if(_0x3d733d){if(!_0x28d12b[_0x55bbb2('0x4a')][_0x55bbb2('0x5a')]||!utils[_0x55bbb2('0x32')](_0x28d12b[_0x55bbb2('0x4a')][_0x55bbb2('0x5a')]))throw new ValidationError(_0x55bbb2('0xa'));return _0x3d733d[_0x55bbb2('0x58')+_[_0x55bbb2('0x30')](_0x28d12b[_0x55bbb2('0x4a')][_0x55bbb2('0x5a')][_0x55bbb2('0x22')]())+_0x55bbb2('0x19')](_0x28d12b[_0x55bbb2('0x4a')][_0x55bbb2('0x9')]);}return null;})[_0x2bbb86('0x16')](handleEntityNotFound(_0x5139fd,null))[_0x2bbb86('0x16')](respondWithStatusCode(_0x5139fd,null))[_0x2bbb86('0xf')](handleError(_0x5139fd,null));},exports[_0x167b31('0x48')]=function(_0x729ca4,_0x49039c){const _0x168fd7=_0x167b31;return db[_0x168fd7('0x1d')][_0x168fd7('0x15')]({'where':{'id':_0x729ca4[_0x168fd7('0x3f')]['id']}})[_0x168fd7('0x16')](function(_0x218155){const _0x1286e5=_0x168fd7;if(_0x218155){if(!_0x729ca4[_0x1286e5('0x0')][_0x1286e5('0x5a')]||!utils['isValidChannel'](_0x729ca4[_0x1286e5('0x0')][_0x1286e5('0x5a')]))throw new ValidationError(_0x1286e5('0xa'));return _0x218155[_0x1286e5('0x26')+_[_0x1286e5('0x30')](_0x729ca4['query'][_0x1286e5('0x5a')][_0x1286e5('0x22')]())+_0x1286e5('0x19')](_0x729ca4['query']['ids']);}return null;})[_0x168fd7('0x16')](handleEntityNotFound(_0x49039c,null))[_0x168fd7('0x16')](respondWithStatusCode(_0x49039c,null))[_0x168fd7('0xf')](handleError(_0x49039c,null));},exports[_0x167b31('0x52')]=function(_0x544adf,_0x5bc171){const _0xb47643=_0x167b31;return db[_0xb47643('0x1d')][_0xb47643('0x15')]({'where':{'id':_0x544adf['params']['id']}})[_0xb47643('0x16')](function(_0x527d75){const _0x65a006=_0xb47643;if(_0x527d75){const _0x5b5552=['voice','chat',_0x65a006('0x4d'),_0x65a006('0x5e'),'fax',_0x65a006('0x42'),_0x65a006('0x4b')];return Promise[_0x65a006('0x45')](_0x5b5552[_0x65a006('0x3')](async _0x239515=>{const _0x1c6d95=_0x65a006,_0x548588=await _0x527d75['get'+_[_0x1c6d95('0x30')](_0x239515)+_0x1c6d95('0x19')]({'attributes':['id','name']});return _0x548588[_0x1c6d95('0x3')](async _0xb24b8=>{const _0x2d29cf=_0x1c6d95;await _0xb24b8[_0x2d29cf('0x52')](_0x544adf['body'][_0x2d29cf('0x9')]);if(_0x239515==='voice'){const _0x48de7e=await db['User'][_0x2d29cf('0x6')]({'where':{'id':_0x544adf[_0x2d29cf('0x4a')][_0x2d29cf('0x9')]},'attributes':['id',_0x2d29cf('0x1b'),'online',_0x2d29cf('0x46'),_0x2d29cf('0x60')],'raw':!![]}),_0x2aca8e=_[_0x2d29cf('0x2e')](_0x48de7e,{'online':0x1}),_0x19d5e7=_0x2aca8e[_0x2d29cf('0x3')](_0x5941fe=>{const _0x1ca701=_0x2d29cf;return db[_0x1ca701('0x29')][_0x1ca701('0xd')]({'membername':_0x5941fe[_0x1ca701('0x1b')],'UserId':_0x5941fe['id'],'queue_name':_0xb24b8[_0x1ca701('0x1b')],'VoiceQueueId':_0xb24b8['id'],'interface':_[_0x1ca701('0x62')](_0x5941fe[_0x1ca701('0x60')])?util['format'](_0x1ca701('0x18'),_0x5941fe[_0x1ca701('0x1b')]):_0x5941fe[_0x1ca701('0x60')],'paused':_0x5941fe[_0x1ca701('0x46')]||![],'penalty':0x0});});return Promise[_0x2d29cf('0x45')](_0x19d5e7);}}),_0x527d75;}))[_0x65a006('0x16')](function(){return _0x527d75;});}})['then'](function(_0xb121d3){const _0x1ece4d=_0xb47643;if(_0xb121d3)return _0xb121d3['addAgents'](_0x544adf[_0x1ece4d('0x4a')][_0x1ece4d('0x9')],{'through':_[_0x1ece4d('0xe')](_0x544adf[_0x1ece4d('0x4a')],['ids','id'])})['then'](function(_0x4040c4){const _0x1f404d=_0x1ece4d;for(let _0x3acaaa=0x0;_0x3acaaa<_0x544adf[_0x1f404d('0x4a')]['ids'][_0x1f404d('0x1e')];_0x3acaaa+=0x1){socket['emit'](_0x1f404d('0x39'),{'UserId':_0x544adf['body']['ids'][_0x3acaaa],'TeamId':_0x544adf[_0x1f404d('0x3f')]['id']});}return _0x4040c4;});})['then'](respondWithResult(_0x5bc171,null))['catch'](handleError(_0x5bc171,null));},exports[_0x167b31('0x59')]=function(_0x2b4cfc,_0x27b481){const _0x3a2580=_0x167b31;return db[_0x3a2580('0x1d')][_0x3a2580('0x15')]({'where':{'id':_0x2b4cfc[_0x3a2580('0x3f')]['id']}})[_0x3a2580('0x16')](handleEntityNotFound(_0x27b481,null))['then'](function(_0x2192a7){const _0xfbdfa0=_0x3a2580;if(_0x2192a7){const _0x321b95=['voice',_0xfbdfa0('0x13'),'mail','sms',_0xfbdfa0('0x63'),'openchannel',_0xfbdfa0('0x4b')];return Promise['all'](_0x321b95[_0xfbdfa0('0x3')](async _0x4ca9ce=>{const _0x29b06c=_0xfbdfa0,_0x4a3e63=await _0x2192a7[_0x29b06c('0x8')+_[_0x29b06c('0x30')](_0x4ca9ce)+_0x29b06c('0x19')]({'attributes':['id','name']});return _0x4a3e63[_0x29b06c('0x3')](async _0x11f211=>{const _0x107714=_0x29b06c;await _0x11f211[_0x107714('0x59')](_0x2b4cfc[_0x107714('0x0')][_0x107714('0x9')]),_0x4ca9ce===_0x107714('0x17')&&await db['UserVoiceQueueRt'][_0x107714('0x61')]({'where':{'VoiceQueueId':_0x11f211['id'],'UserId':_0x2b4cfc[_0x107714('0x0')]['ids']}});}),_0x2192a7;}))['then'](function(){return _0x2192a7;});}})[_0x3a2580('0x16')](function(_0x4c6eb7){const _0x40e21d=_0x3a2580;if(_0x4c6eb7)return _0x4c6eb7[_0x40e21d('0x59')](_0x2b4cfc[_0x40e21d('0x0')][_0x40e21d('0x9')])[_0x40e21d('0x16')](function(){const _0x4b286c=_0x40e21d;if(_['isArray'](_0x2b4cfc[_0x4b286c('0x0')]['ids']))for(let _0x40aa0a=0x0;_0x40aa0a<_0x2b4cfc['query'][_0x4b286c('0x9')][_0x4b286c('0x1e')];_0x40aa0a+=0x1){socket[_0x4b286c('0x27')]('userTeam:remove',{'UserId':Number(_0x2b4cfc['query']['ids'][_0x40aa0a]),'TeamId':Number(_0x2b4cfc[_0x4b286c('0x3f')]['id'])});}else socket['emit'](_0x4b286c('0x55'),{'UserId':Number(_0x2b4cfc['query'][_0x4b286c('0x9')]),'TeamId':Number(_0x2b4cfc['params']['id'])});});})[_0x3a2580('0x16')](respondWithStatusCode(_0x27b481,null))[_0x3a2580('0xf')](handleError(_0x27b481,null));},exports[_0x167b31('0x33')]=function(_0x526cbc,_0x2e9ac9){const _0x5c9a18=_0x167b31;let _0xdaa5e1={};const _0x30c07d={};let _0x23ba93,_0x42488a;return db['Team']['findOne']({'where':{'id':_0x526cbc[_0x5c9a18('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2e9ac9,null))[_0x5c9a18('0x16')](function(_0x6d3c06){const _0x254337=_0x5c9a18;if(_0x6d3c06)return _0x23ba93=_0x6d3c06,_0x30c07d['model']=_['keys'](db[_0x254337('0x43')][_0x254337('0x36')]),_0x30c07d[_0x254337('0x0')]=_[_0x254337('0x28')](_0x526cbc[_0x254337('0x0')]),_0x30c07d['filters']=_[_0x254337('0x34')](_0x30c07d[_0x254337('0x44')],_0x30c07d[_0x254337('0x0')]),_0xdaa5e1[_0x254337('0x23')]=_[_0x254337('0x34')](_0x30c07d[_0x254337('0x44')],qs[_0x254337('0x5c')](_0x526cbc[_0x254337('0x0')]['fields'])),_0xdaa5e1[_0x254337('0x23')]=_0xdaa5e1[_0x254337('0x23')][_0x254337('0x1e')]?_0xdaa5e1[_0x254337('0x23')]:_0x30c07d[_0x254337('0x44')],_0xdaa5e1[_0x254337('0x1')]=qs[_0x254337('0x2d')](_0x526cbc[_0x254337('0x0')]['sort']),_0xdaa5e1['where']=qs[_0x254337('0x5b')](_[_0x254337('0x37')](_0x526cbc[_0x254337('0x0')],_0x30c07d['filters'])),_0x526cbc['query'][_0x254337('0x2e')]&&(_0xdaa5e1['where']=_['merge'](_0xdaa5e1['where'],{[Op['or']]:_['map'](_0xdaa5e1[_0x254337('0x23')],function(_0x95da98){const _0x1bb90d=_0x254337,_0xb00e00={};return _0xb00e00[_0x95da98]={[Op[_0x1bb90d('0x3b')]]:'%'+_0x526cbc[_0x1bb90d('0x0')]['filter']+'%'},_0xb00e00;})})),_0xdaa5e1=_[_0x254337('0x4f')]({},_0xdaa5e1,_0x526cbc['options']),_0x23ba93[_0x254337('0x33')](_0xdaa5e1);})['then'](function(_0x1cbe7d){const _0x17fb3b=_0x5c9a18;if(_0x1cbe7d)return _0x42488a=_0x1cbe7d['length'],typeof _0x526cbc['query'][_0x17fb3b('0x20')]===_0x17fb3b('0x24')&&(_0xdaa5e1['limit']=qs[_0x17fb3b('0x1a')](_0x526cbc['query']['limit']),_0xdaa5e1[_0x17fb3b('0x2f')]=qs[_0x17fb3b('0x2f')](_0x526cbc['query'][_0x17fb3b('0x2f')])),_0x23ba93[_0x17fb3b('0x33')](_0xdaa5e1);})['then'](function(_0x4206b2){if(_0x4206b2)return _0x4206b2?{'count':_0x42488a,'rows':_0x4206b2}:null;})[_0x5c9a18('0x16')](respondWithResult(_0x2e9ac9,null))[_0x5c9a18('0xf')](handleError(_0x2e9ac9,null));};