Built motion from commit 8dae768.|0.0.121
[motion.git] / server / api / metric / metric.controller.js
index d7538ec..e1ceaee 100644 (file)
@@ -1 +1 @@
-var _0x5841=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x4D\x65\x74\x72\x69\x63","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x52\x65\x70\x6F\x72\x74\x46\x69\x65\x6C\x64","\x75\x74\x69\x6C","\x69\x6E\x64\x65\x78","\x6E\x61\x6D\x65","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\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","\x53\x6F\x6D\x65\x74\x68\x69\x6E\x67\x20\x62\x6C\x65\x77\x20\x75\x70\x21","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x63\x61\x74\x63\x68","\x63\x6F\x75\x6E\x74","\x63\x65\x69\x6C","\x6F\x66\x66\x73\x65\x74","\x25\x73\x3A\x2F\x2F\x25\x73\x25\x73\x3F\x70\x61\x67\x65\x3D\x25\x64","\x70\x72\x6F\x74\x6F\x63\x6F\x6C","\x68\x6F\x73\x74","\x68\x65\x61\x64\x65\x72\x73","\x62\x61\x73\x65\x55\x72\x6C","\x72\x6F\x77\x73","\x74\x68\x65\x6E","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x6D\x65\x74\x72\x69\x63\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x62\x6F\x64\x79","\x6C\x6F\x67","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x66\x69\x6E\x64\x41\x6C\x6C","\x67\x65\x74\x4D\x65\x74\x72\x69\x63\x73\x42\x79\x54\x61\x62\x6C\x65","\x74\x61\x62\x6C\x65","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x75\x70\x64\x61\x74\x65","\x6D\x65\x74\x72\x69\x63","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x6C\x65\x6E\x67\x74\x68","\x4D\x45\x53\x53\x41\x47\x45\x5F\x45\x58\x49\x53\x54\x5F\x4D\x45\x54\x52\x49\x43","\x66\x69\x6E\x64","\x64\x65\x73\x74\x72\x6F\x79","\x4D\x45\x53\x53\x41\x47\x45\x5F\x4D\x45\x54\x52\x49\x43\x5F\x43\x4F\x4E\x46\x49\x47\x55\x52\x41\x54\x49\x4F\x4E\x5F\x41\x53\x53\x4F\x43\x49\x41\x54\x45\x44","\x67\x65\x74\x5A\x65\x6E\x64\x65\x73\x6B\x54\x65\x78\x74\x73","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79"];_0x5841[0];var _=require(_0x5841[1]);var Metric=require(_0x5841[3])[_0x5841[2]];var ReportField=require(_0x5841[3])[_0x5841[4]];var util=require(_0x5841[5]);exports[_0x5841[6]]=function(_0x4538x5,_0x4538x6){var _0x4538x7=[_0x5841[7],_0x5841[8]];var _0x4538x8=_0x4538x5[_0x5841[10]][_0x5841[9]]?parseInt(_0x4538x5[_0x5841[10]][_0x5841[9]],10):100;var _0x4538x9=_0x4538x5[_0x5841[10]][_0x5841[11]]?parseInt(_0x4538x5[_0x5841[10]][_0x5841[11]],10):0;var _0x4538xa={where:{},limit:_0x4538x8,offset:_0x4538x9*_0x4538x8};_[_0x5841[25]](_0x4538x5[_0x5841[10]],function(_0x4538xb,_0x4538xc){switch(_0x4538xc){case _0x5841[9]:;case _0x5841[11]:break;case _0x5841[14]:_0x4538xa[_0x5841[12]]=util[_0x5841[17]](_0x5841[13],_0x4538x5[_0x5841[10]][_0x5841[14]],_0x4538x5[_0x5841[10]][_0x5841[15]]||_0x5841[16])||null;break;case _0x5841[15]:break;case _0x5841[23]:_0x4538xa[_0x5841[19]][_0x5841[18]]=[];_0x4538x7[_0x5841[22]](function(_0x4538xd){var _0x4538xe={};_0x4538xe[_0x4538xd]={$like:_0x5841[20]+_0x4538xb+_0x5841[20]};_0x4538xa[_0x5841[19]][_0x5841[18]][_0x5841[21]](_0x4538xe)});break;default:_0x4538xa[_0x5841[19]][_0x4538xc]={$like:{}};_0x4538xa[_0x5841[19]][_0x4538xc][_0x5841[24]]=_0x5841[20]+_0x4538xb+_0x5841[20]}});Metric[_0x5841[40]](_0x4538xa)[_0x5841[39]](function(_0x4538x10){var _0x4538x11=Math[_0x5841[31]](_0x4538x10[_0x5841[30]]/_0x4538x8);var _0x4538x12=_0x4538x11>(_0x4538xa[_0x5841[32]]+1)?util[_0x5841[17]](_0x5841[33],_0x4538x5[_0x5841[34]],_0x4538x5[_0x5841[36]][_0x5841[35]],_0x4538x5[_0x5841[37]],_0x4538x9+1):null;var _0x4538x13=_0x4538x9>0?util[_0x5841[17]](_0x5841[33],_0x4538x5[_0x5841[34]],_0x4538x5[_0x5841[36]][_0x5841[35]],_0x4538x5[_0x5841[37]],_0x4538x9-1):null;_0x4538x6[_0x5841[28]](200)[_0x5841[27]]({count:_0x4538x10[_0x5841[30]],rows:_0x4538x10[_0x5841[38]],next_page:_0x4538x12,previous_page:_0x4538x13,total_pages:_0x4538x11})})[_0x5841[29]](function(_0x4538xf){_0x4538x6[_0x5841[28]](500)[_0x5841[27]]({error:_0x5841[26]})})};exports[_0x5841[41]]=function(_0x4538x5,_0x4538x6){console[_0x5841[43]](_0x4538x5[_0x5841[42]]);Metric[_0x5841[45]]({where:{name:_0x4538x5[_0x5841[42]][_0x5841[7]]}})[_0x5841[39]](function(_0x4538x14){if(!_0x4538x14){return _0x4538x6[_0x5841[44]](404)};return _0x4538x6[_0x5841[27]](_0x4538x14)})[_0x5841[29]](function(_0x4538xf){return handleError(_0x4538x6,_0x4538xf)})};exports[_0x5841[46]]=function(_0x4538x5,_0x4538x6){console[_0x5841[43]](_0x4538x5[_0x5841[10]]);Metric[_0x5841[45]]({where:{table:_0x4538x5[_0x5841[10]][_0x5841[47]]}})[_0x5841[39]](function(_0x4538x14){console[_0x5841[43]](_0x4538x14);if(!_0x4538x14){return _0x4538x6[_0x5841[44]](404)};return _0x4538x6[_0x5841[28]](200)[_0x5841[27]](_0x4538x14)})[_0x5841[29]](function(_0x4538xf){return handleError(_0x4538x6,_0x4538xf)})};exports[_0x5841[48]]=function(_0x4538x5,_0x4538x6){Metric[_0x5841[51]](_0x4538x5[_0x5841[50]][_0x5841[49]])[_0x5841[39]](function(_0x4538x15){if(!_0x4538x15){return _0x4538x6[_0x5841[44]](404)};return _0x4538x6[_0x5841[27]](_0x4538x15)})[_0x5841[29]](function(_0x4538xf){return handleError(_0x4538x6,_0x4538xf)})};exports[_0x5841[52]]=function(_0x4538x5,_0x4538x6){Metric[_0x5841[52]](_0x4538x5[_0x5841[42]])[_0x5841[39]](function(_0x4538x15){return _0x4538x6[_0x5841[28]](201)[_0x5841[27]](_0x4538x15)})[_0x5841[29]](function(_0x4538xf){return handleError(_0x4538x6,_0x4538xf)})};exports[_0x5841[53]]=function(_0x4538x5,_0x4538x6){Metric[_0x5841[45]]({where:{name:_0x4538x5[_0x5841[42]][_0x5841[7]],id:{$ne:_0x4538x5[_0x5841[42]][_0x5841[49]]}}})[_0x5841[39]](function(_0x4538x14){if(!_0x4538x14){return _0x4538x6[_0x5841[44]](404)};if(_0x4538x14[_0x5841[57]]>0){return _0x4538x6[_0x5841[28]](500)[_0x5841[27]]({message:_0x5841[58]})};if(_0x4538x5[_0x5841[42]][_0x5841[49]]){delete _0x4538x5[_0x5841[42]][_0x5841[49]]};return Metric[_0x5841[59]]({where:{id:_0x4538x5[_0x5841[50]][_0x5841[49]]}})})[_0x5841[39]](function(_0x4538x15){if(!_0x4538x15){return _0x4538x6[_0x5841[44]](404)};var _0x4538x16=_[_0x5841[55]](_0x4538x15,_0x4538x5[_0x5841[42]]);return _0x4538x16[_0x5841[56]]()})[_0x5841[39]](function(_0x4538x15){return ReportField[_0x5841[53]]({field:_0x4538x15[_0x5841[54]]},{where:{MetricId:_0x4538x15[_0x5841[49]]}})})[_0x5841[39]](function(){return _0x4538x6[_0x5841[44]](200)})[_0x5841[29]](function(_0x4538xf){console[_0x5841[43]](_0x4538xf);return handleError(_0x4538x6,_0x4538xf)})};exports[_0x5841[60]]=function(_0x4538x5,_0x4538x6){Metric[_0x5841[51]](_0x4538x5[_0x5841[50]][_0x5841[49]])[_0x5841[39]](function(_0x4538x15){if(!_0x4538x15){return _0x4538x6[_0x5841[44]](404)};_0x4538x15[_0x5841[62]]()[_0x5841[39]](function(_0x4538x17){if(_0x4538x17[_0x5841[57]]>0){return _0x4538x6[_0x5841[28]](500)[_0x5841[27]]({message:_0x5841[61]})};_0x4538x15[_0x5841[60]]()[_0x5841[39]](function(){return _0x4538x6[_0x5841[44]](204)})[_0x5841[29]](function(_0x4538xf){return handleError(_0x4538x6,_0x4538xf)})})[_0x5841[29]](function(_0x4538xf){return handleError(_0x4538x6,_0x4538xf)})})[_0x5841[29]](function(_0x4538xf){return handleError(_0x4538x6,_0x4538xf)})};exports[_0x5841[63]]=function(_0x4538x5,_0x4538x6){Metric[_0x5841[60]]({where:{id:_0x4538x5[_0x5841[10]][_0x5841[49]]},individualHooks:true})[_0x5841[39]](function(){return _0x4538x6[_0x5841[44]](204)})[_0x5841[29]](function(_0x4538xf){return handleError(_0x4538x6,_0x4538xf)})};function handleError(_0x4538x6,_0x4538xf){return _0x4538x6[_0x5841[28]](500)[_0x5841[27]](_0x4538xf)}
\ No newline at end of file
+var _0x9fa2=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x4D\x65\x74\x72\x69\x63","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x75\x74\x69\x6C","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\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","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x67\x65\x74\x4D\x65\x74\x72\x69\x63\x73\x42\x79\x54\x61\x62\x6C\x65","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x6C\x65\x6E\x67\x74\x68","\x74\x61\x62\x6C\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\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\x45\x58\x49\x53\x54\x5F\x4D\x45\x54\x52\x49\x43","\x6D\x65\x73\x73\x61\x67\x65","\x41\x20\x4D\x65\x74\x72\x69\x63\x20\x77\x69\x74\x68\x20\x74\x68\x61\x74\x20\x6E\x61\x6D\x65\x20\x61\x6C\x72\x65\x61\x64\x79\x20\x65\x78\x69\x73\x74\x73","\x62\x6F\x64\x79","\x75\x70\x64\x61\x74\x65","\x6C\x6F\x67","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0x9fa2[0];var _=require(_0x9fa2[1]);var Metric=require(_0x9fa2[3])[_0x9fa2[2]];var util=require(_0x9fa2[4]);var Util=require(_0x9fa2[5]);var sequelize=require(_0x9fa2[3])[_0x9fa2[6]];exports[_0x9fa2[7]]= function(_0x84d1x6,_0x84d1x7,_0x84d1x8){return Metric[_0x9fa2[14]](Util[_0x9fa2[13]](_0x84d1x6[_0x9fa2[12]]))[_0x9fa2[11]](function(_0x84d1xa){return _0x84d1x7[_0x9fa2[10]](200)[_0x9fa2[9]](_0x84d1xa)})[_0x9fa2[8]](function(_0x84d1x9){return handleError(_0x84d1x7,_0x84d1x9)})};exports[_0x9fa2[15]]= function(_0x84d1x6,_0x84d1x7){return Metric[_0x9fa2[19]]({where:{table:_0x84d1x6[_0x9fa2[12]][_0x9fa2[18]]}})[_0x9fa2[11]](function(_0x84d1xb){if(!_0x84d1xb){return _0x84d1x7[_0x9fa2[16]](404)};return _0x84d1x7[_0x9fa2[10]](200)[_0x9fa2[9]]({count:_0x84d1xb[_0x9fa2[17]],rows:_0x84d1xb})})[_0x9fa2[8]](function(_0x84d1x9){return handleError(_0x84d1x7,_0x84d1x9)})};exports[_0x9fa2[20]]= function(_0x84d1x6,_0x84d1x7){return Metric[_0x9fa2[23]](_0x84d1x6[_0x9fa2[22]][_0x9fa2[21]])[_0x9fa2[11]](function(_0x84d1xc){if(!_0x84d1xc){return _0x84d1x7[_0x9fa2[16]](404)};return _0x84d1x7[_0x9fa2[9]](_0x84d1xc)})[_0x9fa2[8]](function(_0x84d1x9){return handleError(_0x84d1x7,_0x84d1x9)})};exports[_0x9fa2[24]]= function(_0x84d1x6,_0x84d1x7){return Metric[_0x9fa2[24]](_0x84d1x6[_0x9fa2[29]])[_0x9fa2[11]](function(_0x84d1xc){return _0x84d1x7[_0x9fa2[10]](201)[_0x9fa2[9]](_0x84d1xc)})[_0x9fa2[8]](sequelize.UniqueConstraintError,function(_0x84d1x9){_0x84d1x9[_0x9fa2[25]]= _0x9fa2[26];_0x84d1x9[_0x9fa2[27]]= _0x9fa2[28];return _0x84d1x7[_0x9fa2[10]](500)[_0x9fa2[9]](_0x84d1x9)})[_0x9fa2[8]](function(_0x84d1x9){return handleError(_0x84d1x7,_0x84d1x9)})};exports[_0x9fa2[30]]= function(_0x84d1x6,_0x84d1x7){return Metric[_0x9fa2[23]](_0x84d1x6[_0x9fa2[22]][_0x9fa2[21]])[_0x9fa2[11]](function(_0x84d1xc){if(!_0x84d1xc){return _0x84d1x7[_0x9fa2[16]](404)};var _0x84d1xd=_[_0x9fa2[32]](_0x84d1xc,_0x84d1x6[_0x9fa2[29]]);return _0x84d1xd[_0x9fa2[33]]()})[_0x9fa2[11]](function(){return _0x84d1x7[_0x9fa2[16]](200)})[_0x9fa2[8]](sequelize.UniqueConstraintError,function(_0x84d1x9){_0x84d1x9[_0x9fa2[25]]= _0x9fa2[26];_0x84d1x9[_0x9fa2[27]]= _0x9fa2[28];return _0x84d1x7[_0x9fa2[10]](500)[_0x9fa2[9]](_0x84d1x9)})[_0x9fa2[8]](function(_0x84d1x9){console[_0x9fa2[31]](_0x84d1x9);return handleError(_0x84d1x7,_0x84d1x9)})};exports[_0x9fa2[34]]= function(_0x84d1x6,_0x84d1x7){return Metric[_0x9fa2[23]](_0x84d1x6[_0x9fa2[22]][_0x9fa2[21]])[_0x9fa2[11]](function(_0x84d1xc){if(!_0x84d1xc){return _0x84d1x7[_0x9fa2[16]](404)};return _0x84d1xc[_0x9fa2[34]]()})[_0x9fa2[11]](function(){return _0x84d1x7[_0x9fa2[16]](204)})[_0x9fa2[8]](function(_0x84d1x9){return handleError(_0x84d1x7,_0x84d1x9)})};exports[_0x9fa2[35]]= function(_0x84d1x6,_0x84d1x7){return Metric[_0x9fa2[34]]({where:{id:_0x84d1x6[_0x9fa2[12]][_0x9fa2[36]]},individualHooks:true})[_0x9fa2[11]](function(){return _0x84d1x7[_0x9fa2[16]](204)})[_0x9fa2[8]](function(_0x84d1x9){return handleError(_0x84d1x7,_0x84d1x9)})};function handleError(_0x84d1x7,_0x84d1x9){return _0x84d1x7[_0x9fa2[10]](500)[_0x9fa2[9]](_0x84d1x9)}
\ No newline at end of file