8187fdeacb864a11c4bccbde546e2523e3fef121
[motion.git] / server / api / interval / interval.controller.js
1 var _0x7f81=["\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","\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","\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","\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"];_0x7f81[0];var _=require(_0x7f81[1]);var Interval=require(_0x7f81[3])[_0x7f81[2]];var VoiceExtension=require(_0x7f81[3])[_0x7f81[4]];var sequelize=require(_0x7f81[3])[_0x7f81[5]];var Promise=require(_0x7f81[6]);var Util=require(_0x7f81[7]);exports[_0x7f81[8]]= function(_0x95ccx7,_0x95ccx8,_0x95ccx9){return Interval[_0x7f81[19]](_0x7f81[17],_0x7f81[18])[_0x7f81[16]](_[_0x7f81[15]](Util[_0x7f81[14]](_0x95ccx7[_0x7f81[13]]),{distinct:true}))[_0x7f81[12]](function(_0x95ccxb){_0x95ccx8[_0x7f81[11]](200)[_0x7f81[10]](_0x95ccxb)})[_0x7f81[9]](function(_0x95ccxa){return handleError(_0x95ccx8,_0x95ccxa)})};exports[_0x7f81[20]]= function(_0x95ccx7,_0x95ccx8){return Interval[_0x7f81[19]](_0x7f81[18])[_0x7f81[24]](_0x95ccx7[_0x7f81[23]][_0x7f81[22]])[_0x7f81[12]](function(_0x95ccxc){if(!_0x95ccxc){return _0x95ccx8[_0x7f81[21]](404)};return _0x95ccx8[_0x7f81[10]](_0x95ccxc)})[_0x7f81[9]](function(_0x95ccxa){return handleError(_0x95ccx8,_0x95ccxa)})};exports[_0x7f81[25]]= function(_0x95ccx7,_0x95ccx8){return Interval[_0x7f81[19]](_0x7f81[18])[_0x7f81[25]](_0x95ccx7[_0x7f81[27]])[_0x7f81[12]](function(_0x95ccxc){return _0x95ccx8[_0x7f81[11]](201)[_0x7f81[10]](_0x95ccxc)})[_0x7f81[9]](function(_0x95ccxa){console[_0x7f81[26]](_0x95ccxa);return handleError(_0x95ccx8,_0x95ccxa)})};exports[_0x7f81[28]]= function(_0x95ccx7,_0x95ccx8){var _0x95ccxd;return sequelize[_0x7f81[34]](function(_0x95ccxe){if(_0x95ccx7[_0x7f81[27]][_0x7f81[22]]){delete _0x95ccx7[_0x7f81[27]][_0x7f81[22]]};return Interval[_0x7f81[19]](_0x7f81[18])[_0x7f81[24]](_0x95ccx7[_0x7f81[23]][_0x7f81[22]])[_0x7f81[12]](function(_0x95ccxc){if(!_0x95ccxc){return _0x95ccx8[_0x7f81[21]](404)};_0x95ccxd= _[_0x7f81[32]](_0x95ccxc);return _0x95ccxc[_0x7f81[33]](_0x95ccx7[_0x7f81[27]],{transaction:_0x95ccxe})})[_0x7f81[12]](function(){if(_0x95ccx7[_0x7f81[27]][_0x7f81[29]]&&  !_0x95ccx7[_0x7f81[27]][_0x7f81[29]][_0x7f81[30]]){return Interval[_0x7f81[31]]({where:{IntervalId:_0x95ccx7[_0x7f81[23]][_0x7f81[22]]},individualHooks:true,transaction:_0x95ccxe})}else {if(_0x95ccx7[_0x7f81[27]][_0x7f81[29]]&& _0x95ccx7[_0x7f81[27]][_0x7f81[29]][_0x7f81[30]]){return bulkCreateSubIntervals(_0x95ccx7[_0x7f81[27]].SubIntervals,_0x95ccxd,_0x95ccxe)}}})})[_0x7f81[12]](function(){return _0x95ccx8[_0x7f81[21]](200)})[_0x7f81[9]](function(_0x95ccxa){console[_0x7f81[26]](_0x95ccxa);return handleError(_0x95ccx8,_0x95ccxa)})};function bulkCreateSubIntervals(_0x95ccx10,_0x95ccxd,_0x95ccxe){return Promise[_0x7f81[35]]([])[_0x7f81[12]](function(){var _0x95ccx11=[];var _0x95ccx12=_[_0x7f81[37]](_0x95ccxd.SubIntervals,_0x7f81[36]);var _0x95ccx13;_[_0x7f81[42]](_0x95ccx12,function(_0x95ccx14,_0x95ccx15){_0x95ccx13= _[_0x7f81[38]](_0x95ccx10,{id:_0x95ccx14[_0x7f81[22]]});if(_0x95ccx13){_0x95ccx13[_0x7f81[39]]= _0x95ccxd[_0x7f81[22]];_0x95ccx11[_0x7f81[40]](Interval[_0x7f81[28]](_[_0x7f81[32]](_0x95ccx13),{where:{id:_0x95ccx14[_0x7f81[22]]},transaction:_0x95ccxe,individualHooks:true}));_[_0x7f81[41]](_0x95ccx10,{id:_0x95ccx14[_0x7f81[22]]})}else {_0x95ccx11[_0x7f81[40]](Interval[_0x7f81[31]]({where:{id:_0x95ccx14[_0x7f81[22]]},individualHooks:true,transaction:_0x95ccxe}))}});_[_0x7f81[42]](_0x95ccx10,function(_0x95ccx14){_0x95ccx14[_0x7f81[39]]= _0x95ccxd[_0x7f81[22]];_0x95ccx11[_0x7f81[40]](Interval[_0x7f81[25]](_0x95ccx14,{transaction:_0x95ccxe}))});return _0x95ccx11})[_0x7f81[35]]()}exports[_0x7f81[31]]= function(_0x95ccx7,_0x95ccx8){return sequelize[_0x7f81[34]](function(_0x95ccxe){return Interval[_0x7f81[31]]({where:{id:_0x95ccx7[_0x7f81[23]][_0x7f81[22]]},individualHooks:true,transaction:_0x95ccxe})})[_0x7f81[12]](function(){return _0x95ccx8[_0x7f81[21]](204)})[_0x7f81[9]](sequelize.ForeignKeyConstraintError,function(_0x95ccxa){_0x95ccxa[_0x7f81[43]]= _0x7f81[44];_0x95ccxa[_0x7f81[45]]= _0x7f81[46];return handleError(_0x95ccx8,_0x95ccxa)})[_0x7f81[9]](function(_0x95ccxa){return handleError(_0x95ccx8,_0x95ccxa)})};exports[_0x7f81[47]]= function(_0x95ccx7,_0x95ccx8){return sequelize[_0x7f81[34]](function(_0x95ccxe){return Interval[_0x7f81[31]]({where:{id:_0x95ccx7[_0x7f81[13]][_0x7f81[48]]},individualHooks:true,transaction:_0x95ccxe})})[_0x7f81[12]](function(){return _0x95ccx8[_0x7f81[21]](204)})[_0x7f81[9]](sequelize.ForeignKeyConstraintError,function(_0x95ccxa){_0x95ccxa[_0x7f81[43]]= _0x7f81[44];_0x95ccxa[_0x7f81[45]]= _0x7f81[46];return handleError(_0x95ccx8,_0x95ccxa)})[_0x7f81[9]](function(_0x95ccxa){return handleError(_0x95ccx8,_0x95ccxa)})};function handleError(_0x95ccx8,_0x95ccxa){return _0x95ccx8[_0x7f81[11]](500)[_0x7f81[10]](_0x95ccxa)}