1dc86d61f17be06c6c43e65327f6e74af8ab91c8
[motion.git] / server / api / voice_queue / voice_queue.controller.js
1 var _0x3790=["\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","\x61\x67\x65\x6E\x74\x73","\x62\x6F\x64\x79","\x70\x65\x6E\x61\x6C\x74\x79","\x61\x64\x64\x55\x73\x65\x72\x73","\x75\x70\x64\x61\x74\x65","\x73\x61\x76\x65","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x53\x49\x50\x2F\x25\x73","\x66\x6F\x72\x6D\x61\x74","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x66\x69\x6E\x64\x41\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"];_0x3790[0];var _=require(_0x3790[1]);var util=require(_0x3790[2]);var Util=require(_0x3790[3]);var sequelize=require(_0x3790[5])[_0x3790[4]];var User=require(_0x3790[5])[_0x3790[6]];var VoiceQueue=require(_0x3790[5])[_0x3790[7]];var UserHasVoiceQueue=require(_0x3790[5])[_0x3790[8]];var VoiceExtension=require(_0x3790[5])[_0x3790[9]];exports[_0x3790[10]]= function(_0x63dcx9,_0x63dcxa){switch(_0x63dcx9[_0x3790[18]][_0x3790[23]]){case _0x3790[18]:return User[_0x3790[19]](_0x63dcx9[_0x3790[18]][_0x3790[17]],{attributes:[_0x3790[17]]})[_0x3790[14]](Util[_0x3790[16]](_0x63dcx9[_0x3790[15]]))[_0x3790[14]](function(_0x63dcxc){_0x63dcxa[_0x3790[13]](200)[_0x3790[12]](_0x63dcxc)})[_0x3790[11]](function(_0x63dcxb){return handleError(_0x63dcxa,_0x63dcxb)});default:return VoiceQueue[_0x3790[22]](Util[_0x3790[21]](_0x63dcx9[_0x3790[15]]))[_0x3790[14]](function(_0x63dcxc){_0x63dcxa[_0x3790[13]](200)[_0x3790[12]](_0x63dcxc)})[_0x3790[11]](function(_0x63dcxb){console[_0x3790[20]](_0x63dcxb);return handleError(_0x63dcxa,_0x63dcxb)})}};exports[_0x3790[24]]= function(_0x63dcx9,_0x63dcxa,_0x63dcxd){switch(_0x63dcx9[_0x3790[18]][_0x3790[23]]){case _0x3790[18]:var _0x63dcxe=[];return User[_0x3790[19]](_0x63dcx9[_0x3790[18]][_0x3790[17]],{attributes:[_0x3790[17]]})[_0x3790[14]](Util[_0x3790[16]]({},{attributes:[_0x3790[26]],include:[{raw:true,model:User,attributes:[_0x3790[17]]}]}))[_0x3790[14]](function(_0x63dcxf){var _0x63dcx10=_[_0x3790[27]](_0x63dcxf[_0x3790[25]],_0x3790[26]);_0x63dcxf[_0x3790[25]][_0x3790[29]](function(_0x63dcx11){_0x63dcxe= _[_0x3790[28]](_0x63dcxe,_[_0x3790[27]](_0x63dcx11.Users,_0x3790[17]))});return VoiceQueue[_0x3790[22]](_[_0x3790[30]](Util[_0x3790[21]](_0x63dcx9[_0x3790[15]],{name:_0x63dcx10}),{include:[{model:User,where:{id:_0x63dcxe},required:false}]}))})[_0x3790[14]](function(_0x63dcxc){return _0x63dcxa[_0x3790[13]](200)[_0x3790[12]](_0x63dcxc)})[_0x3790[11]](function(_0x63dcxb){console[_0x3790[20]](_0x63dcxb);return handleError(_0x63dcxa,_0x63dcxb)});default:return VoiceQueue[_0x3790[22]](_[_0x3790[30]](Util[_0x3790[21]](_0x63dcx9[_0x3790[15]]),{include:[{model:User,required:false}]}))[_0x3790[14]](function(_0x63dcxc){return _0x63dcxa[_0x3790[13]](200)[_0x3790[12]](_0x63dcxc)})[_0x3790[11]](function(_0x63dcxb){console[_0x3790[20]](_0x63dcxb);return handleError(_0x63dcxa,_0x63dcxb)})}};exports[_0x3790[31]]= function(_0x63dcx9,_0x63dcxa){return VoiceQueue[_0x3790[19]](_0x63dcx9[_0x3790[33]][_0x3790[26]])[_0x3790[14]](function(_0x63dcx12){if(!_0x63dcx12){return _0x63dcxa[_0x3790[32]](404)};return _0x63dcxa[_0x3790[12]](_0x63dcx12)})[_0x3790[11]](function(_0x63dcxb){return handleError(_0x63dcxa,_0x63dcxb)})};exports[_0x3790[34]]= function(_0x63dcx9,_0x63dcxa){return VoiceQueue[_0x3790[19]](_0x63dcx9[_0x3790[33]][_0x3790[26]])[_0x3790[14]](function(_0x63dcx11){if(!_0x63dcx11){return _0x63dcxa[_0x3790[32]](404)};return _0x63dcx11[_0x3790[39]]({where:{role:_0x3790[36]},attributes:[_0x3790[17],_0x3790[26],_0x3790[37],_0x3790[38]]})})[_0x3790[14]](function(_0x63dcxe){return _0x63dcxa[_0x3790[13]](200)[_0x3790[12]]({rows:_0x63dcxe,count:_0x63dcxe[_0x3790[35]]})})[_0x3790[11]](function(_0x63dcxb){return handleError(_0x63dcxa,_0x63dcxb)})};exports[_0x3790[40]]= function(_0x63dcx9,_0x63dcxa){var _0x63dcx13;return VoiceQueue[_0x3790[40]](_0x63dcx9[_0x3790[51]])[_0x3790[14]](function(_0x63dcx12){_0x63dcx13= _0x63dcx12;if(_0x63dcx9[_0x3790[51]][_0x3790[50]]){return _0x63dcx13[_0x3790[53]](_0x63dcx9[_0x3790[51]][_0x3790[50]],{penalty:_0x63dcx9[_0x3790[51]][_0x3790[52]]|| 0})}})[_0x3790[14]](function(){return _0x63dcxa[_0x3790[13]](201)[_0x3790[12]](_0x63dcx13)})[_0x3790[11]](sequelize.UniqueConstraintError,function(_0x63dcxb){var _0x63dcx14=[];_0x63dcxb[_0x3790[44]][_0x3790[29]](function(_0x63dcx15){switch(_0x63dcx15[_0x3790[43]]){case _0x3790[42]:_0x63dcx14[_0x3790[41]](_0x3790[26]);break;default:_0x63dcx14[_0x3790[41]](_0x63dcx15[_0x3790[43]])}});_0x63dcx14[_0x3790[41]](_0x3790[45]);_0x63dcxb[_0x3790[46]]= _0x63dcx14[_0x3790[47]]();_0x63dcxb[_0x3790[48]]= _0x3790[49];return _0x63dcxa[_0x3790[13]](500)[_0x3790[12]](_0x63dcxb)})[_0x3790[11]](function(_0x63dcxb){return handleError(_0x63dcxa,_0x63dcxb)})};exports[_0x3790[54]]= function(_0x63dcx9,_0x63dcxa){if(_0x63dcx9[_0x3790[51]][_0x3790[26]]){delete _0x63dcx9[_0x3790[51]][_0x3790[26]]};return VoiceQueue[_0x3790[19]](_0x63dcx9[_0x3790[33]][_0x3790[26]])[_0x3790[14]](function(_0x63dcx12){if(!_0x63dcx12){return _0x63dcxa[_0x3790[32]](404)};var _0x63dcx16=_[_0x3790[30]](_0x63dcx12,_0x63dcx9[_0x3790[51]]);return _0x63dcx16[_0x3790[55]]()})[_0x3790[14]](function(_0x63dcx12){return _0x63dcxa[_0x3790[13]](200)[_0x3790[12]](_0x63dcx12)})[_0x3790[11]](function(_0x63dcxb){console[_0x3790[20]](_0x63dcxb);return handleError(_0x63dcxa,_0x63dcxb)})};exports[_0x3790[56]]= function(_0x63dcx9,_0x63dcxa,_0x63dcxd){return User[_0x3790[60]]({where:{id:{$in:_0x63dcx9[_0x3790[51]][_0x3790[50]]}}})[_0x3790[14]](function(_0x63dcx17){var _0x63dcx18=_[_0x3790[27]](_0x63dcx17,function(_0x63dcx19){return {queue:_0x63dcx9[_0x3790[33]][_0x3790[26]],interface:util[_0x3790[58]](_0x3790[57],_0x63dcx19[_0x3790[26]]),stateinterface:util[_0x3790[58]](_0x3790[57],_0x63dcx19[_0x3790[26]]),membername:_0x63dcx19[_0x3790[26]],UserId:_0x63dcx19[_0x3790[17]],penalty:_0x63dcx9[_0x3790[51]][_0x3790[52]]}});return UserHasVoiceQueue[_0x3790[59]](_0x63dcx18,{individualHooks:true})})[_0x3790[14]](function(){return _0x63dcxa[_0x3790[32]](200)})[_0x3790[11]](function(_0x63dcxb){console[_0x3790[20]](_0x63dcxb);return _0x63dcxd(_0x63dcxb)})};exports[_0x3790[61]]= function(_0x63dcx9,_0x63dcxa,_0x63dcxd){return UserHasVoiceQueue[_0x3790[62]]({where:{UserId:_0x63dcx9[_0x3790[15]][_0x3790[50]],queue:_0x63dcx9[_0x3790[33]][_0x3790[26]]},individualHooks:true})[_0x3790[14]](function(){return _0x63dcxa[_0x3790[32]](202)})[_0x3790[11]](function(_0x63dcxb){return _0x63dcxd(_0x63dcxb)})};exports[_0x3790[62]]= function(_0x63dcx9,_0x63dcxa){return VoiceQueue[_0x3790[62]]({where:{name:_0x63dcx9[_0x3790[33]][_0x3790[26]]},individualHooks:true})[_0x3790[14]](function(){return _0x63dcxa[_0x3790[32]](204)})[_0x3790[11]](function(_0x63dcxb){return handleError(_0x63dcxa,_0x63dcxb)})};exports[_0x3790[63]]= function(_0x63dcx9,_0x63dcxa){return VoiceQueue[_0x3790[62]]({where:{name:_0x63dcx9[_0x3790[15]][_0x3790[64]]},individualHooks:true})[_0x3790[14]](function(){return _0x63dcxa[_0x3790[32]](204)})[_0x3790[11]](function(_0x63dcxb){return handleError(_0x63dcxa,_0x63dcxb)})};function handleError(_0x63dcxa,_0x63dcxb){return _0x63dcxa[_0x3790[13]](500)[_0x3790[12]](_0x63dcxb)}