Built motion from commit 54a160d.|0.0.140
[motion.git] / server / api / voice_recording / voice_recording.controller.js
1 var _0xdc05=["\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","\x56\x6F\x69\x63\x65\x52\x65\x63\x6F\x72\x64\x69\x6E\x67","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x62\x6C\x75\x65\x62\x69\x72\x64","\x66\x69\x6C\x65\x2D\x62\x61\x73\x65\x36\x34","\x66\x73","\x70\x61\x74\x68","\x63\x61\x75\x73\x65","\x63\x6F\x64\x65","\x45\x4E\x4F\x45\x4E\x54","\x4E\x6F\x20\x66\x69\x6C\x65\x20\x6F\x72\x20\x64\x69\x72\x65\x63\x74\x6F\x72\x79","\x4D\x45\x53\x53\x41\x47\x45\x5F\x4E\x4F\x5F\x46\x49\x4C\x45\x5F\x4F\x52\x5F\x44\x49\x52\x45\x43\x54\x4F\x52\x59","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x65\x6E\x64","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x74\x68\x65\x6E","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x72\x6F\x77\x73","\x6E\x61\x6D\x65","\x6D\x61\x70","\x75\x6E\x69\x6F\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\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","\x61\x67\x65\x6E\x74","\x72\x6F\x6C\x65","\x73\x68\x6F\x77","\x70\x61\x72\x61\x6D\x73","\x64\x65\x73\x63\x72\x69\x62\x65","\x67\x65\x74\x53\x74\x72\x65\x61\x6D","\x62\x61\x73\x65\x36\x34","\x62\x69\x6E\x61\x72\x79","\x72\x65\x61\x64\x46\x69\x6C\x65","\x70\x72\x6F\x6D\x69\x73\x69\x66\x79","\x76\x61\x6C\x75\x65","\x67\x65\x74\x53\x74\x72\x65\x61\x6D\x42\x79\x49\x64","\x74\x79\x70\x65","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x75\x6E\x69\x71\x75\x65\x69\x64","\x62\x61\x73\x65\x6E\x61\x6D\x65","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x66\x69\x6E\x64\x4F\x6E\x65","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64\x73"];_0xdc05[0];var _=require(_0xdc05[1]);var util=require(_0xdc05[2]);var Util=require(_0xdc05[3]);var VoiceRecording=require(_0xdc05[5])[_0xdc05[4]];var User=require(_0xdc05[5])[_0xdc05[6]];var Promise=require(_0xdc05[7]);var base64=require(_0xdc05[8]);var fs=require(_0xdc05[9]);var path=require(_0xdc05[10]);function handleError(_0x324cxb){return function(_0x324cxc){if(_0x324cxc[_0xdc05[11]]&& _0x324cxc[_0xdc05[11]][_0xdc05[12]]=== _0xdc05[13]){_0x324cxc= {message:_0xdc05[14],translatedMessage:_0xdc05[15]}};return _0x324cxb[_0xdc05[17]](500)[_0xdc05[16]](_0x324cxc)}}function responseWithResult(_0x324cxb,_0x324cxe){_0x324cxe= _0x324cxe|| 200;return function(_0x324cxf){if(_0x324cxf){_0x324cxb[_0xdc05[17]](_0x324cxe)[_0xdc05[18]](_0x324cxf)}}}function handleEntityNotFound(_0x324cxb){return function(_0x324cxf){if(!_0x324cxf){_0x324cxb[_0xdc05[17]](404)[_0xdc05[19]]();return null};return _0x324cxf}}function saveUpdates(_0x324cx12){return function(_0x324cxf){return _0x324cxf[_0xdc05[20]](_0x324cx12)}}function removeEntity(_0x324cxb){return function(_0x324cxf){if(_0x324cxf){return _0x324cxf[_0xdc05[22]]()[_0xdc05[21]](function(){_0x324cxb[_0xdc05[17]](204)[_0xdc05[19]]()})}}}exports[_0xdc05[23]]= function(_0x324cx14,_0x324cxb){switch(_0x324cx14[_0xdc05[35]][_0xdc05[38]]){case _0xdc05[35]:return User[_0xdc05[36]](_0x324cx14[_0xdc05[35]][_0xdc05[34]],{attributes:[_0xdc05[34]]})[_0xdc05[21]](Util[_0xdc05[33]]())[_0xdc05[21]](function(_0x324cx15){var _0x324cx16=[];var _0x324cx17=_[_0xdc05[27]](_0x324cx15[_0xdc05[25]],_0xdc05[26]);_0x324cx15[_0xdc05[25]][_0xdc05[29]](function(_0x324cx18){_0x324cx16= _[_0xdc05[28]](_0x324cx16,_[_0xdc05[27]](_0x324cx18.Users,_0xdc05[26]))});return VoiceRecording[_0xdc05[32]](Util[_0xdc05[31]](_0x324cx14[_0xdc05[30]],{$or:{queue:_0x324cx17,membername:_0x324cx16}}))})[_0xdc05[21]](responseWithResult(_0x324cxb))[_0xdc05[24]](handleError(_0x324cxb));case _0xdc05[37]:return VoiceRecording[_0xdc05[32]](Util[_0xdc05[31]](_0x324cx14[_0xdc05[30]],{membername:_0x324cx14[_0xdc05[35]][_0xdc05[26]]}))[_0xdc05[21]](responseWithResult(_0x324cxb))[_0xdc05[24]](handleError(_0x324cxb));default:return VoiceRecording[_0xdc05[32]](Util[_0xdc05[31]](_0x324cx14[_0xdc05[30]]))[_0xdc05[21]](responseWithResult(_0x324cxb))[_0xdc05[24]](handleError(_0x324cxb))}};exports[_0xdc05[39]]= function(_0x324cx14,_0x324cxb){return VoiceRecording[_0xdc05[36]](_0x324cx14[_0xdc05[40]][_0xdc05[34]])[_0xdc05[21]](handleEntityNotFound(_0x324cxb))[_0xdc05[21]](responseWithResult(_0x324cxb))[_0xdc05[24]](handleError(_0x324cxb))};exports[_0xdc05[41]]= function(_0x324cx14,_0x324cxb){return VoiceRecording[_0xdc05[41]]()[_0xdc05[21]](function(_0x324cx19){return _0x324cxb[_0xdc05[17]](200)[_0xdc05[16]](_0x324cx19)})[_0xdc05[24]](handleError(_0x324cxb))};exports[_0xdc05[42]]= function(_0x324cx14,_0x324cxb){return VoiceRecording[_0xdc05[36]](_0x324cx14[_0xdc05[40]][_0xdc05[34]])[_0xdc05[21]](function(_0x324cx1c){var _0x324cx1d=Promise[_0xdc05[46]](fs[_0xdc05[45]]);return _0x324cx1d(_0x324cx1c[_0xdc05[47]])})[_0xdc05[21]](function(_0x324cx1b){var _0x324cx1a= new Buffer(_0x324cx1b,_0xdc05[44]).toString(_0xdc05[43]);return _0x324cx1a})[_0xdc05[21]](function(_0x324cx1a){return _0x324cxb[_0xdc05[17]](200)[_0xdc05[16]]({downloadString:_0x324cx1a})})[_0xdc05[24]](handleError(_0x324cxb))};exports[_0xdc05[48]]= function(_0x324cx14,_0x324cxb){var _0x324cx1e={};if(_0x324cx14[_0xdc05[30]]&& _0x324cx14[_0xdc05[30]][_0xdc05[50]](_0xdc05[49])&& _0x324cx14[_0xdc05[30]][_0xdc05[49]]=== _0xdc05[51]){_0x324cx1e[_0xdc05[51]]= _0x324cx14[_0xdc05[40]][_0xdc05[34]]}else {_0x324cx1e[_0xdc05[34]]= _0x324cx14[_0xdc05[40]][_0xdc05[34]]};return VoiceRecording[_0xdc05[54]]({where:_0x324cx1e})[_0xdc05[21]](handleEntityNotFound(_0x324cxb))[_0xdc05[21]](function(_0x324cx1c){return _0x324cxb[_0xdc05[53]](_0x324cx1c[_0xdc05[47]],path[_0xdc05[52]](_0x324cx1c[_0xdc05[47]]))})[_0xdc05[24]](handleError(_0x324cxb))};exports[_0xdc05[55]]= function(_0x324cx14,_0x324cxb){return VoiceRecording[_0xdc05[55]](_0x324cx14[_0xdc05[56]])[_0xdc05[21]](responseWithResult(_0x324cxb,201))[_0xdc05[24]](handleError(_0x324cxb))};exports[_0xdc05[57]]= function(_0x324cx14,_0x324cxb){if(_0x324cx14[_0xdc05[56]][_0xdc05[34]]){delete _0x324cx14[_0xdc05[56]][_0xdc05[34]]};return VoiceRecording[_0xdc05[36]](_0x324cx14[_0xdc05[40]][_0xdc05[34]])[_0xdc05[21]](handleEntityNotFound(_0x324cxb))[_0xdc05[21]](saveUpdates(_0x324cx14[_0xdc05[56]]))[_0xdc05[21]](responseWithResult(_0x324cxb))[_0xdc05[24]](handleError(_0x324cxb))};exports[_0xdc05[22]]= function(_0x324cx14,_0x324cxb){return VoiceRecording[_0xdc05[36]](_0x324cx14[_0xdc05[40]][_0xdc05[34]])[_0xdc05[21]](handleEntityNotFound(_0x324cxb))[_0xdc05[21]](removeEntity(_0x324cxb))[_0xdc05[24]](handleError(_0x324cxb))};exports[_0xdc05[58]]= function(_0x324cx14,_0x324cxb){return VoiceRecording[_0xdc05[22]]({where:{id:_0x324cx14[_0xdc05[30]][_0xdc05[60]]},individualHooks:true})[_0xdc05[21]](function(){return _0x324cxb[_0xdc05[59]](204)})[_0xdc05[24]](handleError(_0x324cxb))}