297800f60663da3c64dc913ac2e4616499d1dcc8
[motion.git] / server / api / interval / interval.controller.js
1 var _0xf40e=["\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","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x63\x6F\x75\x6E\x74","\x6C\x65\x6E\x67\x74\x68","\x72\x6F\x77\x73","\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","\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","\x6C\x6F\x67","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x53\x75\x62\x49\x6E\x74\x65\x72\x76\x61\x6C\x73","\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"];_0xf40e[0];var _=require(_0xf40e[1]);var Interval=require(_0xf40e[3])[_0xf40e[2]];var VoiceExtension=require(_0xf40e[3])[_0xf40e[4]];var sequelize=require(_0xf40e[3])[_0xf40e[5]];var Promise=require(_0xf40e[6]);var Util=require(_0xf40e[7]);exports[_0xf40e[8]]= function(_0xd89fx7,_0xd89fx8,_0xd89fx9){return Interval[_0xf40e[21]](_0xf40e[19],_0xf40e[20])[_0xf40e[18]](Util[_0xf40e[17]](_0xd89fx7[_0xf40e[16]]))[_0xf40e[15]](function(_0xd89fxb){_0xd89fxb[_0xf40e[10]]= _0xd89fxb[_0xf40e[12]][_0xf40e[11]];return _0xd89fx8[_0xf40e[14]](200)[_0xf40e[13]](_0xd89fxb)})[_0xf40e[9]](function(_0xd89fxa){return handleError(_0xd89fx8,_0xd89fxa)})};exports[_0xf40e[22]]= function(_0xd89fx7,_0xd89fx8){return Interval[_0xf40e[21]](_0xf40e[20])[_0xf40e[26]](_0xd89fx7[_0xf40e[25]][_0xf40e[24]])[_0xf40e[15]](function(_0xd89fxc){if(!_0xd89fxc){return _0xd89fx8[_0xf40e[23]](404)};return _0xd89fx8[_0xf40e[13]](_0xd89fxc)})[_0xf40e[9]](function(_0xd89fxa){return handleError(_0xd89fx8,_0xd89fxa)})};exports[_0xf40e[27]]= function(_0xd89fx7,_0xd89fx8){return Interval[_0xf40e[21]](_0xf40e[20])[_0xf40e[27]](_0xd89fx7[_0xf40e[29]])[_0xf40e[15]](function(_0xd89fxc){return _0xd89fx8[_0xf40e[14]](201)[_0xf40e[13]](_0xd89fxc)})[_0xf40e[9]](function(_0xd89fxa){console[_0xf40e[28]](_0xd89fxa);return handleError(_0xd89fx8,_0xd89fxa)})};exports[_0xf40e[30]]= function(_0xd89fx7,_0xd89fx8){var _0xd89fxd;return sequelize[_0xf40e[35]](function(_0xd89fxe){if(_0xd89fx7[_0xf40e[29]][_0xf40e[24]]){delete _0xd89fx7[_0xf40e[29]][_0xf40e[24]]};return Interval[_0xf40e[21]](_0xf40e[20])[_0xf40e[26]](_0xd89fx7[_0xf40e[25]][_0xf40e[24]])[_0xf40e[15]](function(_0xd89fxc){if(!_0xd89fxc){return _0xd89fx8[_0xf40e[23]](404)};_0xd89fxd= _[_0xf40e[33]](_0xd89fxc);return _0xd89fxc[_0xf40e[34]](_0xd89fx7[_0xf40e[29]],{transaction:_0xd89fxe})})[_0xf40e[15]](function(){if(_0xd89fx7[_0xf40e[29]][_0xf40e[31]]&& !_0xd89fx7[_0xf40e[29]][_0xf40e[31]][_0xf40e[11]]){return Interval[_0xf40e[32]]({where:{IntervalId:_0xd89fx7[_0xf40e[25]][_0xf40e[24]]},transaction:_0xd89fxe})}else {if(_0xd89fx7[_0xf40e[29]][_0xf40e[31]]&& _0xd89fx7[_0xf40e[29]][_0xf40e[31]][_0xf40e[11]]){return bulkCreateSubIntervals(_0xd89fx7[_0xf40e[29]].SubIntervals,_0xd89fxd,_0xd89fxe)}}})})[_0xf40e[15]](function(){return _0xd89fx8[_0xf40e[23]](200)})[_0xf40e[9]](function(_0xd89fxa){console[_0xf40e[28]](_0xd89fxa);return handleError(_0xd89fx8,_0xd89fxa)})};function bulkCreateSubIntervals(_0xd89fx10,_0xd89fxd,_0xd89fxe){return Promise[_0xf40e[36]]([])[_0xf40e[15]](function(){var _0xd89fx11=[];var _0xd89fx12=_[_0xf40e[38]](_0xd89fxd.SubIntervals,_0xf40e[37]);var _0xd89fx13;_[_0xf40e[43]](_0xd89fx12,function(_0xd89fx14,_0xd89fx15){_0xd89fx13= _[_0xf40e[39]](_0xd89fx10,{id:_0xd89fx14[_0xf40e[24]]});if(_0xd89fx13){_0xd89fx13[_0xf40e[40]]= _0xd89fxd[_0xf40e[24]];_0xd89fx11[_0xf40e[41]](Interval[_0xf40e[30]](_[_0xf40e[33]](_0xd89fx13),{where:{id:_0xd89fx14[_0xf40e[24]]},transaction:_0xd89fxe,individualHooks:true}));_[_0xf40e[42]](_0xd89fx10,{id:_0xd89fx14[_0xf40e[24]]})}else {_0xd89fx11[_0xf40e[41]](Interval[_0xf40e[32]]({where:{id:_0xd89fx14[_0xf40e[24]]},transaction:_0xd89fxe}))}});_[_0xf40e[43]](_0xd89fx10,function(_0xd89fx14){_0xd89fx14[_0xf40e[40]]= _0xd89fxd[_0xf40e[24]];_0xd89fx11[_0xf40e[41]](Interval[_0xf40e[27]](_0xd89fx14,{transaction:_0xd89fxe}))});return _0xd89fx11})[_0xf40e[36]]()}exports[_0xf40e[32]]= function(_0xd89fx7,_0xd89fx8){return sequelize[_0xf40e[35]](function(_0xd89fxe){return Interval[_0xf40e[32]]({where:{id:_0xd89fx7[_0xf40e[25]][_0xf40e[24]]},individualHooks:true,transaction:_0xd89fxe})})[_0xf40e[15]](function(){return _0xd89fx8[_0xf40e[23]](204)})[_0xf40e[9]](sequelize.ForeignKeyConstraintError,function(_0xd89fxa){_0xd89fxa[_0xf40e[44]]= _0xf40e[45];_0xd89fxa[_0xf40e[46]]= _0xf40e[47];return handleError(_0xd89fx8,_0xd89fxa)})[_0xf40e[9]](function(_0xd89fxa){return handleError(_0xd89fx8,_0xd89fxa)})};exports[_0xf40e[48]]= function(_0xd89fx7,_0xd89fx8){return sequelize[_0xf40e[35]](function(_0xd89fxe){return Interval[_0xf40e[32]]({where:{id:_0xd89fx7[_0xf40e[16]][_0xf40e[49]]},individualHooks:true,transaction:_0xd89fxe})})[_0xf40e[15]](function(){return _0xd89fx8[_0xf40e[23]](204)})[_0xf40e[9]](sequelize.ForeignKeyConstraintError,function(_0xd89fxa){_0xd89fxa[_0xf40e[44]]= _0xf40e[45];_0xd89fxa[_0xf40e[46]]= _0xf40e[47];return handleError(_0xd89fx8,_0xd89fxa)})[_0xf40e[9]](function(_0xd89fxa){return handleError(_0xd89fx8,_0xd89fxa)})};function handleError(_0xd89fx8,_0xd89fxa){return _0xd89fx8[_0xf40e[14]](500)[_0xf40e[13]](_0xd89fxa)}