Built motion from commit 9d236a9.|1.0.14
[motion.git] / server / api / scheduler / scheduler.controller.js
1 var _0x51a5=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x53\x63\x68\x65\x64\x75\x6C\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x4D\x61\x69\x6C\x53\x65\x72\x76\x65\x72\x4F\x75\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x73\x63\x68\x65\x64\x75\x6C\x65\x72\x2F\x72\x65\x70\x6F\x72\x74\x73","\x6C\x6F\x67","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x75\x73\x65\x72","\x65\x78\x74\x72\x61\x63\x74\x52\x65\x70\x6F\x72\x74","\x72\x65\x70\x6F\x72\x74","\x74\x79\x70\x65","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x72\x75\x6E\x53\x63\x68\x65\x64\x75\x6C\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","\x69\x64\x73","\x71\x75\x65\x72\x79"];_0x51a5[0];var _=require(_0x51a5[1]);var Schedule=require(_0x51a5[3])[_0x51a5[2]];var MailServerOut=require(_0x51a5[3])[_0x51a5[4]];var Reports=require(_0x51a5[5]);function handleError(_0x8ba2x6,_0x8ba2x7){_0x8ba2x7= _0x8ba2x7|| 500;return function(_0x8ba2x8){console[_0x51a5[6]](_0x8ba2x8);_0x8ba2x6[_0x51a5[8]](_0x8ba2x7)[_0x51a5[7]](_0x8ba2x8)}}function responseWithResult(_0x8ba2x6,_0x8ba2x7){_0x8ba2x7= _0x8ba2x7|| 200;return function(_0x8ba2xa){if(_0x8ba2xa){_0x8ba2x6[_0x51a5[8]](_0x8ba2x7)[_0x51a5[9]](_0x8ba2xa)}}}function responseWithoutResult(_0x8ba2x6,_0x8ba2x7){_0x8ba2x7= _0x8ba2x7|| 200;return function(){_0x8ba2x6[_0x51a5[10]](_0x8ba2x7)}}function handleEntityNotFound(_0x8ba2x6){return function(_0x8ba2xa){if(!_0x8ba2xa){_0x8ba2x6[_0x51a5[8]](404)[_0x51a5[11]]();return null};return _0x8ba2xa}}function saveUpdates(_0x8ba2xe){return function(_0x8ba2xa){return _0x8ba2xa[_0x51a5[13]](_0x8ba2xe)[_0x51a5[12]](function(_0x8ba2xf){return _0x8ba2xf})}}function removeEntity(_0x8ba2x6){return function(_0x8ba2xa){if(_0x8ba2xa){return _0x8ba2xa[_0x51a5[14]]()[_0x51a5[12]](function(){_0x8ba2x6[_0x51a5[8]](204)[_0x51a5[11]]()})}}}function runSchedule(_0x8ba2x12){return function(_0x8ba2xa){if(_0x8ba2xa){switch(_0x8ba2xa[_0x51a5[18]]){case _0x51a5[17]:var _0x8ba2x13= new Reports();_0x8ba2x13[_0x51a5[16]](_0x8ba2xa,_0x8ba2x12[_0x51a5[15]]);break;default:}}}}exports[_0x51a5[19]]= function(_0x8ba2x12,_0x8ba2x6){Schedule[_0x51a5[21]]()[_0x51a5[12]](responseWithResult(_0x8ba2x6))[_0x51a5[20]](handleError(_0x8ba2x6))};exports[_0x51a5[22]]= function(_0x8ba2x12,_0x8ba2x6){Schedule[_0x51a5[25]](_0x8ba2x12[_0x51a5[24]][_0x51a5[23]])[_0x51a5[12]](handleEntityNotFound(_0x8ba2x6))[_0x51a5[12]](responseWithResult(_0x8ba2x6))[_0x51a5[20]](handleError(_0x8ba2x6))};exports[_0x51a5[26]]= function(_0x8ba2x12,_0x8ba2x6){Schedule[_0x51a5[25]](_0x8ba2x12[_0x51a5[24]][_0x51a5[23]],{include:[MailServerOut]})[_0x51a5[12]](handleEntityNotFound(_0x8ba2x6))[_0x51a5[12]](runSchedule(_0x8ba2x12))[_0x51a5[12]](responseWithoutResult(_0x8ba2x6))[_0x51a5[20]](handleError(_0x8ba2x6))};exports[_0x51a5[27]]= function(_0x8ba2x12,_0x8ba2x6){Schedule[_0x51a5[27]](_0x8ba2x12[_0x51a5[28]])[_0x51a5[12]](responseWithResult(_0x8ba2x6,201))[_0x51a5[20]](handleError(_0x8ba2x6))};exports[_0x51a5[29]]= function(_0x8ba2x12,_0x8ba2x6){if(_0x8ba2x12[_0x51a5[28]][_0x51a5[23]]){delete _0x8ba2x12[_0x51a5[28]][_0x51a5[23]]};Schedule[_0x51a5[25]](_0x8ba2x12[_0x51a5[24]][_0x51a5[23]])[_0x51a5[12]](handleEntityNotFound(_0x8ba2x6))[_0x51a5[12]](saveUpdates(_0x8ba2x12[_0x51a5[28]]))[_0x51a5[12]](responseWithResult(_0x8ba2x6))[_0x51a5[20]](handleError(_0x8ba2x6))};exports[_0x51a5[14]]= function(_0x8ba2x12,_0x8ba2x6){Schedule[_0x51a5[25]](_0x8ba2x12[_0x51a5[24]][_0x51a5[23]])[_0x51a5[12]](handleEntityNotFound(_0x8ba2x6))[_0x51a5[12]](removeEntity(_0x8ba2x6))[_0x51a5[20]](handleError(_0x8ba2x6))};exports[_0x51a5[30]]= function(_0x8ba2x12,_0x8ba2x6){return Schedule[_0x51a5[14]]({where:{id:_0x8ba2x12[_0x51a5[32]][_0x51a5[31]]},individualHooks:true})[_0x51a5[12]](function(){return _0x8ba2x6[_0x51a5[10]](204)})[_0x51a5[20]](handleError(_0x8ba2x6))}