f6f2c5cd1d5793e4c35d2fb1396578ad2dce186f
[motion.git] / server / api / voice_queue / voice_queue.controller.js
1 var _0x9860=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x55\x73\x65\x72\x48\x61\x73\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65\x73\x49\x64\x42\x79\x55\x73\x65\x72","\x69\x64","\x75\x73\x65\x72","\x66\x69\x6E\x64\x42\x79\x49\x64","\x6C\x6F\x67","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x72\x6F\x6C\x65","\x67\x65\x74\x52\x65\x61\x6C\x74\x69\x6D\x65\x51\x75\x65\x75\x65\x73","\x72\x6F\x77\x73","\x6E\x61\x6D\x65","\x6D\x61\x70","\x75\x6E\x69\x6F\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x6D\x65\x72\x67\x65","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x70\x61\x72\x61\x6D\x73","\x73\x68\x6F\x77\x41\x67\x65\x6E\x74\x73","\x6C\x65\x6E\x67\x74\x68","\x61\x67\x65\x6E\x74","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x67\x65\x74\x55\x73\x65\x72\x73","\x63\x72\x65\x61\x74\x65","\x70\x75\x73\x68","\x50\x52\x49\x4D\x41\x52\x59","\x70\x61\x74\x68","\x65\x72\x72\x6F\x72\x73","\x20\x6D\x75\x73\x74\x20\x62\x65\x20\x75\x6E\x69\x71\x75\x65","\x6D\x65\x73\x73\x61\x67\x65","\x6A\x6F\x69\x6E","\x74\x72\x61\x6E\x73\x6C\x61\x74\x65\x64\x4D\x65\x73\x73\x61\x67\x65","\x4D\x45\x53\x53\x41\x47\x45\x5F\x45\x58\x49\x53\x54\x5F\x51\x55\x45\x55\x45","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x73\x61\x76\x65","\x53\x49\x50\x2F\x25\x73","\x66\x6F\x72\x6D\x61\x74","\x70\x65\x6E\x61\x6C\x74\x79","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x61\x67\x65\x6E\x74\x73","\x66\x69\x6E\x64\x41\x6C\x6C","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x61\x6C\x6C","\x72\x65\x6D\x6F\x76\x65\x41\x67\x65\x6E\x74\x73","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0x9860[0];var _=require(_0x9860[1]);var util=require(_0x9860[2]);var Util=require(_0x9860[3]);var sequelize=require(_0x9860[5])[_0x9860[4]];var User=require(_0x9860[5])[_0x9860[6]];var VoiceQueue=require(_0x9860[5])[_0x9860[7]];var UserHasVoiceQueue=require(_0x9860[5])[_0x9860[8]];var VoiceExtension=require(_0x9860[5])[_0x9860[9]];exports[_0x9860[10]]= function(_0xdf6fx9,_0xdf6fxa){switch(_0xdf6fx9[_0x9860[18]][_0x9860[23]]){case _0x9860[18]:return User[_0x9860[19]](_0xdf6fx9[_0x9860[18]][_0x9860[17]],{attributes:[_0x9860[17]]})[_0x9860[14]](Util[_0x9860[16]](_0xdf6fx9[_0x9860[15]]))[_0x9860[14]](function(_0xdf6fxc){_0xdf6fxa[_0x9860[13]](200)[_0x9860[12]](_0xdf6fxc)})[_0x9860[11]](function(_0xdf6fxb){return handleError(_0xdf6fxa,_0xdf6fxb)});default:return VoiceQueue[_0x9860[22]](Util[_0x9860[21]](_0xdf6fx9[_0x9860[15]]))[_0x9860[14]](function(_0xdf6fxc){_0xdf6fxa[_0x9860[13]](200)[_0x9860[12]](_0xdf6fxc)})[_0x9860[11]](function(_0xdf6fxb){console[_0x9860[20]](_0xdf6fxb);return handleError(_0xdf6fxa,_0xdf6fxb)})}};exports[_0x9860[24]]= function(_0xdf6fx9,_0xdf6fxa,_0xdf6fxd){switch(_0xdf6fx9[_0x9860[18]][_0x9860[23]]){case _0x9860[18]:var _0xdf6fxe=[];return User[_0x9860[19]](_0xdf6fx9[_0x9860[18]][_0x9860[17]],{attributes:[_0x9860[17]]})[_0x9860[14]](Util[_0x9860[16]]({},{attributes:[_0x9860[26]],include:[{raw:true,model:User,attributes:[_0x9860[17]]}]}))[_0x9860[14]](function(_0xdf6fxf){var _0xdf6fx10=_[_0x9860[27]](_0xdf6fxf[_0x9860[25]],_0x9860[26]);_0xdf6fxf[_0x9860[25]][_0x9860[29]](function(_0xdf6fx11){_0xdf6fxe= _[_0x9860[28]](_0xdf6fxe,_[_0x9860[27]](_0xdf6fx11.Users,_0x9860[17]))});return VoiceQueue[_0x9860[22]](_[_0x9860[30]](Util[_0x9860[21]](_0xdf6fx9[_0x9860[15]],{name:_0xdf6fx10}),{include:[{model:User,where:{id:_0xdf6fxe},required:false}]}))})[_0x9860[14]](function(_0xdf6fxc){return _0xdf6fxa[_0x9860[13]](200)[_0x9860[12]](_0xdf6fxc)})[_0x9860[11]](function(_0xdf6fxb){console[_0x9860[20]](_0xdf6fxb);return handleError(_0xdf6fxa,_0xdf6fxb)});default:return VoiceQueue[_0x9860[22]](_[_0x9860[30]](Util[_0x9860[21]](_0xdf6fx9[_0x9860[15]]),{include:[{model:User,required:false}]}))[_0x9860[14]](function(_0xdf6fxc){return _0xdf6fxa[_0x9860[13]](200)[_0x9860[12]](_0xdf6fxc)})[_0x9860[11]](function(_0xdf6fxb){console[_0x9860[20]](_0xdf6fxb);return handleError(_0xdf6fxa,_0xdf6fxb)})}};exports[_0x9860[31]]= function(_0xdf6fx9,_0xdf6fxa){return VoiceQueue[_0x9860[19]](_0xdf6fx9[_0x9860[33]][_0x9860[26]])[_0x9860[14]](function(_0xdf6fx12){if(!_0xdf6fx12){return _0xdf6fxa[_0x9860[32]](404)};return _0xdf6fxa[_0x9860[12]](_0xdf6fx12)})[_0x9860[11]](function(_0xdf6fxb){return handleError(_0xdf6fxa,_0xdf6fxb)})};exports[_0x9860[34]]= function(_0xdf6fx9,_0xdf6fxa){return VoiceQueue[_0x9860[19]](_0xdf6fx9[_0x9860[33]][_0x9860[26]])[_0x9860[14]](function(_0xdf6fx11){if(!_0xdf6fx11){return _0xdf6fxa[_0x9860[32]](404)};return _0xdf6fx11[_0x9860[39]]({where:{role:_0x9860[36]},attributes:[_0x9860[17],_0x9860[26],_0x9860[37],_0x9860[38]]})})[_0x9860[14]](function(_0xdf6fxe){return _0xdf6fxa[_0x9860[13]](200)[_0x9860[12]]({rows:_0xdf6fxe,count:_0xdf6fxe[_0x9860[35]]})})[_0x9860[11]](function(_0xdf6fxb){return handleError(_0xdf6fxa,_0xdf6fxb)})};exports[_0x9860[40]]= function(_0xdf6fx9,_0xdf6fxa){var _0xdf6fx13;return VoiceQueue[_0x9860[40]](_0xdf6fx9[_0x9860[50]])[_0x9860[14]](function(_0xdf6fx12){_0xdf6fx13= _0xdf6fx12})[_0x9860[14]](addAgents(_0xdf6fx9,_0xdf6fx9[_0x9860[50]][_0x9860[26]]))[_0x9860[14]](function(){return _0xdf6fxa[_0x9860[13]](201)[_0x9860[12]](_0xdf6fx13)})[_0x9860[11]](sequelize.UniqueConstraintError,function(_0xdf6fxb){var _0xdf6fx14=[];_0xdf6fxb[_0x9860[44]][_0x9860[29]](function(_0xdf6fx15){switch(_0xdf6fx15[_0x9860[43]]){case _0x9860[42]:_0xdf6fx14[_0x9860[41]](_0x9860[26]);break;default:_0xdf6fx14[_0x9860[41]](_0xdf6fx15[_0x9860[43]])}});_0xdf6fx14[_0x9860[41]](_0x9860[45]);_0xdf6fxb[_0x9860[46]]= _0xdf6fx14[_0x9860[47]]();_0xdf6fxb[_0x9860[48]]= _0x9860[49];return _0xdf6fxa[_0x9860[13]](500)[_0x9860[12]](_0xdf6fxb)})[_0x9860[11]](function(_0xdf6fxb){return handleError(_0xdf6fxa,_0xdf6fxb)})};exports[_0x9860[51]]= function(_0xdf6fx9,_0xdf6fxa){if(_0xdf6fx9[_0x9860[50]][_0x9860[26]]){delete _0xdf6fx9[_0x9860[50]][_0x9860[26]]};return VoiceQueue[_0x9860[19]](_0xdf6fx9[_0x9860[33]][_0x9860[26]])[_0x9860[14]](function(_0xdf6fx12){if(!_0xdf6fx12){return _0xdf6fxa[_0x9860[32]](404)};var _0xdf6fx16=_[_0x9860[30]](_0xdf6fx12,_0xdf6fx9[_0x9860[50]]);return _0xdf6fx16[_0x9860[52]]()})[_0x9860[14]](function(_0xdf6fx12){return _0xdf6fxa[_0x9860[13]](200)[_0x9860[12]](_0xdf6fx12)})[_0x9860[11]](function(_0xdf6fxb){console[_0x9860[20]](_0xdf6fxb);return handleError(_0xdf6fxa,_0xdf6fxb)})};function addAgents(_0xdf6fx9,_0xdf6fx11){return function(){return User[_0x9860[58]]({where:{id:_0xdf6fx9[_0x9860[50]][_0x9860[57]]},raw:true})[_0x9860[14]](function(_0xdf6fx18){var _0xdf6fx19=_[_0x9860[27]](_0xdf6fx18,function(_0xdf6fx1a){return {queue:_0xdf6fx11,interface:util[_0x9860[54]](_0x9860[53],_0xdf6fx1a[_0x9860[26]]),stateinterface:util[_0x9860[54]](_0x9860[53],_0xdf6fx1a[_0x9860[26]]),membername:_0xdf6fx1a[_0x9860[26]],UserId:_0xdf6fx1a[_0x9860[17]],penalty:_0xdf6fx9[_0x9860[50]][_0x9860[55]]}});return UserHasVoiceQueue[_0x9860[56]](_0xdf6fx19,{individualHooks:true})})}}exports[_0x9860[59]]= function(_0xdf6fx9,_0xdf6fxa,_0xdf6fxd){return Promise[_0x9860[60]]([])[_0x9860[14]](addAgents(_0xdf6fx9,_0xdf6fx9[_0x9860[33]][_0x9860[26]]))[_0x9860[14]](function(){return _0xdf6fxa[_0x9860[32]](200)})[_0x9860[11]](function(_0xdf6fxb){console[_0x9860[20]](_0xdf6fxb);return _0xdf6fxd(_0xdf6fxb)})};exports[_0x9860[61]]= function(_0xdf6fx9,_0xdf6fxa,_0xdf6fxd){return UserHasVoiceQueue[_0x9860[62]]({where:{UserId:_0xdf6fx9[_0x9860[15]][_0x9860[57]],queue:_0xdf6fx9[_0x9860[33]][_0x9860[26]]},individualHooks:true})[_0x9860[14]](function(){return _0xdf6fxa[_0x9860[32]](202)})[_0x9860[11]](function(_0xdf6fxb){return _0xdf6fxd(_0xdf6fxb)})};exports[_0x9860[62]]= function(_0xdf6fx9,_0xdf6fxa){return VoiceQueue[_0x9860[62]]({where:{name:_0xdf6fx9[_0x9860[33]][_0x9860[26]]},individualHooks:true})[_0x9860[14]](function(){return _0xdf6fxa[_0x9860[32]](204)})[_0x9860[11]](function(_0xdf6fxb){return handleError(_0xdf6fxa,_0xdf6fxb)})};exports[_0x9860[63]]= function(_0xdf6fx9,_0xdf6fxa){return VoiceQueue[_0x9860[62]]({where:{name:_0xdf6fx9[_0x9860[15]][_0x9860[64]]},individualHooks:true})[_0x9860[14]](function(){return _0xdf6fxa[_0x9860[32]](204)})[_0x9860[11]](function(_0xdf6fxb){return handleError(_0xdf6fxa,_0xdf6fxb)})};function handleError(_0xdf6fxa,_0xdf6fxb){return _0xdf6fxa[_0x9860[13]](500)[_0x9860[12]](_0xdf6fxb)}