Built motion from commit 193354388.|1.0.24
[motion.git] / server / api / custom_report / custom_report.controller.js
1 var _0x6f67=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x43\x75\x73\x74\x6F\x6D\x52\x65\x70\x6F\x72\x74","\x52\x65\x70\x6F\x72\x74\x46\x69\x65\x6C\x64","\x4D\x65\x74\x72\x69\x63","\x45\x78\x74\x72\x61\x63\x74\x65\x64\x52\x65\x70\x6F\x72\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C\x73\x2F\x72\x65\x70\x6F\x72\x74\x5F\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C\x73\x2F\x72\x65\x70\x6F\x72\x74\x5F\x62\x75\x69\x6C\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x73\x69\x6D\x70\x6C\x65\x2D\x72\x61\x6E\x64\x6F\x6D","\x6D\x6F\x6D\x65\x6E\x74","\x63\x68\x69\x6C\x64\x5F\x70\x72\x6F\x63\x65\x73\x73","\x52\x65\x70\x6F\x72\x74\x54\x72\x65\x65","\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","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x67\x65\x74\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x72\x79","\x45\x72\x72\x6F\x72\x20\x67\x65\x74\x74\x69\x6E\x67\x20\x71\x75\x65\x72\x79\x20\x66\x72\x6F\x6D\x20\x61\x70\x69\x3A","\x73\x74\x61\x63\x6B","\x65\x72\x72\x6F\x72","\x6E\x6F\x20\x73\x75\x66\x66\x69\x63\x69\x65\x6E\x74\x20\x71\x75\x65\x75\x65\x20\x70\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E\x73\x20\x66\x6F\x72\x20\x74\x68\x65\x20\x75\x73\x65\x72","\x70\x65\x72\x6D\x69\x73\x73\x69\x6F\x6E","\x61\x6C\x6C","\x62\x75\x69\x6C\x64\x51\x75\x65\x72\x79","\x73\x70\x72\x65\x61\x64","\x75\x73\x65\x72","\x62\x75\x69\x6C\x64\x46\x69\x6C\x74\x65\x72","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x64\x61\x69\x6C\x79","\x74\x72\x75\x65","\x73\x74\x61\x72\x74\x44\x61\x74\x65","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44","\x66\x6F\x72\x6D\x61\x74","\x65\x6E\x64\x44\x61\x74\x65","\x74\x61\x62\x6C\x65","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x5F\x68\x69\x73\x74\x6F\x72\x79","","\x72\x65\x70\x6C\x61\x63\x65","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x66\x69\x65\x6C\x64\x73","\x73\x63\x6F\x70\x65","\x70\x72\x65\x76\x69\x65\x77","\x69\x73\x41\x72\x72\x61\x79","\x6C\x65\x6E\x67\x74\x68","\x6C\x69\x6D\x69\x74","\x76\x61\x6C\x75\x65","\x74\x61\x6B\x65","\x6F\x66\x66\x73\x65\x74","\x73\x6C\x69\x63\x65","\x59\x59\x59\x59\x2D\x4D\x4D\x2D\x44\x44\x20\x48\x48\x3A\x6D\x6D\x3A\x73\x73","\x66\x6F\x72\x4F\x77\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x71\x75\x65\x72\x79\x20\x65\x72\x72\x6F\x72","\x63\x68\x65\x63\x6B\x51\x75\x65\x72\x79","\x65\x78\x74\x72\x61\x63\x74\x50\x64\x66","\x65\x78\x74\x72\x61\x63\x74\x50\x64\x66\x20\x61\x70\x69\x20\x66\x75\x6E\x63\x74\x69\x6F\x6E","\x64\x65\x62\x75\x67","\x50\x44\x46","\x65\x78\x74\x72\x61\x63\x74\x43\x73\x76","\x65\x78\x74\x72\x61\x63\x74\x43\x73\x76\x20\x61\x70\x69\x20\x66\x75\x6E\x63\x74\x69\x6F\x6E","\x43\x53\x56","\x64\x65\x73\x74\x72\x6F\x79\x4E\x6F\x64\x65\x52\x65\x70\x6F\x72\x74\x73","\x74\x72\x65\x65","\x70\x61\x72\x73\x65","\x66\x69\x6E\x64","\x4E\x6F\x64\x65\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x64\x65\x73\x74\x72\x6F\x79","\x70\x75\x73\x68","\x66\x69\x6C\x74\x65\x72","\x63\x6F\x6D\x6D\x6F\x6E\x20\x64\x6F\x63\x45\x78\x74\x72\x61\x63\x74\x20\x61\x70\x69\x20\x66\x75\x6E\x63\x74\x69\x6F\x6E","\x43\x72\x65\x61\x74\x65\x64\x20\x6E\x65\x77\x20\x65\x78\x74\x72\x61\x63\x74\x65\x64\x20\x72\x65\x70\x6F\x72\x74\x73\x20\x64\x62\x20\x65\x6E\x74\x72\x79\x2C\x20\x63\x61\x6C\x6C\x69\x6E\x67\x20\x65\x78\x74\x65\x72\x6E\x61\x6C\x20\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E\x20\x66\x75\x6E\x63\x74\x69\x6F\x6E\x3A\x20","\x2F\x2E\x2E\x2F\x2E\x2E\x2F\x75\x74\x69\x6C\x73\x2F\x72\x65\x70\x6F\x72\x74\x5F\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E\x2E\x6A\x73","\x66\x6F\x72\x6B","\x52\x65\x70\x6F\x72\x74\x20\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E\x20\x70\x72\x6F\x63\x65\x73\x73\x20\x65\x72\x72\x6F\x72","\x6F\x6E","\x63\x6C\x6F\x73\x65","\x52\x65\x70\x6F\x72\x74\x20\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E\x20\x70\x72\x6F\x63\x65\x73\x73\x20\x63\x6C\x6F\x73\x65","\x6D\x65\x73\x73\x61\x67\x65","\x52\x65\x70\x6F\x72\x74\x20\x65\x78\x74\x72\x61\x63\x74\x69\x6F\x6E\x20\x70\x72\x6F\x63\x65\x73\x73\x20\x6D\x65\x73\x73\x61\x67\x65","\x6B\x69\x6C\x6C","\x70\x61\x72\x65\x6E\x74","\x6E\x61\x6D\x65","\x46\x6F\x75\x6E\x64\x20\x74\x68\x65\x20\x72\x65\x70\x6F\x72\x74\x2C\x20\x63\x72\x65\x61\x74\x69\x6E\x67\x20\x74\x68\x65\x20\x6E\x65\x77\x20\x44\x42\x20\x72\x6F\x77\x20\x66\x6F\x72\x20\x65\x78\x74\x72\x61\x63\x74\x65\x64\x20\x72\x65\x70\x6F\x72\x74\x73\x2E\x2E","\x73\x74\x61\x72\x74\x54\x69\x6D\x65","\x20","\x30\x30\x3A\x30\x30","\x65\x6E\x64\x54\x69\x6D\x65","\x32\x33\x3A\x35\x39","\x63\x72\x65\x61\x74\x65","\x74\x65\x78\x74","\x2F\x20","\x23","\x73\x68\x6F\x77","\x65\x78\x70\x6F\x72\x74","\x63\x6F\x6E\x64\x69\x74\x69\x6F\x6E\x73","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x65\x78\x70\x6F\x72\x74\x46\x69\x65\x6C\x64\x73","\x63\x6F\x70\x79","\x63\x72\x65\x61\x74\x65\x64\x41\x74","\x75\x70\x64\x61\x74\x65\x64\x41\x74","\x62\x6F\x64\x79","\x6D\x61\x70","\x74\x72\x61\x6E\x73\x61\x63\x74\x69\x6F\x6E","\x46\x69\x65\x6C\x64\x73","\x69\x6D\x70\x6F\x72\x74","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x67\x65\x74\x54\x61\x62\x6C\x65","\x43\x75\x73\x74\x6F\x6D\x52\x65\x70\x6F\x72\x74\x49\x64","\x4D\x65\x74\x72\x69\x63\x49\x64","\x66\x69\x65\x6C\x64","\x6D\x65\x74\x72\x69\x63","\x54\x68\x65\x20\x6D\x65\x74\x72\x69\x63\x20\x77\x69\x74\x68\x20\x69\x64\x20","\x20\x79\x6F\x75\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74","\x69\x6E\x63\x6C\x75\x64\x65\x73","\x63\x75\x73\x74\x6F\x6D","\x54\x68\x65\x20\x66\x69\x65\x6C\x64\x20","\x20\x79\x6F\x75\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74\x20\x69\x6E\x20\x74\x68\x65\x20\x74\x61\x62\x6C\x65","\x6B\x65\x79\x73","\x66\x69\x6E\x64\x41\x6C\x6C","\x64\x65\x73\x63\x72\x69\x62\x65","\x59\x6F\x75\x20\x68\x61\x76\x65\x20\x6E\x6F\x74\x20\x73\x70\x65\x63\x69\x66\x69\x65\x64\x20\x74\x68\x65\x20\x74\x61\x62\x6C\x65\x20\x6F\x72\x20\x74\x68\x65\x20\x74\x61\x62\x6C\x65\x20\x64\x6F\x65\x73\x20\x6E\x6F\x74\x20\x65\x78\x69\x73\x74","\x44\x65\x66\x61\x75\x6C\x74\x4D\x65\x74\x72\x69\x63\x49\x64","\x68\x61\x73","\x65\x76\x65\x72\x79","\x44\x65\x66\x61\x75\x6C\x74\x4D\x65\x74\x72\x69\x63","\x55\x6E\x73\x75\x70\x70\x6F\x72\x74\x65\x64\x20\x49\x6D\x70\x6F\x72\x74\x20\x66\x6F\x72\x6D\x61\x74\x20\x28\x4D\x65\x74\x72\x69\x63\x20\x74\x79\x70\x65\x20\x69\x6E\x20\x72\x65\x70\x6F\x72\x74\x20\x66\x69\x65\x6C\x64\x73\x20\x69\x73\x20\x6D\x69\x73\x73\x69\x6E\x67\x29","\x49\x64","\x67\x72\x6F\x75\x70\x42\x79","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x6E\x75\x6C\x6C","\x52\x65\x70\x6F\x72\x74\x46\x69\x65\x6C\x64\x73","\x5F","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0x6f67[0];var _=require(_0x6f67[1]);var util=require(_0x6f67[2]);var sequelize=require(_0x6f67[4])[_0x6f67[3]];var CustomReport=require(_0x6f67[4])[_0x6f67[5]];var ReportField=require(_0x6f67[4])[_0x6f67[6]];var Metric=require(_0x6f67[4])[_0x6f67[7]];var ExtractedReport=require(_0x6f67[4])[_0x6f67[8]];var extractUtils=require(_0x6f67[9]);var reportBuildUtils=require(_0x6f67[10]);var Util=require(_0x6f67[11]);var sr=require(_0x6f67[12]);var moment=require(_0x6f67[13]);var cp=require(_0x6f67[14]);var ReportTree=require(_0x6f67[4])[_0x6f67[15]];var logger=require(_0x6f67[17])(_0x6f67[16]);exports[_0x6f67[18]]= function(_0xbc08x10,_0xbc08x11,_0xbc08x12){return CustomReport[_0x6f67[25]](Util[_0x6f67[24]](_0xbc08x10[_0x6f67[23]],{deletedAt:null}))[_0x6f67[22]](function(_0xbc08x14){_0xbc08x11[_0x6f67[21]](200)[_0x6f67[20]](_0xbc08x14)})[_0x6f67[19]](function(_0xbc08x13){return handleError(_0xbc08x11,_0xbc08x13)})};exports[_0x6f67[26]]= function(_0xbc08x10,_0xbc08x11){return Promise[_0x6f67[32]]([])[_0x6f67[22]](getQuery(_0xbc08x10,_0xbc08x11))[_0x6f67[22]](function(_0xbc08x15){if(_0xbc08x15){switch(_0xbc08x15){case _0x6f67[31]:_0xbc08x15= _0x6f67[30];break;default:}};_0xbc08x11[_0x6f67[21]](200)[_0x6f67[20]]({query:_0xbc08x15})})[_0x6f67[19]](function(_0xbc08x13){logger[_0x6f67[29]](_0x6f67[27],_0xbc08x13[_0x6f67[28]])})};function getQuery(_0xbc08x10,_0xbc08x11){var _0xbc08x17;return function(){return CustomReport[_0x6f67[53]](_0x6f67[52])[_0x6f67[51]](_0xbc08x10[_0x6f67[50]][_0x6f67[49]])[_0x6f67[22]](function(_0xbc08x19){if(!_0xbc08x19){return _0xbc08x11[_0x6f67[37]](404)};if(_0xbc08x10[_0x6f67[23]][_0x6f67[38]]&& _0xbc08x10[_0x6f67[23]][_0x6f67[38]]=== _0x6f67[39]){_0xbc08x10[_0x6f67[23]][_0x6f67[40]]= moment()[_0x6f67[42]](_0x6f67[41]);_0xbc08x10[_0x6f67[23]][_0x6f67[43]]= moment()[_0x6f67[42]](_0x6f67[41]);_0xbc08x19[_0x6f67[45]][_0x6f67[44]]= _0xbc08x19[_0x6f67[45]][_0x6f67[44]][_0x6f67[48]](_0x6f67[46],_0x6f67[47])};delete _0xbc08x10[_0x6f67[23]][_0x6f67[38]];_0xbc08x17= _0xbc08x19[_0x6f67[45]];return _0xbc08x17[_0x6f67[44]]})[_0x6f67[22]](reportBuildUtils[_0x6f67[36]](_0xbc08x10[_0x6f67[35]]))[_0x6f67[22]](function(_0xbc08x18){return [_0xbc08x18,_0xbc08x17]})[_0x6f67[34]](reportBuildUtils[_0x6f67[33]](_0xbc08x10[_0x6f67[23]]))}}exports[_0x6f67[54]]= function(_0xbc08x10,_0xbc08x11){var _0xbc08x1a;return Promise[_0x6f67[32]]([])[_0x6f67[22]](getQuery(_0xbc08x10,_0xbc08x11))[_0x6f67[22]](reportBuildUtils[_0x6f67[66]]())[_0x6f67[22]](function(_0xbc08x1b){if(_0xbc08x1b&& _[_0x6f67[55]](_0xbc08x1b)){_0xbc08x1a= _0xbc08x1b[_0x6f67[56]];if(_0xbc08x10[_0x6f67[23]][_0x6f67[57]]){_0xbc08x1b= _(_0xbc08x1b)[_0x6f67[61]](_0xbc08x10[_0x6f67[23]][_0x6f67[60]]|| 0)[_0x6f67[59]](_0xbc08x10[_0x6f67[23]][_0x6f67[57]])[_0x6f67[58]]()};_[_0x6f67[64]](_0xbc08x1b,function(_0xbc08x1c){_[_0x6f67[63]](_0xbc08x1c,function(_0xbc08x1d,_0xbc08x1e){if(_0xbc08x1d instanceof  Date){_0xbc08x1c[_0xbc08x1e]= moment(_0xbc08x1d)[_0x6f67[42]](_0x6f67[62]).toString()}})});_0xbc08x11[_0x6f67[21]](200)[_0x6f67[20]]({rows:_0xbc08x1b,count:_0xbc08x1a})}else {return handleError(_0xbc08x11,{message:_0xbc08x1b|| _0x6f67[65]})}})[_0x6f67[19]](function(_0xbc08x13){return handleError(_0xbc08x11,_0xbc08x13)})};exports[_0x6f67[67]]= function(_0xbc08x10,_0xbc08x11){logger[_0x6f67[69]](_0x6f67[68]);docExtract(_0xbc08x10,_0xbc08x11,_0x6f67[70])};exports[_0x6f67[71]]= function(_0xbc08x10,_0xbc08x11){logger[_0x6f67[69]](_0x6f67[72]);docExtract(_0xbc08x10,_0xbc08x11,_0x6f67[73])};exports[_0x6f67[74]]= function(_0xbc08x10,_0xbc08x11){return ReportTree[_0x6f67[51]](2)[_0x6f67[22]](function(_0xbc08x1f){_0xbc08x1f= JSON[_0x6f67[76]](_0xbc08x1f[_0x6f67[75]]);var _0xbc08x20=_[_0x6f67[77]](_0xbc08x1f,{id:_0xbc08x10[_0x6f67[50]][_0x6f67[49]]});if(!_0xbc08x20){throw  new Error(_0x6f67[78])};var _0xbc08x21=[];findSubNodes(_0xbc08x20,_0xbc08x1f,_0xbc08x21);return CustomReport[_0x6f67[79]]({where:{parent:_0xbc08x21},individualHooks:true})})[_0x6f67[22]](function(){return _0xbc08x11[_0x6f67[37]](200)})[_0x6f67[19]](function(_0xbc08x13){return handleError(_0xbc08x11,_0xbc08x13)})};function findSubNodes(_0xbc08x20,_0xbc08x1f,_0xbc08x23){_0xbc08x23[_0x6f67[80]](_0xbc08x20[_0x6f67[49]]);var _0xbc08x24=_[_0x6f67[81]](_0xbc08x1f,{parent:_0xbc08x20[_0x6f67[49]]});if(!_0xbc08x24||  !_0xbc08x24[_0x6f67[56]]){return};_[_0x6f67[64]](_0xbc08x24,function(_0xbc08x25){findSubNodes(_0xbc08x25,_0xbc08x1f,_0xbc08x23)})}function docExtract(_0xbc08x10,_0xbc08x11,_0xbc08x27){var _0xbc08x19;logger[_0x6f67[69]](_0x6f67[82]);CustomReport[_0x6f67[53]](_0x6f67[52])[_0x6f67[51]](_0xbc08x10[_0x6f67[50]][_0x6f67[49]])[_0x6f67[22]](function(_0xbc08x17){if(!_0xbc08x17){return _0xbc08x11[_0x6f67[37]](404)};_0xbc08x19= _0xbc08x17;return ReportTree[_0x6f67[51]](2)})[_0x6f67[22]](function(_0xbc08x1f){_0xbc08x1f= JSON[_0x6f67[76]](_0xbc08x1f[_0x6f67[75]]);var _0xbc08x2b=_[_0x6f67[77]](_0xbc08x1f,{id:_0xbc08x19[_0x6f67[93]]});var _0xbc08x2c=getReportPath(_0xbc08x2b,_0xbc08x1f,_0xbc08x19[_0x6f67[94]]);logger[_0x6f67[69]](_0x6f67[95]);if(_0xbc08x10[_0x6f67[23]][_0x6f67[38]]&& _0xbc08x10[_0x6f67[23]][_0x6f67[38]]=== _0x6f67[39]){_0xbc08x10[_0x6f67[23]][_0x6f67[40]]= moment()[_0x6f67[42]](_0x6f67[41]);_0xbc08x10[_0x6f67[23]][_0x6f67[43]]= moment()[_0x6f67[42]](_0x6f67[41]);_0xbc08x19[_0x6f67[45]][_0x6f67[44]]= _0xbc08x19[_0x6f67[45]][_0x6f67[44]][_0x6f67[48]](_0x6f67[46],_0x6f67[47])};delete _0xbc08x10[_0x6f67[23]][_0x6f67[38]];return [_0xbc08x19,ExtractedReport[_0x6f67[101]]({name:_0xbc08x2c,startDate:_0xbc08x10[_0x6f67[23]][_0x6f67[40]]?_0xbc08x10[_0x6f67[23]][_0x6f67[40]]+ (_0xbc08x10[_0x6f67[23]][_0x6f67[96]]?_0x6f67[97]+ _0xbc08x10[_0x6f67[23]][_0x6f67[96]]:_0x6f67[98]):null,endDate:_0xbc08x10[_0x6f67[23]][_0x6f67[43]]?_0xbc08x10[_0x6f67[23]][_0x6f67[43]]+ (_0xbc08x10[_0x6f67[23]][_0x6f67[99]]?_0x6f67[97]+ _0xbc08x10[_0x6f67[23]][_0x6f67[99]]:_0x6f67[100]):null,output:_0xbc08x27,UserId:_0xbc08x10[_0x6f67[35]][_0x6f67[49]]})]})[_0x6f67[34]](function(_0xbc08x19,_0xbc08x28){logger[_0x6f67[69]](_0x6f67[83]+ _0xbc08x27);var _0xbc08x29=cp[_0x6f67[85]](__dirname+ _0x6f67[84]);_0xbc08x29[_0x6f67[87]](_0x6f67[90],function(_0xbc08x2a){logger[_0x6f67[69]](_0x6f67[91],_0xbc08x2a);_0xbc08x29[_0x6f67[92]]()})[_0x6f67[87]](_0x6f67[88],function(){logger[_0x6f67[69]](_0x6f67[89])})[_0x6f67[87]](_0x6f67[29],function(_0xbc08x13){logger[_0x6f67[69]](_0x6f67[86],_0xbc08x13)});_0xbc08x29[_0x6f67[20]]({report:_0xbc08x19,query:_0xbc08x10[_0x6f67[23]],extractedId:_0xbc08x28[_0x6f67[49]],user:_0xbc08x10[_0x6f67[35]],type:_0xbc08x27})})[_0x6f67[19]](function(_0xbc08x13){return handleError(_0xbc08x11,_0xbc08x13)});return _0xbc08x11[_0x6f67[37]](200)}function getReportPath(_0xbc08x2b,_0xbc08x1f,_0xbc08x2c){_0xbc08x2c= _0xbc08x2b[_0x6f67[102]]+ _0x6f67[103]+ _0xbc08x2c;if(_0xbc08x2b[_0x6f67[93]]=== _0x6f67[104]){return _0xbc08x2c}else {return getReportPath(_[_0x6f67[77]](_0xbc08x1f,{id:_0xbc08x2b[_0x6f67[93]]}),_0xbc08x1f,_0xbc08x2c)}}exports[_0x6f67[105]]= function(_0xbc08x10,_0xbc08x11){return CustomReport[_0x6f67[53]](_0x6f67[52])[_0x6f67[51]](_0xbc08x10[_0x6f67[50]][_0x6f67[49]])[_0x6f67[22]](function(_0xbc08x19){if(!_0xbc08x19){return _0xbc08x11[_0x6f67[37]](404)};return _0xbc08x11[_0x6f67[20]](_0xbc08x19)})[_0x6f67[19]](function(_0xbc08x13){return handleError(_0xbc08x11,_0xbc08x13)})};exports[_0x6f67[106]]= function(_0xbc08x10,_0xbc08x11){return CustomReport[_0x6f67[53]]({method:[_0x6f67[109],{CustomReportId:_0xbc08x10[_0x6f67[50]][_0x6f67[49]]}]})[_0x6f67[51]](_0xbc08x10[_0x6f67[50]][_0x6f67[49]],{attributes:[_0x6f67[107],_0x6f67[108],_0x6f67[94],_0x6f67[93],_0x6f67[44]]})[_0x6f67[22]](function(_0xbc08x19){if(!_0xbc08x19){return _0xbc08x11[_0x6f67[37]](404)};return _0xbc08x11[_0x6f67[20]](_0xbc08x19)})[_0x6f67[19]](function(_0xbc08x13){return handleError(_0xbc08x11,_0xbc08x13)})};exports[_0x6f67[110]]= function(_0xbc08x10,_0xbc08x11){var _0xbc08x2e;return sequelize[_0x6f67[115]](function(_0xbc08x2f){return CustomReport[_0x6f67[53]](_0x6f67[52])[_0x6f67[51]](_0xbc08x10[_0x6f67[50]][_0x6f67[49]])[_0x6f67[22]](function(_0xbc08x19){if(!_0xbc08x19){return _0xbc08x11[_0x6f67[37]](404)};var _0xbc08x30=_0xbc08x19[_0x6f67[45]];delete _0xbc08x30[_0x6f67[49]];delete _0xbc08x30[_0x6f67[111]];delete _0xbc08x30[_0x6f67[112]];_0xbc08x30[_0x6f67[93]]= _0xbc08x10[_0x6f67[113]][_0x6f67[93]];_0xbc08x2e= _[_0x6f67[114]](_0xbc08x30.Fields,_0x6f67[45]);return CustomReport[_0x6f67[101]](_0xbc08x30,{transaction:_0xbc08x2f})})[_0x6f67[22]](function(_0xbc08x19){return [_0xbc08x19,_0xbc08x2e]})[_0x6f67[34]](createFields(_0xbc08x2f))})[_0x6f67[22]](function(){return _0xbc08x11[_0x6f67[37]](201)})[_0x6f67[19]](function(_0xbc08x13){return handleError(_0xbc08x11,_0xbc08x13)})};exports[_0x6f67[101]]= function(_0xbc08x10,_0xbc08x11){var _0xbc08x17;return sequelize[_0x6f67[115]](function(_0xbc08x2f){return CustomReport[_0x6f67[101]](_0xbc08x10[_0x6f67[113]],{transaction:_0xbc08x2f})[_0x6f67[22]](function(_0xbc08x19){_0xbc08x17= _0xbc08x19;return [_0xbc08x17,_0xbc08x10[_0x6f67[113]][_0x6f67[116]]]})[_0x6f67[34]](createFields(_0xbc08x2f))})[_0x6f67[22]](function(){return _0xbc08x11[_0x6f67[21]](201)[_0x6f67[20]](_0xbc08x17)})[_0x6f67[19]](function(_0xbc08x13){return handleError(_0xbc08x11,_0xbc08x13)})};exports[_0x6f67[117]]= function(_0xbc08x10,_0xbc08x11){var _0xbc08x17;return sequelize[_0x6f67[115]](function(_0xbc08x2f){return CustomReport[_0x6f67[101]](_0xbc08x10[_0x6f67[113]],{transaction:_0xbc08x2f})[_0x6f67[22]](function(_0xbc08x19){_0xbc08x17= _0xbc08x19;return [_0xbc08x17,_0xbc08x10[_0x6f67[113]][_0x6f67[116]]]})[_0x6f67[34]](createImportFields(_0xbc08x2f))})[_0x6f67[22]](function(){return _0xbc08x11[_0x6f67[21]](201)[_0x6f67[20]](_0xbc08x17)})[_0x6f67[19]](function(_0xbc08x13){return handleError(_0xbc08x11,_0xbc08x13)})};exports[_0x6f67[118]]= function(_0xbc08x10,_0xbc08x11,_0xbc08x12){if(_0xbc08x10[_0x6f67[113]][_0x6f67[49]]){delete _0xbc08x10[_0x6f67[113]][_0x6f67[49]]};var _0xbc08x17;return sequelize[_0x6f67[115]](function(_0xbc08x2f){return CustomReport[_0x6f67[51]](_0xbc08x10[_0x6f67[50]][_0x6f67[49]])[_0x6f67[22]](function(_0xbc08x19){if(!_0xbc08x19){return _0xbc08x11[_0x6f67[37]](404)};var _0xbc08x31=_[_0x6f67[119]](_0xbc08x19,_0xbc08x10[_0x6f67[113]]);return _0xbc08x19[_0x6f67[120]]({transaction:_0xbc08x2f})})[_0x6f67[22]](function(_0xbc08x19){_0xbc08x17= _0xbc08x19;if(_0xbc08x10[_0x6f67[113]][_0x6f67[116]]){return ReportField[_0x6f67[79]]({where:{CustomReportId:_0xbc08x10[_0x6f67[50]][_0x6f67[49]]},transaction:_0xbc08x2f})}})[_0x6f67[22]](function(){return [_0xbc08x17,_0xbc08x10[_0x6f67[113]][_0x6f67[116]]]})[_0x6f67[34]](createFields(_0xbc08x2f))})[_0x6f67[22]](function(){return _0xbc08x11[_0x6f67[37]](200)})[_0x6f67[19]](function(_0xbc08x13){return handleError(_0xbc08x11,_0xbc08x13)})};function createFields(_0xbc08x2f){return function(_0xbc08x19,_0xbc08x33){if(_0xbc08x33&& Array[_0x6f67[55]](_0xbc08x33)&& _0xbc08x33[_0x6f67[56]]){var _0xbc08x34=reportBuildUtils[_0x6f67[121]](_0xbc08x19[_0x6f67[44]]);if(_0xbc08x34){var _0xbc08x35;return _0xbc08x34[_0x6f67[134]]()[_0x6f67[22]](function(_0xbc08x3a){_0xbc08x35= _[_0x6f67[132]](_0xbc08x3a);return Metric[_0x6f67[133]]()})[_0x6f67[22]](function(_0xbc08x36){var _0xbc08x37=[];_0xbc08x36= _[_0x6f67[114]](_0xbc08x36,_0x6f67[45]);_0xbc08x33[_0x6f67[64]](function(_0xbc08x38){_0xbc08x38[_0x6f67[122]]= _0xbc08x19[_0x6f67[49]];if(_0xbc08x38[_0x6f67[123]]){var _0xbc08x39=_[_0x6f67[77]](_0xbc08x36,{id:_0xbc08x38[_0x6f67[123]]});if(_0xbc08x39){_0xbc08x38[_0x6f67[124]]= _0xbc08x39[_0x6f67[125]];_0xbc08x37[_0x6f67[80]](ReportField[_0x6f67[101]](_0xbc08x38,{transaction:_0xbc08x2f}))}else {throw  new sequelize.Error(_0x6f67[126]+ _0xbc08x38[_0x6f67[123]]+ _0x6f67[127])}}else {if(_[_0x6f67[128]](_0xbc08x35,_0xbc08x38[_0x6f67[124]])|| _0xbc08x38[_0x6f67[129]]){_0xbc08x37[_0x6f67[80]](ReportField[_0x6f67[101]](_0xbc08x38,{transaction:_0xbc08x2f}))}else {throw  new sequelize.Error(_0x6f67[130]+ _0xbc08x38[_0x6f67[124]]+ _0x6f67[131])}}});return _0xbc08x37})[_0x6f67[32]]()}else {throw  new sequelize.Error(_0x6f67[135])}}}}function createImportFields(_0xbc08x2f){return function(_0xbc08x19,_0xbc08x33){if(_0xbc08x33&& Array[_0x6f67[55]](_0xbc08x33)&& _0xbc08x33[_0x6f67[56]]){var _0xbc08x34=reportBuildUtils[_0x6f67[121]](_0xbc08x19[_0x6f67[44]]);if(_0xbc08x34){var _0xbc08x35;return _0xbc08x34[_0x6f67[134]]()[_0x6f67[22]](function(_0xbc08x3a){_0xbc08x35= _[_0x6f67[132]](_0xbc08x3a);var _0xbc08x37=[];var _0xbc08x3c;if(_[_0x6f67[138]](_0xbc08x33,function(_0xbc08x38){return _[_0x6f67[137]](_0xbc08x38,_0x6f67[136])})){_0xbc08x3c= _0x6f67[139]}else {if(_[_0x6f67[138]](_0xbc08x33,function(_0xbc08x38){return _[_0x6f67[137]](_0xbc08x38,_0x6f67[123])})){_0xbc08x3c= _0x6f67[7]}else {throw  new sequelize.Error(_0x6f67[140])}};var _0xbc08x3d=_[_0x6f67[142]](_0xbc08x33,_0xbc08x3c+ _0x6f67[141]);_[_0x6f67[63]](_0xbc08x3d,function(_0xbc08x3e,_0xbc08x1e){if(_0xbc08x1e!== _0x6f67[143]&& _0xbc08x1e!== _0x6f67[144]){_0xbc08x3e[0][_0xbc08x3c][_0x6f67[145]][_0x6f67[64]](function(_0xbc08x38){_0xbc08x38[_0x6f67[122]]= _0xbc08x19[_0x6f67[49]]});_0xbc08x3e[0][_0xbc08x3c][_0x6f67[94]]+= _0x6f67[146]+ sr({length:5});_0xbc08x37[_0x6f67[80]](Metric[_0x6f67[101]](_0xbc08x3e[0][_0xbc08x3c],{include:[{model:ReportField,as:_0x6f67[145]}],transaction:_0xbc08x2f}))}else {_0xbc08x3e[_0x6f67[64]](function(_0xbc08x38){if(_[_0x6f67[128]](_0xbc08x35,_0xbc08x38[_0x6f67[124]])|| _0xbc08x38[_0x6f67[129]]){_0xbc08x38[_0x6f67[122]]= _0xbc08x19[_0x6f67[49]];_0xbc08x37[_0x6f67[80]](ReportField[_0x6f67[101]](_0xbc08x38,{transaction:_0xbc08x2f}))}else {throw  new sequelize.Error(_0x6f67[130]+ _0xbc08x38[_0x6f67[124]]+ _0x6f67[131])}})}});return _0xbc08x37})[_0x6f67[32]]()}else {throw  new sequelize.Error(_0x6f67[135])}}}}exports[_0x6f67[79]]= function(_0xbc08x10,_0xbc08x11){return CustomReport[_0x6f67[51]](_0xbc08x10[_0x6f67[50]][_0x6f67[49]])[_0x6f67[22]](function(_0xbc08x19){if(!_0xbc08x19){return _0xbc08x11[_0x6f67[37]](404)};return _0xbc08x19[_0x6f67[79]]()})[_0x6f67[22]](function(){return _0xbc08x11[_0x6f67[37]](204)})[_0x6f67[19]](function(_0xbc08x13){return handleError(_0xbc08x11,_0xbc08x13)})};exports[_0x6f67[147]]= function(_0xbc08x10,_0xbc08x11){return CustomReport[_0x6f67[79]]({where:{id:_0xbc08x10[_0x6f67[23]][_0x6f67[148]]},individualHooks:true})[_0x6f67[22]](function(){return _0xbc08x11[_0x6f67[37]](204)})[_0x6f67[19]](function(_0xbc08x13){return handleError(_0xbc08x11,_0xbc08x13)})};function handleError(_0xbc08x11,_0xbc08x13){logger[_0x6f67[29]](_0xbc08x13[_0x6f67[28]]);return _0xbc08x11[_0x6f67[21]](500)[_0x6f67[20]](_0xbc08x13)}