Built motion from commit daed1922e.|1.0.22
[motion.git] / server / api / interval / interval.controller.js
1 var _0xbcc1=["\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","\x62\x6C\x75\x65\x62\x69\x72\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\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","\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\x51\x75\x65\x72\x79","\x6D\x65\x72\x67\x65","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x69\x6E\x74\x65\x72\x76\x61\x6C\x73","\x73\x75\x62\x69\x6E\x74\x65\x72\x76\x61\x6C\x73","\x73\x63\x6F\x70\x65","\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","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x53\x75\x62\x49\x6E\x74\x65\x72\x76\x61\x6C\x73","\x6C\x65\x6E\x67\x74\x68","\x64\x65\x73\x74\x72\x6F\x79","\x63\x6C\x6F\x6E\x65","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x61\x6C\x6C","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x6D\x61\x70","\x66\x69\x6E\x64","\x49\x6E\x74\x65\x72\x76\x61\x6C\x49\x64","\x70\x75\x73\x68","\x72\x65\x6D\x6F\x76\x65","\x66\x6F\x72\x45\x61\x63\x68","\x6D\x65\x73\x73\x61\x67\x65","\x54\x68\x65\x20\x49\x6E\x74\x65\x72\x76\x61\x6C\x20\x69\x73\x20\x61\x73\x73\x6F\x63\x69\x61\x74\x65\x64\x20\x77\x69\x74\x68\x20\x6F\x6E\x65\x20\x6F\x72\x20\x6D\x6F\x72\x65\x20\x72\x6F\x75\x74\x65\x73\x2C\x20\x64\x65\x6C\x65\x74\x65\x20\x74\x68\x65\x6D\x20\x66\x69\x72\x73\x74","\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\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","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73","\x73\x74\x61\x63\x6B","\x65\x72\x72\x6F\x72"];_0xbcc1[0];var _=require(_0xbcc1[1]);var Interval=require(_0xbcc1[3])[_0xbcc1[2]];var VoiceExtension=require(_0xbcc1[3])[_0xbcc1[4]];var sequelize=require(_0xbcc1[3])[_0xbcc1[5]];var Promise=require(_0xbcc1[6]);var Util=require(_0xbcc1[7]);var logger=require(_0xbcc1[9])(_0xbcc1[8]);exports[_0xbcc1[10]]= function(_0x40f4x8,_0x40f4x9,_0x40f4xa){return Interval[_0xbcc1[21]](_0xbcc1[19],_0xbcc1[20])[_0xbcc1[18]](_[_0xbcc1[17]](Util[_0xbcc1[16]](_0x40f4x8[_0xbcc1[15]]),{distinct:true}))[_0xbcc1[14]](function(_0x40f4xc){_0x40f4x9[_0xbcc1[13]](200)[_0xbcc1[12]](_0x40f4xc)})[_0xbcc1[11]](function(_0x40f4xb){return handleError(_0x40f4x9,_0x40f4xb)})};exports[_0xbcc1[22]]= function(_0x40f4x8,_0x40f4x9){return Interval[_0xbcc1[21]](_0xbcc1[20])[_0xbcc1[26]](_0x40f4x8[_0xbcc1[25]][_0xbcc1[24]])[_0xbcc1[14]](function(_0x40f4xd){if(!_0x40f4xd){return _0x40f4x9[_0xbcc1[23]](404)};return _0x40f4x9[_0xbcc1[12]](_0x40f4xd)})[_0xbcc1[11]](function(_0x40f4xb){return handleError(_0x40f4x9,_0x40f4xb)})};exports[_0xbcc1[27]]= function(_0x40f4x8,_0x40f4x9){return Interval[_0xbcc1[21]](_0xbcc1[20])[_0xbcc1[27]](_0x40f4x8[_0xbcc1[28]])[_0xbcc1[14]](function(_0x40f4xd){return _0x40f4x9[_0xbcc1[13]](201)[_0xbcc1[12]](_0x40f4xd)})[_0xbcc1[11]](function(_0x40f4xb){return handleError(_0x40f4x9,_0x40f4xb)})};exports[_0xbcc1[29]]= function(_0x40f4x8,_0x40f4x9){var _0x40f4xe;return sequelize[_0xbcc1[35]](function(_0x40f4xf){if(_0x40f4x8[_0xbcc1[28]][_0xbcc1[24]]){delete _0x40f4x8[_0xbcc1[28]][_0xbcc1[24]]};return Interval[_0xbcc1[21]](_0xbcc1[20])[_0xbcc1[26]](_0x40f4x8[_0xbcc1[25]][_0xbcc1[24]])[_0xbcc1[14]](function(_0x40f4xd){if(!_0x40f4xd){return _0x40f4x9[_0xbcc1[23]](404)};_0x40f4xe= _[_0xbcc1[33]](_0x40f4xd);return _0x40f4xd[_0xbcc1[34]](_0x40f4x8[_0xbcc1[28]],{transaction:_0x40f4xf})})[_0xbcc1[14]](function(){if(_0x40f4x8[_0xbcc1[28]][_0xbcc1[30]]&&  !_0x40f4x8[_0xbcc1[28]][_0xbcc1[30]][_0xbcc1[31]]){return Interval[_0xbcc1[32]]({where:{IntervalId:_0x40f4x8[_0xbcc1[25]][_0xbcc1[24]]},individualHooks:true,transaction:_0x40f4xf})}else {if(_0x40f4x8[_0xbcc1[28]][_0xbcc1[30]]&& _0x40f4x8[_0xbcc1[28]][_0xbcc1[30]][_0xbcc1[31]]){return bulkCreateSubIntervals(_0x40f4x8[_0xbcc1[28]].SubIntervals,_0x40f4xe,_0x40f4xf)}}})})[_0xbcc1[14]](function(){return _0x40f4x9[_0xbcc1[23]](200)})[_0xbcc1[11]](function(_0x40f4xb){return handleError(_0x40f4x9,_0x40f4xb)})};function bulkCreateSubIntervals(_0x40f4x11,_0x40f4xe,_0x40f4xf){return Promise[_0xbcc1[36]]([])[_0xbcc1[14]](function(){var _0x40f4x12=[];var _0x40f4x13=_[_0xbcc1[38]](_0x40f4xe.SubIntervals,_0xbcc1[37]);var _0x40f4x14;_[_0xbcc1[43]](_0x40f4x13,function(_0x40f4x15,_0x40f4x16){_0x40f4x14= _[_0xbcc1[39]](_0x40f4x11,{id:_0x40f4x15[_0xbcc1[24]]});if(_0x40f4x14){_0x40f4x14[_0xbcc1[40]]= _0x40f4xe[_0xbcc1[24]];_0x40f4x12[_0xbcc1[41]](Interval[_0xbcc1[29]](_[_0xbcc1[33]](_0x40f4x14),{where:{id:_0x40f4x15[_0xbcc1[24]]},transaction:_0x40f4xf,individualHooks:true}));_[_0xbcc1[42]](_0x40f4x11,{id:_0x40f4x15[_0xbcc1[24]]})}else {_0x40f4x12[_0xbcc1[41]](Interval[_0xbcc1[32]]({where:{id:_0x40f4x15[_0xbcc1[24]]},individualHooks:true,transaction:_0x40f4xf}))}});_[_0xbcc1[43]](_0x40f4x11,function(_0x40f4x15){_0x40f4x15[_0xbcc1[40]]= _0x40f4xe[_0xbcc1[24]];_0x40f4x12[_0xbcc1[41]](Interval[_0xbcc1[27]](_0x40f4x15,{transaction:_0x40f4xf}))});return _0x40f4x12})[_0xbcc1[36]]()}exports[_0xbcc1[32]]= function(_0x40f4x8,_0x40f4x9){return sequelize[_0xbcc1[35]](function(_0x40f4xf){return Interval[_0xbcc1[32]]({where:{id:_0x40f4x8[_0xbcc1[25]][_0xbcc1[24]]},individualHooks:true,transaction:_0x40f4xf})})[_0xbcc1[14]](function(){return _0x40f4x9[_0xbcc1[23]](204)})[_0xbcc1[11]](sequelize.ForeignKeyConstraintError,function(_0x40f4xb){_0x40f4xb[_0xbcc1[44]]= _0xbcc1[45];_0x40f4xb[_0xbcc1[46]]= _0xbcc1[47];return handleError(_0x40f4x9,_0x40f4xb)})[_0xbcc1[11]](function(_0x40f4xb){return handleError(_0x40f4x9,_0x40f4xb)})};exports[_0xbcc1[48]]= function(_0x40f4x8,_0x40f4x9){return sequelize[_0xbcc1[35]](function(_0x40f4xf){return Interval[_0xbcc1[32]]({where:{id:_0x40f4x8[_0xbcc1[15]][_0xbcc1[49]]},individualHooks:true,transaction:_0x40f4xf})})[_0xbcc1[14]](function(){return _0x40f4x9[_0xbcc1[23]](204)})[_0xbcc1[11]](sequelize.ForeignKeyConstraintError,function(_0x40f4xb){_0x40f4xb[_0xbcc1[44]]= _0xbcc1[45];_0x40f4xb[_0xbcc1[46]]= _0xbcc1[47];return handleError(_0x40f4x9,_0x40f4xb)})[_0xbcc1[11]](function(_0x40f4xb){return handleError(_0x40f4x9,_0x40f4xb)})};function handleError(_0x40f4x9,_0x40f4xb){logger[_0xbcc1[51]](_0x40f4xb[_0xbcc1[50]]);return _0x40f4x9[_0xbcc1[13]](500)[_0xbcc1[12]](_0x40f4xb)}