Built motion from commit 2239aeb.|0.0.113
[motion.git] / server / api / custom_report / custom_report.controller.js
1 var _0xa54e=["\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","\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","\x6C\x6F\x67","\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","\x66\x6F\x75\x6E\x64\x20\x72\x65\x70\x6F\x72\x74","\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","\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","\x53\x45\x4C\x45\x43\x54","\x51\x75\x65\x72\x79\x54\x79\x70\x65\x73","\x65\x78\x74\x72\x61\x63\x74\x50\x64\x66","\x50\x44\x46","\x65\x78\x74\x72\x61\x63\x74\x43\x73\x76","\x43\x53\x56","\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","\x65\x72\x72\x6F\x72","\x63\x68\x69\x6C\x64\x20\x65\x72\x72\x6F\x72","\x6F\x6E","\x63\x6C\x6F\x73\x65","\x63\x68\x69\x6C\x64\x20\x63\x6C\x6F\x73\x65","\x6D\x65\x73\x73\x61\x67\x65","\x63\x68\x69\x6C\x64\x20\x6D\x65\x73\x73\x61\x67\x65","\x6B\x69\x6C\x6C","\x6E\x61\x6D\x65","\x63\x72\x65\x61\x74\x65","\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","\x70\x61\x72\x65\x6E\x74","\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","\x64\x65\x73\x74\x72\x6F\x79","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x69\x73\x41\x72\x72\x61\x79","\x43\x75\x73\x74\x6F\x6D\x52\x65\x70\x6F\x72\x74\x49\x64","\x4D\x65\x74\x72\x69\x63\x49\x64","\x66\x69\x6E\x64","\x66\x69\x65\x6C\x64","\x6D\x65\x74\x72\x69\x63","\x70\x75\x73\x68","\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","\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","\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","\x52\x65\x70\x6F\x72\x74\x41\x67\x65\x6E\x74\x48\x69\x73\x74\x6F\x72\x79","\x68\x69\x73\x74\x6F\x72\x79","\x72\x65\x70\x6F\x72\x74\x5F\x61\x67\x65\x6E\x74\x5F\x68\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x4D\x61\x69\x6C\x53\x65\x73\x73\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x72\x65\x70\x6F\x72\x74\x5F\x6D\x61\x69\x6C\x5F\x73\x65\x73\x73\x69\x6F\x6E\x5F\x68\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x51\x75\x65\x75\x65\x48\x69\x73\x74\x6F\x72\x79","\x72\x65\x70\x6F\x72\x74\x5F\x71\x75\x65\x75\x65\x5F\x68\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x43\x68\x61\x74\x53\x65\x73\x73\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x72\x65\x70\x6F\x72\x74\x5F\x63\x68\x61\x74\x5F\x73\x65\x73\x73\x69\x6F\x6E\x5F\x68\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x43\x61\x6C\x6C\x48\x69\x73\x74\x6F\x72\x79","\x72\x65\x70\x6F\x72\x74\x5F\x63\x61\x6C\x6C\x5F\x68\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x4D\x65\x6D\x62\x65\x72\x48\x69\x73\x74\x6F\x72\x79","\x72\x65\x70\x6F\x72\x74\x5F\x6D\x65\x6D\x62\x65\x72\x5F\x68\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x72\x65\x70\x6F\x72\x74\x5F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x5F\x68\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x53\x6D\x73\x53\x65\x73\x73\x69\x6F\x6E\x48\x69\x73\x74\x6F\x72\x79","\x72\x65\x70\x6F\x72\x74\x5F\x73\x6D\x73\x5F\x73\x65\x73\x73\x69\x6F\x6E\x5F\x68\x69\x73\x74\x6F\x72\x79","\x43\x6F\x6E\x74\x61\x63\x74","\x63\x6D\x5F\x63\x6F\x6E\x74\x61\x63\x74\x73","\x56\x6F\x69\x63\x65\x52\x65\x63\x6F\x72\x64\x69\x6E\x67","\x76\x6F\x69\x63\x65\x5F\x72\x65\x63\x6F\x72\x64\x69\x6E\x67\x73","\x52\x65\x70\x6F\x72\x74\x53\x71\x75\x61\x72\x65\x48\x69\x73\x74\x6F\x72\x79","\x72\x65\x70\x6F\x72\x74\x5F\x73\x71\x75\x61\x72\x65\x5F\x68\x69\x73\x74\x6F\x72\x79","\x52\x65\x70\x6F\x72\x74\x53\x71\x75\x61\x72\x65\x44\x65\x74\x61\x69\x6C\x48\x69\x73\x74\x6F\x72\x79","\x72\x65\x70\x6F\x72\x74\x5F\x73\x71\x75\x61\x72\x65\x5F\x64\x65\x74\x61\x69\x6C\x73\x5F\x68\x69\x73\x74\x6F\x72\x79","\x55\x73\x65\x72","\x75\x73\x65\x72\x73","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x69\x64\x73"];_0xa54e[0];var _=require(_0xa54e[1]);var util=require(_0xa54e[2]);var sequelize=require(_0xa54e[4])[_0xa54e[3]];var CustomReport=require(_0xa54e[4])[_0xa54e[5]];var ReportField=require(_0xa54e[4])[_0xa54e[6]];var Metric=require(_0xa54e[4])[_0xa54e[7]];var ExtractedReport=require(_0xa54e[4])[_0xa54e[8]];var extractUtils=require(_0xa54e[9]);var reportBuildUtils=require(_0xa54e[10]);var Util=require(_0xa54e[11]);var sr=require(_0xa54e[12]);var moment=require(_0xa54e[13]);var cp=require(_0xa54e[14]);exports[_0xa54e[15]]= function(_0x1725xe,_0x1725xf,_0x1725x10){return CustomReport[_0xa54e[22]](Util[_0xa54e[21]](_0x1725xe[_0xa54e[20]]))[_0xa54e[19]](function(_0x1725x12){_0x1725xf[_0xa54e[18]](200)[_0xa54e[17]](_0x1725x12)})[_0xa54e[16]](function(_0x1725x11){return handleError(_0x1725xf,_0x1725x11)})};exports[_0xa54e[23]]= function(_0x1725xe,_0x1725xf){return Promise[_0xa54e[26]]([])[_0xa54e[19]](getQuery(_0x1725xe,_0x1725xf))[_0xa54e[19]](function(_0x1725x13){_0x1725xf[_0xa54e[18]](200)[_0xa54e[17]]({query:_0x1725x13})})[_0xa54e[16]](function(_0x1725x11){console[_0xa54e[25]](_0xa54e[24],_0x1725x11)})};function getQuery(_0x1725xe,_0x1725xf){var _0x1725x15;return function(){return CustomReport[_0xa54e[48]](_0xa54e[47])[_0xa54e[46]](_0x1725xe[_0xa54e[45]][_0xa54e[44]])[_0xa54e[19]](function(_0x1725x17){console[_0xa54e[25]](_0xa54e[31]);if(!_0x1725x17){return _0x1725xf[_0xa54e[32]](404)};if(_0x1725xe[_0xa54e[20]][_0xa54e[33]]&& _0x1725xe[_0xa54e[20]][_0xa54e[33]]=== _0xa54e[34]){_0x1725xe[_0xa54e[20]][_0xa54e[35]]= moment()[_0xa54e[37]](_0xa54e[36]);_0x1725xe[_0xa54e[20]][_0xa54e[38]]= moment()[_0xa54e[37]](_0xa54e[36]);_0x1725x17[_0xa54e[40]][_0xa54e[39]]= _0x1725x17[_0xa54e[40]][_0xa54e[39]][_0xa54e[43]](_0xa54e[41],_0xa54e[42])};delete _0x1725xe[_0xa54e[20]][_0xa54e[33]];_0x1725x15= _0x1725x17[_0xa54e[40]];return _0x1725x15[_0xa54e[39]]})[_0xa54e[19]](reportBuildUtils[_0xa54e[30]](_0x1725xe[_0xa54e[29]]))[_0xa54e[19]](function(_0x1725x16){return [_0x1725x16,_0x1725x15]})[_0xa54e[28]](reportBuildUtils[_0xa54e[27]](_0x1725xe[_0xa54e[20]]))}}exports[_0xa54e[49]]= function(_0x1725xe,_0x1725xf){var _0x1725x18;return Promise[_0xa54e[26]]([])[_0xa54e[19]](getQuery(_0x1725xe,_0x1725xf))[_0xa54e[19]](function(_0x1725x13){return _0x1725x13?sequelize[_0xa54e[20]](_0x1725x13,{type:sequelize[_0xa54e[60]][_0xa54e[59]]}):[]})[_0xa54e[19]](function(_0x1725x19){_0x1725x18= _0x1725x19[_0xa54e[50]];if(_0x1725xe[_0xa54e[20]][_0xa54e[51]]){_0x1725x19= _(_0x1725x19)[_0xa54e[55]](_0x1725xe[_0xa54e[20]][_0xa54e[54]]|| 0)[_0xa54e[53]](_0x1725xe[_0xa54e[20]][_0xa54e[51]])[_0xa54e[52]]()};_[_0xa54e[58]](_0x1725x19,function(_0x1725x1a){_[_0xa54e[57]](_0x1725x1a,function(_0x1725x1b,_0x1725x1c){if(_0x1725x1b instanceof  Date){_0x1725x1a[_0x1725x1c]= moment(_0x1725x1b)[_0xa54e[37]](_0xa54e[56]).toString()}})});_0x1725xf[_0xa54e[18]](200)[_0xa54e[17]]({rows:_0x1725x19,count:_0x1725x18})})[_0xa54e[16]](function(_0x1725x11){console[_0xa54e[25]](_0x1725x11);return handleError(_0x1725xf,_0x1725x11)})};exports[_0xa54e[61]]= function(_0x1725xe,_0x1725xf){docExtract(_0x1725xe,_0x1725xf,_0xa54e[62])};exports[_0xa54e[63]]= function(_0x1725xe,_0x1725xf){docExtract(_0x1725xe,_0x1725xf,_0xa54e[64])};function docExtract(_0x1725xe,_0x1725xf,_0x1725x1e){CustomReport[_0xa54e[48]](_0xa54e[47])[_0xa54e[46]](_0x1725xe[_0xa54e[45]][_0xa54e[44]])[_0xa54e[19]](function(_0x1725x17){if(!_0x1725x17){return _0x1725xf[_0xa54e[32]](404)};if(_0x1725xe[_0xa54e[20]][_0xa54e[33]]&& _0x1725xe[_0xa54e[20]][_0xa54e[33]]=== _0xa54e[34]){_0x1725xe[_0xa54e[20]][_0xa54e[35]]= moment()[_0xa54e[37]](_0xa54e[36]);_0x1725xe[_0xa54e[20]][_0xa54e[38]]= moment()[_0xa54e[37]](_0xa54e[36]);_0x1725x17[_0xa54e[40]][_0xa54e[39]]= _0x1725x17[_0xa54e[40]][_0xa54e[39]][_0xa54e[43]](_0xa54e[41],_0xa54e[42])};delete _0x1725xe[_0xa54e[20]][_0xa54e[33]];return [_0x1725x17,ExtractedReport[_0xa54e[76]]({name:_0x1725x17[_0xa54e[75]],startDate:_0x1725xe[_0xa54e[20]][_0xa54e[35]]|| null,endDate:_0x1725xe[_0xa54e[20]][_0xa54e[38]]|| null,output:_0x1725x1e,UserId:_0x1725xe[_0xa54e[29]][_0xa54e[44]]})]})[_0xa54e[28]](function(_0x1725x17,_0x1725x1f){var _0x1725x20=cp[_0xa54e[66]](__dirname+ _0xa54e[65]);_0x1725x20[_0xa54e[69]](_0xa54e[72],function(_0x1725x21){console[_0xa54e[25]](_0xa54e[73],_0x1725x21);_0x1725x20[_0xa54e[74]]()})[_0xa54e[69]](_0xa54e[70],function(){console[_0xa54e[25]](_0xa54e[71])})[_0xa54e[69]](_0xa54e[67],function(_0x1725x11){console[_0xa54e[25]](_0xa54e[68],_0x1725x11)});_0x1725x20[_0xa54e[17]]({report:_0x1725x17,query:_0x1725xe[_0xa54e[20]],extractedId:_0x1725x1f[_0xa54e[44]],user:_0x1725xe[_0xa54e[29]],type:_0x1725x1e})})[_0xa54e[16]](function(_0x1725x11){console[_0xa54e[25]](_0x1725x11);return handleError(_0x1725xf,_0x1725x11)});return _0x1725xf[_0xa54e[32]](200)}exports[_0xa54e[77]]= function(_0x1725xe,_0x1725xf){return CustomReport[_0xa54e[48]](_0xa54e[47])[_0xa54e[46]](_0x1725xe[_0xa54e[45]][_0xa54e[44]])[_0xa54e[19]](function(_0x1725x17){if(!_0x1725x17){return _0x1725xf[_0xa54e[32]](404)};return _0x1725xf[_0xa54e[17]](_0x1725x17)})[_0xa54e[16]](function(_0x1725x11){return handleError(_0x1725xf,_0x1725x11)})};exports[_0xa54e[78]]= function(_0x1725xe,_0x1725xf){return CustomReport[_0xa54e[48]]({method:[_0xa54e[82],{CustomReportId:_0x1725xe[_0xa54e[45]][_0xa54e[44]]}]})[_0xa54e[46]](_0x1725xe[_0xa54e[45]][_0xa54e[44]],{attributes:[_0xa54e[79],_0xa54e[80],_0xa54e[75],_0xa54e[81],_0xa54e[39]]})[_0xa54e[19]](function(_0x1725x17){if(!_0x1725x17){return _0x1725xf[_0xa54e[32]](404)};return _0x1725xf[_0xa54e[17]](_0x1725x17)})[_0xa54e[16]](function(_0x1725x11){return handleError(_0x1725xf,_0x1725x11)})};exports[_0xa54e[83]]= function(_0x1725xe,_0x1725xf){var _0x1725x22;return sequelize[_0xa54e[88]](function(_0x1725x23){return CustomReport[_0xa54e[48]](_0xa54e[47])[_0xa54e[46]](_0x1725xe[_0xa54e[45]][_0xa54e[44]])[_0xa54e[19]](function(_0x1725x17){if(!_0x1725x17){return _0x1725xf[_0xa54e[32]](404)};var _0x1725x24=_0x1725x17[_0xa54e[40]];delete _0x1725x24[_0xa54e[44]];delete _0x1725x24[_0xa54e[84]];delete _0x1725x24[_0xa54e[85]];_0x1725x24[_0xa54e[81]]= _0x1725xe[_0xa54e[86]][_0xa54e[81]];_0x1725x22= _[_0xa54e[87]](_0x1725x24.Fields,_0xa54e[40]);return CustomReport[_0xa54e[76]](_0x1725x24,{transaction:_0x1725x23})})[_0xa54e[19]](function(_0x1725x17){return [_0x1725x17,_0x1725x22]})[_0xa54e[28]](createFields(_0x1725x23))})[_0xa54e[19]](function(){return _0x1725xf[_0xa54e[32]](201)})[_0xa54e[16]](function(_0x1725x11){console[_0xa54e[25]](_0x1725x11);return handleError(_0x1725xf,_0x1725x11)})};exports[_0xa54e[76]]= function(_0x1725xe,_0x1725xf){var _0x1725x15;return sequelize[_0xa54e[88]](function(_0x1725x23){return CustomReport[_0xa54e[76]](_0x1725xe[_0xa54e[86]],{transaction:_0x1725x23})[_0xa54e[19]](function(_0x1725x17){_0x1725x15= _0x1725x17;return [_0x1725x15,_0x1725xe[_0xa54e[86]][_0xa54e[89]]]})[_0xa54e[28]](createFields(_0x1725x23))})[_0xa54e[19]](function(){return _0x1725xf[_0xa54e[18]](201)[_0xa54e[17]](_0x1725x15)})[_0xa54e[16]](function(_0x1725x11){console[_0xa54e[25]](_0x1725x11);return handleError(_0x1725xf,_0x1725x11)})};exports[_0xa54e[90]]= function(_0x1725xe,_0x1725xf){var _0x1725x15;return sequelize[_0xa54e[88]](function(_0x1725x23){return CustomReport[_0xa54e[76]](_0x1725xe[_0xa54e[86]],{transaction:_0x1725x23})[_0xa54e[19]](function(_0x1725x17){_0x1725x15= _0x1725x17;return [_0x1725x15,_0x1725xe[_0xa54e[86]][_0xa54e[89]]]})[_0xa54e[28]](createImportFields(_0x1725x23))})[_0xa54e[19]](function(){return _0x1725xf[_0xa54e[18]](201)[_0xa54e[17]](_0x1725x15)})[_0xa54e[16]](function(_0x1725x11){console[_0xa54e[25]](_0x1725x11);return handleError(_0x1725xf,_0x1725x11)})};exports[_0xa54e[91]]= function(_0x1725xe,_0x1725xf,_0x1725x10){if(_0x1725xe[_0xa54e[86]][_0xa54e[44]]){delete _0x1725xe[_0xa54e[86]][_0xa54e[44]]};var _0x1725x15;return sequelize[_0xa54e[88]](function(_0x1725x23){return CustomReport[_0xa54e[46]](_0x1725xe[_0xa54e[45]][_0xa54e[44]])[_0xa54e[19]](function(_0x1725x17){if(!_0x1725x17){return _0x1725xf[_0xa54e[32]](404)};var _0x1725x25=_[_0xa54e[93]](_0x1725x17,_0x1725xe[_0xa54e[86]]);return _0x1725x17[_0xa54e[94]]({transaction:_0x1725x23})})[_0xa54e[19]](function(_0x1725x17){_0x1725x15= _0x1725x17;if(_0x1725xe[_0xa54e[86]][_0xa54e[89]]){return ReportField[_0xa54e[92]]({where:{CustomReportId:_0x1725xe[_0xa54e[45]][_0xa54e[44]]},transaction:_0x1725x23})}})[_0xa54e[19]](function(){return [_0x1725x15,_0x1725xe[_0xa54e[86]][_0xa54e[89]]]})[_0xa54e[28]](createFields(_0x1725x23))})[_0xa54e[19]](function(){return _0x1725xf[_0xa54e[32]](200)})[_0xa54e[16]](function(_0x1725x11){console[_0xa54e[25]](_0x1725x11);return handleError(_0x1725xf,_0x1725x11)})};function createFields(_0x1725x23){return function(_0x1725x17,_0x1725x27){if(_0x1725x27&& Array[_0xa54e[95]](_0x1725x27)&& _0x1725x27[_0xa54e[50]]){var _0x1725x28=getTable(_0x1725x17[_0xa54e[39]]);if(_0x1725x28){var _0x1725x29;return _0x1725x28[_0xa54e[109]]()[_0xa54e[19]](function(_0x1725x2e){_0x1725x29= _[_0xa54e[107]](_0x1725x2e);return Metric[_0xa54e[108]]()})[_0xa54e[19]](function(_0x1725x2a){var _0x1725x2b=[];_0x1725x2a= _[_0xa54e[87]](_0x1725x2a,_0xa54e[40]);_0x1725x27[_0xa54e[58]](function(_0x1725x2c){_0x1725x2c[_0xa54e[96]]= _0x1725x17[_0xa54e[44]];if(_0x1725x2c[_0xa54e[97]]){var _0x1725x2d=_[_0xa54e[98]](_0x1725x2a,{id:_0x1725x2c[_0xa54e[97]]});if(_0x1725x2d){_0x1725x2c[_0xa54e[99]]= _0x1725x2d[_0xa54e[100]];_0x1725x2b[_0xa54e[101]](ReportField[_0xa54e[76]](_0x1725x2c,{transaction:_0x1725x23}))}else {throw  new sequelize.Error(_0xa54e[102]+ _0x1725x2c[_0xa54e[97]]+ _0xa54e[103])}}else {if(_[_0xa54e[104]](_0x1725x29,_0x1725x2c[_0xa54e[99]])){_0x1725x2b[_0xa54e[101]](ReportField[_0xa54e[76]](_0x1725x2c,{transaction:_0x1725x23}))}else {throw  new sequelize.Error(_0xa54e[105]+ _0x1725x2c[_0xa54e[99]]+ _0xa54e[106])}}});return _0x1725x2b})[_0xa54e[26]]()}else {throw  new sequelize.Error(_0xa54e[110])}}}}function createImportFields(_0x1725x23){return function(_0x1725x17,_0x1725x27){if(_0x1725x27&& Array[_0xa54e[95]](_0x1725x27)&& _0x1725x27[_0xa54e[50]]){var _0x1725x28=getTable(_0x1725x17[_0xa54e[39]]);if(_0x1725x28){var _0x1725x29;return _0x1725x28[_0xa54e[109]]()[_0xa54e[19]](function(_0x1725x2e){_0x1725x29= _[_0xa54e[107]](_0x1725x2e);return Metric[_0xa54e[108]]()})[_0xa54e[19]](function(_0x1725x2a){var _0x1725x2b=[];var _0x1725x30=_[_0xa54e[111]](_0x1725x27,_0xa54e[97]);_[_0xa54e[57]](_0x1725x30,function(_0x1725x31,_0x1725x1c){if(_0x1725x1c!== _0xa54e[112]&& _0x1725x1c!== _0xa54e[113]){_0x1725x31[0][_0xa54e[7]][_0xa54e[114]][_0xa54e[58]](function(_0x1725x2c){_0x1725x2c[_0xa54e[96]]= _0x1725x17[_0xa54e[44]]});_0x1725x31[0][_0xa54e[7]][_0xa54e[75]]+= _0xa54e[115]+ sr({length:5});console[_0xa54e[25]](_0xa54e[100],_0x1725x31[0].Metric);_0x1725x2b[_0xa54e[101]](Metric[_0xa54e[76]](_0x1725x31[0].Metric,{include:[{model:ReportField,as:_0xa54e[114]}],transaction:_0x1725x23}))}else {_0x1725x31[_0xa54e[58]](function(_0x1725x2c){if(_[_0xa54e[104]](_0x1725x29,_0x1725x2c[_0xa54e[99]])){_0x1725x2c[_0xa54e[96]]= _0x1725x17[_0xa54e[44]];_0x1725x2b[_0xa54e[101]](ReportField[_0xa54e[76]](_0x1725x2c,{transaction:_0x1725x23}))}else {throw  new sequelize.Error(_0xa54e[105]+ _0x1725x2c[_0xa54e[99]]+ _0xa54e[106])}})}});return _0x1725x2b})[_0xa54e[26]]()}else {throw  new sequelize.Error(_0xa54e[110])}}}}function getTable(_0x1725x33){var _0x1725x28;switch(_0x1725x33){case _0xa54e[118]:_0x1725x28= require(_0xa54e[4])[_0xa54e[117]][_0xa54e[116]];break;case _0xa54e[120]:_0x1725x28= require(_0xa54e[4])[_0xa54e[117]][_0xa54e[119]];break;case _0xa54e[122]:_0x1725x28= require(_0xa54e[4])[_0xa54e[117]][_0xa54e[121]];break;case _0xa54e[124]:_0x1725x28= require(_0xa54e[4])[_0xa54e[117]][_0xa54e[123]];break;case _0xa54e[126]:_0x1725x28= require(_0xa54e[4])[_0xa54e[117]][_0xa54e[125]];break;case _0xa54e[128]:_0x1725x28= require(_0xa54e[4])[_0xa54e[117]][_0xa54e[127]];break;case _0xa54e[130]:_0x1725x28= require(_0xa54e[4])[_0xa54e[117]][_0xa54e[129]];break;case _0xa54e[132]:_0x1725x28= require(_0xa54e[4])[_0xa54e[117]][_0xa54e[131]];break;case _0xa54e[134]:_0x1725x28= require(_0xa54e[4])[_0xa54e[133]];break;case _0xa54e[136]:_0x1725x28= require(_0xa54e[4])[_0xa54e[135]];break;case _0xa54e[138]:_0x1725x28= require(_0xa54e[4])[_0xa54e[117]][_0xa54e[137]];break;case _0xa54e[140]:_0x1725x28= require(_0xa54e[4])[_0xa54e[117]][_0xa54e[139]];break;case _0xa54e[142]:_0x1725x28= require(_0xa54e[4])[_0xa54e[141]];break;default:};return _0x1725x28}exports[_0xa54e[92]]= function(_0x1725xe,_0x1725xf){return CustomReport[_0xa54e[46]](_0x1725xe[_0xa54e[45]][_0xa54e[44]])[_0xa54e[19]](function(_0x1725x17){if(!_0x1725x17){return _0x1725xf[_0xa54e[32]](404)};return _0x1725x17[_0xa54e[92]]()})[_0xa54e[19]](function(){return _0x1725xf[_0xa54e[32]](204)})[_0xa54e[16]](function(_0x1725x11){return handleError(_0x1725xf,_0x1725x11)})};exports[_0xa54e[143]]= function(_0x1725xe,_0x1725xf){return CustomReport[_0xa54e[92]]({where:{id:_0x1725xe[_0xa54e[20]][_0xa54e[144]]},individualHooks:true})[_0xa54e[19]](function(){return _0x1725xf[_0xa54e[32]](204)})[_0xa54e[16]](function(_0x1725x11){return handleError(_0x1725xf,_0x1725x11)})};function handleError(_0x1725xf,_0x1725x11){return _0x1725xf[_0xa54e[18]](500)[_0xa54e[17]](_0x1725x11)}