Built motion from commit a8d3a8d.|0.0.25
[motion.git] / server / api / interval / interval.controller.js
1 var _0x9a64=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x49\x6E\x74\x65\x72\x76\x61\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x6E\x61\x6D\x65","\x70\x65\x72\x5F\x70\x61\x67\x65","\x71\x75\x65\x72\x79","\x70\x61\x67\x65","\x6F\x72\x64\x65\x72","\x25\x73\x20\x25\x73","\x73\x6F\x72\x74\x5F\x62\x79","\x73\x6F\x72\x74\x5F\x6F\x72\x64\x65\x72","\x41\x53\x43","\x66\x6F\x72\x6D\x61\x74","\x24\x6F\x72","\x77\x68\x65\x72\x65","\x25","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x24","\x24\x6C\x69\x6B\x65","\x66\x6F\x72\x49\x6E","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x67\x65\x74\x41\x6C\x6C","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x69\x6E\x74\x65\x72\x76\x61\x6C\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x62\x6F\x64\x79","\x49\x6E\x74\x65\x72\x76\x61\x6C\x49\x64","\x6C\x6F\x67","\x63\x72\x65\x61\x74\x65","\x46\x69\x6E\x64\x69\x6E\x67\x20\x61\x70\x70\x20\x72\x6F\x77\x2E\x2E\x2E\x2E\x2E","\x6C\x65\x6E\x67\x74\x68","\x4D\x45\x53\x53\x41\x47\x45\x5F\x45\x58\x49\x53\x54\x5F\x53\x55\x42\x49\x4E\x54\x45\x52\x56\x41\x4C","\x4D\x45\x53\x53\x41\x47\x45\x5F\x45\x58\x49\x53\x54\x5F\x49\x4E\x54\x45\x52\x56\x41\x4C","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x66\x69\x6E\x64","\x64\x65\x73\x74\x72\x6F\x79","\x4D\x45\x53\x53\x41\x47\x45\x5F\x49\x4E\x54\x45\x52\x56\x41\x4C\x5F\x52\x4F\x55\x54\x45\x5F\x41\x53\x53\x4F\x43\x49\x41\x54\x45\x44","\x67\x65\x74\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73"];_0x9a64[0];var _=require(_0x9a64[1]);var Interval=require(_0x9a64[3])[_0x9a64[2]];var VoiceExtension=require(_0x9a64[3])[_0x9a64[4]];var sequelize=require(_0x9a64[3])[_0x9a64[5]];var util=require(_0x9a64[6]);exports[_0x9a64[7]]=function(_0x21f6x6,_0x21f6x7){var _0x21f6x8=[_0x9a64[8]];var _0x21f6x9=_0x21f6x6[_0x9a64[10]][_0x9a64[9]]?parseInt(_0x21f6x6[_0x9a64[10]][_0x9a64[9]],10):100;var _0x21f6xa=_0x21f6x6[_0x9a64[10]][_0x9a64[11]]?parseInt(_0x21f6x6[_0x9a64[10]][_0x9a64[11]],10):0;var _0x21f6xb={where:{IntervalId:null},limit:_0x21f6x9,offset:_0x21f6xa*_0x21f6x9};_[_0x9a64[25]](_0x21f6x6[_0x9a64[10]],function(_0x21f6xc,_0x21f6xd){switch(_0x21f6xd){case _0x9a64[9]:;case _0x9a64[11]:break ;;case _0x9a64[14]:_0x21f6xb[_0x9a64[12]]=util[_0x9a64[17]](_0x9a64[13],_0x21f6x6[_0x9a64[10]][_0x9a64[14]],_0x21f6x6[_0x9a64[10]][_0x9a64[15]]||_0x9a64[16])||null;break ;;case _0x9a64[15]:break ;;case _0x9a64[23]:_0x21f6xb[_0x9a64[19]][_0x9a64[18]]=[];_0x21f6x8[_0x9a64[22]](function(_0x21f6xe){var _0x21f6xf={};_0x21f6xf[_0x21f6xe]={$like:_0x9a64[20]+_0x21f6xc+_0x9a64[20]};_0x21f6xb[_0x9a64[19]][_0x9a64[18]][_0x9a64[21]](_0x21f6xf);});break ;;default:_0x21f6xb[_0x9a64[19]][_0x21f6xd]={$like:{}};_0x21f6xb[_0x9a64[19]][_0x21f6xd][_0x9a64[24]]=_0x9a64[20]+_0x21f6xc+_0x9a64[20];;}});Interval[_0x9a64[30]](_0x21f6xb)[_0x9a64[29]](function(_0x21f6x11){return _0x21f6x7[_0x9a64[28]](200)[_0x9a64[27]](_0x21f6x11)})[_0x9a64[26]](function(_0x21f6x10){return handleError(_0x21f6x7,_0x21f6x10)});};exports[_0x9a64[31]]=function(_0x21f6x6,_0x21f6x7){Interval[_0x9a64[32]]()[_0x9a64[29]](function(_0x21f6x11){return _0x21f6x7[_0x9a64[28]](200)[_0x9a64[27]](_0x21f6x11)})[_0x9a64[26]](function(_0x21f6x10){return handleError(_0x21f6x7,_0x21f6x10)})};exports[_0x9a64[33]]=function(_0x21f6x6,_0x21f6x7){Interval[_0x9a64[37]](_0x21f6x6[_0x9a64[36]][_0x9a64[35]],{include:[{all:true}]})[_0x9a64[29]](function(_0x21f6x12){if(!_0x21f6x12){return _0x21f6x7[_0x9a64[34]](404)};return _0x21f6x7[_0x9a64[27]](_0x21f6x12);})[_0x9a64[26]](function(_0x21f6x10){return handleError(_0x21f6x7,_0x21f6x10)})};exports[_0x9a64[38]]=function(_0x21f6x6,_0x21f6x7){var _0x21f6x13={name:_0x21f6x6[_0x9a64[39]][_0x9a64[8]],IntervalId:_0x21f6x6[_0x9a64[39]][_0x9a64[40]]?_0x21f6x6[_0x9a64[39]][_0x9a64[40]]:null};if(_0x21f6x6[_0x9a64[39]][_0x9a64[35]]){_0x21f6x13[_0x9a64[35]]={$ne:_0x21f6x6[_0x9a64[39]][_0x9a64[35]]}};console[_0x9a64[41]](_0x21f6x6[_0x9a64[39]]);Interval[_0x9a64[32]]({where:_0x21f6x13})[_0x9a64[29]](function(_0x21f6x11){if(!_0x21f6x11){return _0x21f6x7[_0x9a64[34]](404)};return _0x21f6x7[_0x9a64[27]](_0x21f6x11);})[_0x9a64[26]](function(_0x21f6x10){return handleError(_0x21f6x7,_0x21f6x10)});};exports[_0x9a64[42]]=function(_0x21f6x6,_0x21f6x7){Interval[_0x9a64[32]]({where:{name:_0x21f6x6[_0x9a64[39]][_0x9a64[8]],IntervalId:_0x21f6x6[_0x9a64[39]][_0x9a64[40]]?_0x21f6x6[_0x9a64[39]][_0x9a64[40]]:null}})[_0x9a64[29]](function(_0x21f6x14){console[_0x9a64[41]](_0x21f6x14);console[_0x9a64[41]](_0x9a64[43]);if(!_0x21f6x14){return _0x21f6x7[_0x9a64[34]](404)};if(_0x21f6x14[_0x9a64[44]]>0){return _0x21f6x7[_0x9a64[28]](500)[_0x9a64[27]]({message:_0x21f6x6[_0x9a64[39]][_0x9a64[40]]?_0x9a64[45]:_0x9a64[46]})};Interval[_0x9a64[42]](_0x21f6x6[_0x9a64[39]])[_0x9a64[29]](function(_0x21f6x12){return _0x21f6x7[_0x9a64[28]](201)[_0x9a64[27]](_0x21f6x12)})[_0x9a64[26]](function(_0x21f6x10){return handleError(_0x21f6x7,_0x21f6x10)});})[_0x9a64[26]](function(_0x21f6x10){return handleError(_0x21f6x7,_0x21f6x10)})};exports[_0x9a64[47]]=function(_0x21f6x6,_0x21f6x7){Interval[_0x9a64[32]]({where:{name:_0x21f6x6[_0x9a64[39]][_0x9a64[8]],IntervalId:_0x21f6x6[_0x9a64[39]][_0x9a64[40]]?_0x21f6x6[_0x9a64[39]][_0x9a64[40]]:null,id:{$ne:_0x21f6x6[_0x9a64[39]][_0x9a64[35]]}}})[_0x9a64[29]](function(_0x21f6x14){console[_0x9a64[41]](_0x21f6x14);console[_0x9a64[41]](_0x9a64[43]);if(!_0x21f6x14){return _0x21f6x7[_0x9a64[34]](404)};if(_0x21f6x14[_0x9a64[44]]>0){return _0x21f6x7[_0x9a64[28]](500)[_0x9a64[27]]({message:_0x21f6x6[_0x9a64[39]][_0x9a64[40]]?_0x9a64[45]:_0x9a64[46]})};if(_0x21f6x6[_0x9a64[39]][_0x9a64[35]]){delete _0x21f6x6[_0x9a64[39]][_0x9a64[35]]};Interval[_0x9a64[51]]({where:{id:_0x21f6x6[_0x9a64[36]][_0x9a64[35]]}})[_0x9a64[29]](function(_0x21f6x12){if(!_0x21f6x12){return _0x21f6x7[_0x9a64[34]](404)};var _0x21f6x15=_[_0x9a64[48]](_0x21f6x12,_0x21f6x6[_0x9a64[39]]);return sequelize[_0x9a64[50]](function(_0x21f6x16){return _0x21f6x15[_0x9a64[49]]({transaction:_0x21f6x16})[_0x9a64[29]](function(_0x21f6x12){VoiceExtension[_0x9a64[47]]({interval:_0x21f6x12[_0x9a64[8]]},{where:{IntervalId:_0x21f6x12[_0x9a64[35]]}},{transaction:_0x21f6x16})})})[_0x9a64[29]](function(){return _0x21f6x7[_0x9a64[28]](200)[_0x9a64[27]](_0x21f6x12)})[_0x9a64[26]](function(_0x21f6x10){return handleError(_0x21f6x7,_0x21f6x10)});})[_0x9a64[26]](function(_0x21f6x10){return handleError(_0x21f6x7,_0x21f6x10)});})[_0x9a64[26]](function(_0x21f6x10){return handleError(_0x21f6x7,_0x21f6x10)})};exports[_0x9a64[52]]=function(_0x21f6x6,_0x21f6x7){Interval[_0x9a64[37]](_0x21f6x6[_0x9a64[36]][_0x9a64[35]])[_0x9a64[29]](function(_0x21f6x12){if(!_0x21f6x12){return _0x21f6x7[_0x9a64[34]](404)};_0x21f6x12[_0x9a64[54]]({where:{isApp:true}})[_0x9a64[29]](function(_0x21f6x17){console[_0x9a64[41]](_0x21f6x17[_0x9a64[44]]);if(_0x21f6x17[_0x9a64[44]]>0){return _0x21f6x7[_0x9a64[28]](500)[_0x9a64[27]]({message:_0x9a64[53]})};_0x21f6x12[_0x9a64[52]]()[_0x9a64[29]](function(){return _0x21f6x7[_0x9a64[34]](204)})[_0x9a64[26]](function(_0x21f6x10){return handleError(_0x21f6x7,_0x21f6x10)});})[_0x9a64[26]](function(_0x21f6x10){return handleError(_0x21f6x7,_0x21f6x10)});})[_0x9a64[26]](function(_0x21f6x10){return handleError(_0x21f6x7,_0x21f6x10)})};exports[_0x9a64[55]]=function(_0x21f6x6,_0x21f6x7){var _0x21f6x18=false;Interval[_0x9a64[32]]({where:{id:_0x21f6x6[_0x9a64[10]][_0x9a64[35]]},include:[{all:true}]})[_0x9a64[29]](function(_0x21f6x11){if(!_0x21f6x11){return _0x21f6x7[_0x9a64[34]](404)};_0x21f6x11[_0x9a64[22]](function(_0x21f6x19){if(_0x21f6x19[_0x9a64[56]][_0x9a64[44]]>0){_0x21f6x18=true}});if(_0x21f6x18){return _0x21f6x7[_0x9a64[28]](500)[_0x9a64[27]]({message:_0x9a64[53]})};Interval[_0x9a64[52]]({where:{id:_0x21f6x6[_0x9a64[10]][_0x9a64[35]]},individualHooks:true})[_0x9a64[29]](function(){return _0x21f6x7[_0x9a64[34]](204)})[_0x9a64[26]](function(_0x21f6x10){return handleError(_0x21f6x7,_0x21f6x10)});})[_0x9a64[26]](function(_0x21f6x10){return handleError(_0x21f6x7,_0x21f6x10)});};function handleError(_0x21f6x7,_0x21f6x10){return _0x21f6x7[_0x9a64[28]](500)[_0x9a64[27]](_0x21f6x10)}