da1ce8423c4c0640314d5f064eedb0d6224698f4
[motion.git] / server / api / voice_queue / voice_queue.controller.js
1 var _0xc578=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x61\x70\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\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","\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\x65\x61\x6C\x74\x69\x6D\x65\x51\x75\x65\x75\x65\x4D\x65\x6D\x62\x65\x72\x73","\x61\x6D\x69","\x6C\x6F\x63\x61\x6C\x73","\x61\x70\x70","\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","\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","\x73\x74\x61\x63\x6B","\x65\x72\x72\x6F\x72"];_0xc578[0];var _=require(_0xc578[1]);var logger=require(_0xc578[3])(_0xc578[2]);var util=require(_0xc578[4]);var Util=require(_0xc578[5]);var sequelize=require(_0xc578[7])[_0xc578[6]];var User=require(_0xc578[7])[_0xc578[8]];var VoiceQueue=require(_0xc578[7])[_0xc578[9]];var UserHasVoiceQueue=require(_0xc578[7])[_0xc578[10]];var VoiceExtension=require(_0xc578[7])[_0xc578[11]];exports[_0xc578[12]]= function(_0xcb2fxa,_0xcb2fxb){switch(_0xcb2fxa[_0xc578[20]][_0xc578[24]]){case _0xc578[20]:return User[_0xc578[21]](_0xcb2fxa[_0xc578[20]][_0xc578[19]],{attributes:[_0xc578[19]]})[_0xc578[16]](Util[_0xc578[18]](_0xcb2fxa[_0xc578[17]]))[_0xc578[16]](function(_0xcb2fxd){_0xcb2fxb[_0xc578[15]](200)[_0xc578[14]](_0xcb2fxd)})[_0xc578[13]](function(_0xcb2fxc){return handleError(_0xcb2fxb,_0xcb2fxc)});default:return VoiceQueue[_0xc578[23]](Util[_0xc578[22]](_0xcb2fxa[_0xc578[17]]))[_0xc578[16]](function(_0xcb2fxd){_0xcb2fxb[_0xc578[15]](200)[_0xc578[14]](_0xcb2fxd)})[_0xc578[13]](function(_0xcb2fxc){return handleError(_0xcb2fxb,_0xcb2fxc)})}};exports[_0xc578[25]]= function(_0xcb2fxa,_0xcb2fxb,_0xcb2fxe){var _0xcb2fxf;switch(_0xcb2fxa[_0xc578[20]][_0xc578[24]]){case _0xc578[20]:var _0xcb2fx10=[];return User[_0xc578[21]](_0xcb2fxa[_0xc578[20]][_0xc578[19]],{attributes:[_0xc578[19]]})[_0xc578[16]](Util[_0xc578[18]]({},{attributes:[_0xc578[31]],include:[{raw:true,model:User,attributes:[_0xc578[19]]}]}))[_0xc578[16]](function(_0xcb2fx11){_0xcb2fxf= _[_0xc578[32]](_0xcb2fx11[_0xc578[30]],_0xc578[31]);_0xcb2fx11[_0xc578[30]][_0xc578[34]](function(_0xcb2fx12){_0xcb2fx10= _[_0xc578[33]](_0xcb2fx10,_[_0xc578[32]](_0xcb2fx12.Users,_0xc578[19]))});return VoiceQueue[_0xc578[23]](_[_0xc578[35]](Util[_0xc578[22]](_0xcb2fxa[_0xc578[17]],{name:_0xcb2fxf}),{include:[{model:User,where:{id:_0xcb2fx10},required:false}]}))})[_0xc578[16]](function(_0xcb2fxd){_0xcb2fxa[_0xc578[29]][_0xc578[28]][_0xc578[27]][_0xc578[14]]({message:_0xc578[26],queues:_0xcb2fxf});return _0xcb2fxb[_0xc578[15]](200)[_0xc578[14]](_0xcb2fxd)})[_0xc578[13]](function(_0xcb2fxc){return handleError(_0xcb2fxb,_0xcb2fxc)});default:return VoiceQueue[_0xc578[23]](_[_0xc578[35]](Util[_0xc578[22]](_0xcb2fxa[_0xc578[17]]),{include:[{model:User,required:false}]}))[_0xc578[16]](function(_0xcb2fxd){_0xcb2fxf= _[_0xc578[32]](_0xcb2fxd[_0xc578[30]],_0xc578[31]);_0xcb2fxa[_0xc578[29]][_0xc578[28]][_0xc578[27]][_0xc578[14]]({message:_0xc578[26],queues:_0xcb2fxf});return _0xcb2fxb[_0xc578[15]](200)[_0xc578[14]](_0xcb2fxd)})[_0xc578[13]](function(_0xcb2fxc){return handleError(_0xcb2fxb,_0xcb2fxc)})}};exports[_0xc578[36]]= function(_0xcb2fxa,_0xcb2fxb){return VoiceQueue[_0xc578[21]](_0xcb2fxa[_0xc578[38]][_0xc578[31]])[_0xc578[16]](function(_0xcb2fx13){if(!_0xcb2fx13){return _0xcb2fxb[_0xc578[37]](404)};return _0xcb2fxb[_0xc578[14]](_0xcb2fx13)})[_0xc578[13]](function(_0xcb2fxc){return handleError(_0xcb2fxb,_0xcb2fxc)})};exports[_0xc578[39]]= function(_0xcb2fxa,_0xcb2fxb){return VoiceQueue[_0xc578[21]](_0xcb2fxa[_0xc578[38]][_0xc578[31]])[_0xc578[16]](function(_0xcb2fx12){if(!_0xcb2fx12){return _0xcb2fxb[_0xc578[37]](404)};return _0xcb2fx12[_0xc578[42]]({where:{role:_0xc578[41]}})})[_0xc578[16]](function(_0xcb2fx10){return _0xcb2fxb[_0xc578[15]](200)[_0xc578[14]]({rows:_0xcb2fx10,count:_0xcb2fx10[_0xc578[40]]})})[_0xc578[13]](function(_0xcb2fxc){return handleError(_0xcb2fxb,_0xcb2fxc)})};exports[_0xc578[43]]= function(_0xcb2fxa,_0xcb2fxb){var _0xcb2fx14;return VoiceQueue[_0xc578[43]](_0xcb2fxa[_0xc578[53]])[_0xc578[16]](function(_0xcb2fx13){_0xcb2fx14= _0xcb2fx13})[_0xc578[16]](addAgents(_0xcb2fxa,_0xcb2fxa[_0xc578[53]][_0xc578[31]]))[_0xc578[16]](function(){return _0xcb2fxb[_0xc578[15]](201)[_0xc578[14]](_0xcb2fx14)})[_0xc578[13]](sequelize.UniqueConstraintError,function(_0xcb2fxc){var _0xcb2fx15=[];_0xcb2fxc[_0xc578[47]][_0xc578[34]](function(_0xcb2fx16){switch(_0xcb2fx16[_0xc578[46]]){case _0xc578[45]:_0xcb2fx15[_0xc578[44]](_0xc578[31]);break;default:_0xcb2fx15[_0xc578[44]](_0xcb2fx16[_0xc578[46]])}});_0xcb2fx15[_0xc578[44]](_0xc578[48]);_0xcb2fxc[_0xc578[49]]= _0xcb2fx15[_0xc578[50]]();_0xcb2fxc[_0xc578[51]]= _0xc578[52];return _0xcb2fxb[_0xc578[15]](500)[_0xc578[14]](_0xcb2fxc)})[_0xc578[13]](function(_0xcb2fxc){return handleError(_0xcb2fxb,_0xcb2fxc)})};exports[_0xc578[54]]= function(_0xcb2fxa,_0xcb2fxb){if(_0xcb2fxa[_0xc578[53]][_0xc578[31]]){delete _0xcb2fxa[_0xc578[53]][_0xc578[31]]};return VoiceQueue[_0xc578[21]](_0xcb2fxa[_0xc578[38]][_0xc578[31]])[_0xc578[16]](function(_0xcb2fx13){if(!_0xcb2fx13){return _0xcb2fxb[_0xc578[37]](404)};var _0xcb2fx17=_[_0xc578[35]](_0xcb2fx13,_0xcb2fxa[_0xc578[53]]);return _0xcb2fx17[_0xc578[55]]()})[_0xc578[16]](function(_0xcb2fx13){return _0xcb2fxb[_0xc578[15]](200)[_0xc578[14]](_0xcb2fx13)})[_0xc578[13]](function(_0xcb2fxc){return handleError(_0xcb2fxb,_0xcb2fxc)})};function addAgents(_0xcb2fxa,_0xcb2fx12){return function(){return User[_0xc578[61]]({where:{id:_0xcb2fxa[_0xc578[53]][_0xc578[60]]},raw:true})[_0xc578[16]](function(_0xcb2fx19){var _0xcb2fx1a=_[_0xc578[32]](_0xcb2fx19,function(_0xcb2fx1b){return {queue:_0xcb2fx12,interface:util[_0xc578[57]](_0xc578[56],_0xcb2fx1b[_0xc578[31]]),stateinterface:util[_0xc578[57]](_0xc578[56],_0xcb2fx1b[_0xc578[31]]),membername:_0xcb2fx1b[_0xc578[31]],UserId:_0xcb2fx1b[_0xc578[19]],penalty:_0xcb2fxa[_0xc578[53]][_0xc578[58]]}});return UserHasVoiceQueue[_0xc578[59]](_0xcb2fx1a,{individualHooks:true})})}}exports[_0xc578[62]]= function(_0xcb2fxa,_0xcb2fxb,_0xcb2fxe){return Promise[_0xc578[63]]([])[_0xc578[16]](addAgents(_0xcb2fxa,_0xcb2fxa[_0xc578[38]][_0xc578[31]]))[_0xc578[16]](function(){return _0xcb2fxb[_0xc578[37]](200)})[_0xc578[13]](function(_0xcb2fxc){return handleError(_0xcb2fxb,_0xcb2fxc)})};exports[_0xc578[64]]= function(_0xcb2fxa,_0xcb2fxb,_0xcb2fxe){return UserHasVoiceQueue[_0xc578[65]]({where:{UserId:_0xcb2fxa[_0xc578[17]][_0xc578[60]],queue:_0xcb2fxa[_0xc578[38]][_0xc578[31]]},individualHooks:true})[_0xc578[16]](function(){return _0xcb2fxb[_0xc578[37]](202)})[_0xc578[13]](function(_0xcb2fxc){return _0xcb2fxe(_0xcb2fxc)})};exports[_0xc578[65]]= function(_0xcb2fxa,_0xcb2fxb){return VoiceQueue[_0xc578[65]]({where:{name:_0xcb2fxa[_0xc578[38]][_0xc578[31]]},individualHooks:true})[_0xc578[16]](function(){return _0xcb2fxb[_0xc578[37]](204)})[_0xc578[13]](function(_0xcb2fxc){return handleError(_0xcb2fxb,_0xcb2fxc)})};exports[_0xc578[66]]= function(_0xcb2fxa,_0xcb2fxb){return VoiceQueue[_0xc578[65]]({where:{name:_0xcb2fxa[_0xc578[17]][_0xc578[67]]},individualHooks:true})[_0xc578[16]](function(){return _0xcb2fxb[_0xc578[37]](204)})[_0xc578[13]](function(_0xcb2fxc){return handleError(_0xcb2fxb,_0xcb2fxc)})};function handleError(_0xcb2fxb,_0xcb2fxc){logger[_0xc578[69]](_0xcb2fxc[_0xc578[68]]);return _0xcb2fxb[_0xc578[15]](500)[_0xc578[14]](_0xcb2fxc)}