Built motion from commit 88d8eb5.|1.0.14
[motion.git] / server / api / custom_report / custom_report.controller.js
1 var _0x3d55=["\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","\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","\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","\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","\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","\x50\x44\x46","\x65\x78\x74\x72\x61\x63\x74\x43\x73\x76","\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","\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","\x70\x61\x72\x65\x6E\x74","\x6E\x61\x6D\x65","\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"];_0x3d55[0];var _=require(_0x3d55[1]);var util=require(_0x3d55[2]);var sequelize=require(_0x3d55[4])[_0x3d55[3]];var CustomReport=require(_0x3d55[4])[_0x3d55[5]];var ReportField=require(_0x3d55[4])[_0x3d55[6]];var Metric=require(_0x3d55[4])[_0x3d55[7]];var ExtractedReport=require(_0x3d55[4])[_0x3d55[8]];var extractUtils=require(_0x3d55[9]);var reportBuildUtils=require(_0x3d55[10]);var Util=require(_0x3d55[11]);var sr=require(_0x3d55[12]);var moment=require(_0x3d55[13]);var cp=require(_0x3d55[14]);var ReportTree=require(_0x3d55[4])[_0x3d55[15]];exports[_0x3d55[16]]= function(_0x2e99xf,_0x2e99x10,_0x2e99x11){return CustomReport[_0x3d55[23]](Util[_0x3d55[22]](_0x2e99xf[_0x3d55[21]],{deletedAt:null}))[_0x3d55[20]](function(_0x2e99x13){_0x2e99x10[_0x3d55[19]](200)[_0x3d55[18]](_0x2e99x13)})[_0x3d55[17]](function(_0x2e99x12){return handleError(_0x2e99x10,_0x2e99x12)})};exports[_0x3d55[24]]= function(_0x2e99xf,_0x2e99x10){return Promise[_0x3d55[29]]([])[_0x3d55[20]](getQuery(_0x2e99xf,_0x2e99x10))[_0x3d55[20]](function(_0x2e99x14){if(_0x2e99x14){switch(_0x2e99x14){case _0x3d55[28]:_0x2e99x14= _0x3d55[27];break;default:}};_0x2e99x10[_0x3d55[19]](200)[_0x3d55[18]]({query:_0x2e99x14})})[_0x3d55[17]](function(_0x2e99x12){console[_0x3d55[26]](_0x3d55[25],_0x2e99x12)})};function getQuery(_0x2e99xf,_0x2e99x10){var _0x2e99x16;return function(){return CustomReport[_0x3d55[51]](_0x3d55[50])[_0x3d55[49]](_0x2e99xf[_0x3d55[48]][_0x3d55[47]])[_0x3d55[20]](function(_0x2e99x18){console[_0x3d55[26]](_0x3d55[34]);if(!_0x2e99x18){return _0x2e99x10[_0x3d55[35]](404)};if(_0x2e99xf[_0x3d55[21]][_0x3d55[36]]&& _0x2e99xf[_0x3d55[21]][_0x3d55[36]]=== _0x3d55[37]){_0x2e99xf[_0x3d55[21]][_0x3d55[38]]= moment()[_0x3d55[40]](_0x3d55[39]);_0x2e99xf[_0x3d55[21]][_0x3d55[41]]= moment()[_0x3d55[40]](_0x3d55[39]);_0x2e99x18[_0x3d55[43]][_0x3d55[42]]= _0x2e99x18[_0x3d55[43]][_0x3d55[42]][_0x3d55[46]](_0x3d55[44],_0x3d55[45])};delete _0x2e99xf[_0x3d55[21]][_0x3d55[36]];_0x2e99x16= _0x2e99x18[_0x3d55[43]];return _0x2e99x16[_0x3d55[42]]})[_0x3d55[20]](reportBuildUtils[_0x3d55[33]](_0x2e99xf[_0x3d55[32]]))[_0x3d55[20]](function(_0x2e99x17){return [_0x2e99x17,_0x2e99x16]})[_0x3d55[31]](reportBuildUtils[_0x3d55[30]](_0x2e99xf[_0x3d55[21]]))}}exports[_0x3d55[52]]= function(_0x2e99xf,_0x2e99x10){var _0x2e99x19;return Promise[_0x3d55[29]]([])[_0x3d55[20]](getQuery(_0x2e99xf,_0x2e99x10))[_0x3d55[20]](reportBuildUtils[_0x3d55[64]]())[_0x3d55[20]](function(_0x2e99x1a){if(_0x2e99x1a&& _[_0x3d55[53]](_0x2e99x1a)){_0x2e99x19= _0x2e99x1a[_0x3d55[54]];if(_0x2e99xf[_0x3d55[21]][_0x3d55[55]]){_0x2e99x1a= _(_0x2e99x1a)[_0x3d55[59]](_0x2e99xf[_0x3d55[21]][_0x3d55[58]]|| 0)[_0x3d55[57]](_0x2e99xf[_0x3d55[21]][_0x3d55[55]])[_0x3d55[56]]()};_[_0x3d55[62]](_0x2e99x1a,function(_0x2e99x1b){_[_0x3d55[61]](_0x2e99x1b,function(_0x2e99x1c,_0x2e99x1d){if(_0x2e99x1c instanceof  Date){_0x2e99x1b[_0x2e99x1d]= moment(_0x2e99x1c)[_0x3d55[40]](_0x3d55[60]).toString()}})});_0x2e99x10[_0x3d55[19]](200)[_0x3d55[18]]({rows:_0x2e99x1a,count:_0x2e99x19})}else {return handleError(_0x2e99x10,{message:_0x2e99x1a|| _0x3d55[63]})}})[_0x3d55[17]](function(_0x2e99x12){console[_0x3d55[26]](_0x2e99x12);return handleError(_0x2e99x10,_0x2e99x12)})};exports[_0x3d55[65]]= function(_0x2e99xf,_0x2e99x10){docExtract(_0x2e99xf,_0x2e99x10,_0x3d55[66])};exports[_0x3d55[67]]= function(_0x2e99xf,_0x2e99x10){docExtract(_0x2e99xf,_0x2e99x10,_0x3d55[68])};exports[_0x3d55[69]]= function(_0x2e99xf,_0x2e99x10){return ReportTree[_0x3d55[49]](2)[_0x3d55[20]](function(_0x2e99x1e){_0x2e99x1e= JSON[_0x3d55[71]](_0x2e99x1e[_0x3d55[70]]);var _0x2e99x1f=_[_0x3d55[72]](_0x2e99x1e,{id:_0x2e99xf[_0x3d55[48]][_0x3d55[47]]});if(!_0x2e99x1f){throw  new Error(_0x3d55[73])};var _0x2e99x20=[];findSubNodes(_0x2e99x1f,_0x2e99x1e,_0x2e99x20);return CustomReport[_0x3d55[74]]({where:{parent:_0x2e99x20},individualHooks:true})})[_0x3d55[20]](function(){return _0x2e99x10[_0x3d55[35]](200)})[_0x3d55[17]](function(_0x2e99x12){console[_0x3d55[26]](_0x2e99x12);return handleError(_0x2e99x10,_0x2e99x12)})};function findSubNodes(_0x2e99x1f,_0x2e99x1e,_0x2e99x22){_0x2e99x22[_0x3d55[75]](_0x2e99x1f[_0x3d55[47]]);var _0x2e99x23=_[_0x3d55[76]](_0x2e99x1e,{parent:_0x2e99x1f[_0x3d55[47]]});if(!_0x2e99x23||  !_0x2e99x23[_0x3d55[54]]){return};_[_0x3d55[62]](_0x2e99x23,function(_0x2e99x24){findSubNodes(_0x2e99x24,_0x2e99x1e,_0x2e99x22)})}function docExtract(_0x2e99xf,_0x2e99x10,_0x2e99x26){var _0x2e99x18;CustomReport[_0x3d55[51]](_0x3d55[50])[_0x3d55[49]](_0x2e99xf[_0x3d55[48]][_0x3d55[47]])[_0x3d55[20]](function(_0x2e99x16){if(!_0x2e99x16){return _0x2e99x10[_0x3d55[35]](404)};_0x2e99x18= _0x2e99x16;return ReportTree[_0x3d55[49]](2)})[_0x3d55[20]](function(_0x2e99x1e){_0x2e99x1e= JSON[_0x3d55[71]](_0x2e99x1e[_0x3d55[70]]);var _0x2e99x2a=_[_0x3d55[72]](_0x2e99x1e,{id:_0x2e99x18[_0x3d55[87]]});var _0x2e99x2b=getReportPath(_0x2e99x2a,_0x2e99x1e,_0x2e99x18[_0x3d55[88]]);if(_0x2e99xf[_0x3d55[21]][_0x3d55[36]]&& _0x2e99xf[_0x3d55[21]][_0x3d55[36]]=== _0x3d55[37]){_0x2e99xf[_0x3d55[21]][_0x3d55[38]]= moment()[_0x3d55[40]](_0x3d55[39]);_0x2e99xf[_0x3d55[21]][_0x3d55[41]]= moment()[_0x3d55[40]](_0x3d55[39]);_0x2e99x18[_0x3d55[43]][_0x3d55[42]]= _0x2e99x18[_0x3d55[43]][_0x3d55[42]][_0x3d55[46]](_0x3d55[44],_0x3d55[45])};delete _0x2e99xf[_0x3d55[21]][_0x3d55[36]];return [_0x2e99x18,ExtractedReport[_0x3d55[94]]({name:_0x2e99x2b,startDate:_0x2e99xf[_0x3d55[21]][_0x3d55[38]]?_0x2e99xf[_0x3d55[21]][_0x3d55[38]]+ (_0x2e99xf[_0x3d55[21]][_0x3d55[89]]?_0x3d55[90]+ _0x2e99xf[_0x3d55[21]][_0x3d55[89]]:_0x3d55[91]):null,endDate:_0x2e99xf[_0x3d55[21]][_0x3d55[41]]?_0x2e99xf[_0x3d55[21]][_0x3d55[41]]+ (_0x2e99xf[_0x3d55[21]][_0x3d55[92]]?_0x3d55[90]+ _0x2e99xf[_0x3d55[21]][_0x3d55[92]]:_0x3d55[93]):null,output:_0x2e99x26,UserId:_0x2e99xf[_0x3d55[32]][_0x3d55[47]]})]})[_0x3d55[31]](function(_0x2e99x18,_0x2e99x27){var _0x2e99x28=cp[_0x3d55[78]](__dirname+ _0x3d55[77]);_0x2e99x28[_0x3d55[81]](_0x3d55[84],function(_0x2e99x29){console[_0x3d55[26]](_0x3d55[85],_0x2e99x29);_0x2e99x28[_0x3d55[86]]()})[_0x3d55[81]](_0x3d55[82],function(){console[_0x3d55[26]](_0x3d55[83])})[_0x3d55[81]](_0x3d55[79],function(_0x2e99x12){console[_0x3d55[26]](_0x3d55[80],_0x2e99x12)});_0x2e99x28[_0x3d55[18]]({report:_0x2e99x18,query:_0x2e99xf[_0x3d55[21]],extractedId:_0x2e99x27[_0x3d55[47]],user:_0x2e99xf[_0x3d55[32]],type:_0x2e99x26})})[_0x3d55[17]](function(_0x2e99x12){console[_0x3d55[26]](_0x2e99x12);return handleError(_0x2e99x10,_0x2e99x12)});return _0x2e99x10[_0x3d55[35]](200)}function getReportPath(_0x2e99x2a,_0x2e99x1e,_0x2e99x2b){_0x2e99x2b= _0x2e99x2a[_0x3d55[95]]+ _0x3d55[96]+ _0x2e99x2b;if(_0x2e99x2a[_0x3d55[87]]=== _0x3d55[97]){return _0x2e99x2b}else {return getReportPath(_[_0x3d55[72]](_0x2e99x1e,{id:_0x2e99x2a[_0x3d55[87]]}),_0x2e99x1e,_0x2e99x2b)}}exports[_0x3d55[98]]= function(_0x2e99xf,_0x2e99x10){return CustomReport[_0x3d55[51]](_0x3d55[50])[_0x3d55[49]](_0x2e99xf[_0x3d55[48]][_0x3d55[47]])[_0x3d55[20]](function(_0x2e99x18){if(!_0x2e99x18){return _0x2e99x10[_0x3d55[35]](404)};return _0x2e99x10[_0x3d55[18]](_0x2e99x18)})[_0x3d55[17]](function(_0x2e99x12){return handleError(_0x2e99x10,_0x2e99x12)})};exports[_0x3d55[99]]= function(_0x2e99xf,_0x2e99x10){return CustomReport[_0x3d55[51]]({method:[_0x3d55[102],{CustomReportId:_0x2e99xf[_0x3d55[48]][_0x3d55[47]]}]})[_0x3d55[49]](_0x2e99xf[_0x3d55[48]][_0x3d55[47]],{attributes:[_0x3d55[100],_0x3d55[101],_0x3d55[88],_0x3d55[87],_0x3d55[42]]})[_0x3d55[20]](function(_0x2e99x18){if(!_0x2e99x18){return _0x2e99x10[_0x3d55[35]](404)};return _0x2e99x10[_0x3d55[18]](_0x2e99x18)})[_0x3d55[17]](function(_0x2e99x12){return handleError(_0x2e99x10,_0x2e99x12)})};exports[_0x3d55[103]]= function(_0x2e99xf,_0x2e99x10){var _0x2e99x2d;return sequelize[_0x3d55[108]](function(_0x2e99x2e){return CustomReport[_0x3d55[51]](_0x3d55[50])[_0x3d55[49]](_0x2e99xf[_0x3d55[48]][_0x3d55[47]])[_0x3d55[20]](function(_0x2e99x18){if(!_0x2e99x18){return _0x2e99x10[_0x3d55[35]](404)};var _0x2e99x2f=_0x2e99x18[_0x3d55[43]];delete _0x2e99x2f[_0x3d55[47]];delete _0x2e99x2f[_0x3d55[104]];delete _0x2e99x2f[_0x3d55[105]];_0x2e99x2f[_0x3d55[87]]= _0x2e99xf[_0x3d55[106]][_0x3d55[87]];_0x2e99x2d= _[_0x3d55[107]](_0x2e99x2f.Fields,_0x3d55[43]);return CustomReport[_0x3d55[94]](_0x2e99x2f,{transaction:_0x2e99x2e})})[_0x3d55[20]](function(_0x2e99x18){return [_0x2e99x18,_0x2e99x2d]})[_0x3d55[31]](createFields(_0x2e99x2e))})[_0x3d55[20]](function(){return _0x2e99x10[_0x3d55[35]](201)})[_0x3d55[17]](function(_0x2e99x12){console[_0x3d55[26]](_0x2e99x12);return handleError(_0x2e99x10,_0x2e99x12)})};exports[_0x3d55[94]]= function(_0x2e99xf,_0x2e99x10){var _0x2e99x16;return sequelize[_0x3d55[108]](function(_0x2e99x2e){return CustomReport[_0x3d55[94]](_0x2e99xf[_0x3d55[106]],{transaction:_0x2e99x2e})[_0x3d55[20]](function(_0x2e99x18){_0x2e99x16= _0x2e99x18;return [_0x2e99x16,_0x2e99xf[_0x3d55[106]][_0x3d55[109]]]})[_0x3d55[31]](createFields(_0x2e99x2e))})[_0x3d55[20]](function(){return _0x2e99x10[_0x3d55[19]](201)[_0x3d55[18]](_0x2e99x16)})[_0x3d55[17]](function(_0x2e99x12){console[_0x3d55[26]](_0x2e99x12);return handleError(_0x2e99x10,_0x2e99x12)})};exports[_0x3d55[110]]= function(_0x2e99xf,_0x2e99x10){var _0x2e99x16;return sequelize[_0x3d55[108]](function(_0x2e99x2e){return CustomReport[_0x3d55[94]](_0x2e99xf[_0x3d55[106]],{transaction:_0x2e99x2e})[_0x3d55[20]](function(_0x2e99x18){_0x2e99x16= _0x2e99x18;return [_0x2e99x16,_0x2e99xf[_0x3d55[106]][_0x3d55[109]]]})[_0x3d55[31]](createImportFields(_0x2e99x2e))})[_0x3d55[20]](function(){return _0x2e99x10[_0x3d55[19]](201)[_0x3d55[18]](_0x2e99x16)})[_0x3d55[17]](function(_0x2e99x12){console[_0x3d55[26]](_0x2e99x12);return handleError(_0x2e99x10,_0x2e99x12)})};exports[_0x3d55[111]]= function(_0x2e99xf,_0x2e99x10,_0x2e99x11){if(_0x2e99xf[_0x3d55[106]][_0x3d55[47]]){delete _0x2e99xf[_0x3d55[106]][_0x3d55[47]]};var _0x2e99x16;return sequelize[_0x3d55[108]](function(_0x2e99x2e){return CustomReport[_0x3d55[49]](_0x2e99xf[_0x3d55[48]][_0x3d55[47]])[_0x3d55[20]](function(_0x2e99x18){if(!_0x2e99x18){return _0x2e99x10[_0x3d55[35]](404)};var _0x2e99x30=_[_0x3d55[112]](_0x2e99x18,_0x2e99xf[_0x3d55[106]]);return _0x2e99x18[_0x3d55[113]]({transaction:_0x2e99x2e})})[_0x3d55[20]](function(_0x2e99x18){_0x2e99x16= _0x2e99x18;if(_0x2e99xf[_0x3d55[106]][_0x3d55[109]]){return ReportField[_0x3d55[74]]({where:{CustomReportId:_0x2e99xf[_0x3d55[48]][_0x3d55[47]]},transaction:_0x2e99x2e})}})[_0x3d55[20]](function(){return [_0x2e99x16,_0x2e99xf[_0x3d55[106]][_0x3d55[109]]]})[_0x3d55[31]](createFields(_0x2e99x2e))})[_0x3d55[20]](function(){return _0x2e99x10[_0x3d55[35]](200)})[_0x3d55[17]](function(_0x2e99x12){console[_0x3d55[26]](_0x2e99x12);return handleError(_0x2e99x10,_0x2e99x12)})};function createFields(_0x2e99x2e){return function(_0x2e99x18,_0x2e99x32){if(_0x2e99x32&& Array[_0x3d55[53]](_0x2e99x32)&& _0x2e99x32[_0x3d55[54]]){var _0x2e99x33=reportBuildUtils[_0x3d55[114]](_0x2e99x18[_0x3d55[42]]);if(_0x2e99x33){var _0x2e99x34;return _0x2e99x33[_0x3d55[127]]()[_0x3d55[20]](function(_0x2e99x39){_0x2e99x34= _[_0x3d55[125]](_0x2e99x39);return Metric[_0x3d55[126]]()})[_0x3d55[20]](function(_0x2e99x35){var _0x2e99x36=[];_0x2e99x35= _[_0x3d55[107]](_0x2e99x35,_0x3d55[43]);_0x2e99x32[_0x3d55[62]](function(_0x2e99x37){_0x2e99x37[_0x3d55[115]]= _0x2e99x18[_0x3d55[47]];if(_0x2e99x37[_0x3d55[116]]){var _0x2e99x38=_[_0x3d55[72]](_0x2e99x35,{id:_0x2e99x37[_0x3d55[116]]});if(_0x2e99x38){_0x2e99x37[_0x3d55[117]]= _0x2e99x38[_0x3d55[118]];_0x2e99x36[_0x3d55[75]](ReportField[_0x3d55[94]](_0x2e99x37,{transaction:_0x2e99x2e}))}else {throw  new sequelize.Error(_0x3d55[119]+ _0x2e99x37[_0x3d55[116]]+ _0x3d55[120])}}else {if(_[_0x3d55[121]](_0x2e99x34,_0x2e99x37[_0x3d55[117]])|| _0x2e99x37[_0x3d55[122]]){_0x2e99x36[_0x3d55[75]](ReportField[_0x3d55[94]](_0x2e99x37,{transaction:_0x2e99x2e}))}else {throw  new sequelize.Error(_0x3d55[123]+ _0x2e99x37[_0x3d55[117]]+ _0x3d55[124])}}});return _0x2e99x36})[_0x3d55[29]]()}else {throw  new sequelize.Error(_0x3d55[128])}}}}function createImportFields(_0x2e99x2e){return function(_0x2e99x18,_0x2e99x32){if(_0x2e99x32&& Array[_0x3d55[53]](_0x2e99x32)&& _0x2e99x32[_0x3d55[54]]){var _0x2e99x33=reportBuildUtils[_0x3d55[114]](_0x2e99x18[_0x3d55[42]]);if(_0x2e99x33){var _0x2e99x34;return _0x2e99x33[_0x3d55[127]]()[_0x3d55[20]](function(_0x2e99x39){_0x2e99x34= _[_0x3d55[125]](_0x2e99x39);var _0x2e99x36=[];var _0x2e99x3b;if(_[_0x3d55[131]](_0x2e99x32,function(_0x2e99x37){return _[_0x3d55[130]](_0x2e99x37,_0x3d55[129])})){_0x2e99x3b= _0x3d55[132]}else {if(_[_0x3d55[131]](_0x2e99x32,function(_0x2e99x37){return _[_0x3d55[130]](_0x2e99x37,_0x3d55[116])})){_0x2e99x3b= _0x3d55[7]}else {throw  new sequelize.Error(_0x3d55[133])}};var _0x2e99x3c=_[_0x3d55[135]](_0x2e99x32,_0x2e99x3b+ _0x3d55[134]);_[_0x3d55[61]](_0x2e99x3c,function(_0x2e99x3d,_0x2e99x1d){if(_0x2e99x1d!== _0x3d55[136]&& _0x2e99x1d!== _0x3d55[137]){_0x2e99x3d[0][_0x2e99x3b][_0x3d55[138]][_0x3d55[62]](function(_0x2e99x37){_0x2e99x37[_0x3d55[115]]= _0x2e99x18[_0x3d55[47]]});_0x2e99x3d[0][_0x2e99x3b][_0x3d55[88]]+= _0x3d55[139]+ sr({length:5});_0x2e99x36[_0x3d55[75]](Metric[_0x3d55[94]](_0x2e99x3d[0][_0x2e99x3b],{include:[{model:ReportField,as:_0x3d55[138]}],transaction:_0x2e99x2e}))}else {_0x2e99x3d[_0x3d55[62]](function(_0x2e99x37){if(_[_0x3d55[121]](_0x2e99x34,_0x2e99x37[_0x3d55[117]])|| _0x2e99x37[_0x3d55[122]]){_0x2e99x37[_0x3d55[115]]= _0x2e99x18[_0x3d55[47]];_0x2e99x36[_0x3d55[75]](ReportField[_0x3d55[94]](_0x2e99x37,{transaction:_0x2e99x2e}))}else {throw  new sequelize.Error(_0x3d55[123]+ _0x2e99x37[_0x3d55[117]]+ _0x3d55[124])}})}});return _0x2e99x36})[_0x3d55[29]]()}else {throw  new sequelize.Error(_0x3d55[128])}}}}exports[_0x3d55[74]]= function(_0x2e99xf,_0x2e99x10){return CustomReport[_0x3d55[49]](_0x2e99xf[_0x3d55[48]][_0x3d55[47]])[_0x3d55[20]](function(_0x2e99x18){if(!_0x2e99x18){return _0x2e99x10[_0x3d55[35]](404)};return _0x2e99x18[_0x3d55[74]]()})[_0x3d55[20]](function(){return _0x2e99x10[_0x3d55[35]](204)})[_0x3d55[17]](function(_0x2e99x12){return handleError(_0x2e99x10,_0x2e99x12)})};exports[_0x3d55[140]]= function(_0x2e99xf,_0x2e99x10){return CustomReport[_0x3d55[74]]({where:{id:_0x2e99xf[_0x3d55[21]][_0x3d55[141]]},individualHooks:true})[_0x3d55[20]](function(){return _0x2e99x10[_0x3d55[35]](204)})[_0x3d55[17]](function(_0x2e99x12){return handleError(_0x2e99x10,_0x2e99x12)})};function handleError(_0x2e99x10,_0x2e99x12){return _0x2e99x10[_0x3d55[19]](500)[_0x3d55[18]](_0x2e99x12)}