Built motion from commit f74363e9.|2.6.34
[motion2.git] / server / api / analyticMetric / analyticMetric.controller.js
index 1f26f08..3ec612c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1edf67,_0x192956){var _0x48ce6f=function(_0x273b05){while(--_0x273b05){_0x1edf67['push'](_0x1edf67['shift']());}};_0x48ce6f(++_0x192956);}(_0xf2ca,0x16a));var _0xaf2c=function(_0xe51596,_0x314d5b){_0xe51596=_0xe51596-0x0;var _0x22c705=_0xf2ca[_0xe51596];return _0x22c705;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));};
\ No newline at end of file
+var _0x81bd=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','AnalyticMetric','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Metrics','stack','name','send','index','map','fieldName','query','keys'];(function(_0x2849d7,_0x1f66d7){var _0x3514da=function(_0x2c596a){while(--_0x2c596a){_0x2849d7['push'](_0x2849d7['shift']());}};_0x3514da(++_0x1f66d7);}(_0x81bd,0x7c));var _0xd81b=function(_0x45ff81,_0x3cb624){_0x45ff81=_0x45ff81-0x0;var _0x1abf39=_0x81bd[_0x45ff81];return _0x1abf39;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xcc;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x1b')](_0x57f71d);}return _0x21dfff['status'](_0x57f71d)[_0xd81b('0x1c')]();};}function respondWithResult(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0xc8;return function(_0x41bf7a){if(_0x41bf7a){return _0x47dd04[_0xd81b('0x1d')](_0x13dd00)[_0xd81b('0x1e')](_0x41bf7a);}};}function respondWithFilteredResult(_0x128162,_0x552215){return function(_0x1c620d){if(_0x1c620d){var _0x27b7a0=typeof _0x552215['offset']===_0xd81b('0x1f')&&typeof _0x552215[_0xd81b('0x20')]===_0xd81b('0x1f');var _0x15e860=_0x1c620d[_0xd81b('0x21')];var _0xc49b8d=_0x27b7a0?0x0:_0x552215[_0xd81b('0x22')];var _0x3d4d34=_0x27b7a0?_0x1c620d[_0xd81b('0x21')]:_0x552215[_0xd81b('0x22')]+_0x552215[_0xd81b('0x20')];var _0x453952;if(_0x3d4d34>=_0x15e860){_0x3d4d34=_0x15e860;_0x453952=0xc8;}else{_0x453952=0xce;}_0x128162[_0xd81b('0x1d')](_0x453952);return _0x128162[_0xd81b('0x23')](_0xd81b('0x24'),_0xc49b8d+'-'+_0x3d4d34+'/'+_0x15e860)[_0xd81b('0x1e')](_0x1c620d);}return null;};}function patchUpdates(_0x5f101a){return function(_0x4d566e){try{jsonpatch[_0xd81b('0x25')](_0x4d566e,_0x5f101a,!![]);}catch(_0x1b7876){return BPromise[_0xd81b('0x26')](_0x1b7876);}return _0x4d566e['save']();};}function saveUpdates(_0x19ed0e,_0x6571a6){return function(_0x542ee2){if(_0x542ee2){return _0x542ee2[_0xd81b('0x27')](_0x19ed0e)[_0xd81b('0x28')](function(_0x1670cd){return _0x1670cd;});}return null;};}function removeEntity(_0x1ad65c,_0x279176){return function(_0xcb4f91){if(_0xcb4f91){return _0xcb4f91[_0xd81b('0x29')]()[_0xd81b('0x28')](function(){var _0x341aec=_0xcb4f91[_0xd81b('0x2a')]({'plain':!![]});var _0x2ccedf=_0xd81b('0x2b');return db['UserProfileResource'][_0xd81b('0x29')]({'where':{'type':_0x2ccedf,'resourceId':_0x341aec['id']}})[_0xd81b('0x28')](function(){return _0xcb4f91;});})[_0xd81b('0x28')](function(){_0x1ad65c[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();});}};}function handleEntityNotFound(_0x2d0d02,_0x3e28dd){return function(_0x73dc09){if(!_0x73dc09){_0x2d0d02[_0xd81b('0x1b')](0x194);}return _0x73dc09;};}function handleError(_0x483a3d,_0x469cc4){_0x469cc4=_0x469cc4||0x1f4;return function(_0x4e2eff){logger['error'](_0x4e2eff[_0xd81b('0x2c')]);if(_0x4e2eff[_0xd81b('0x2d')]){delete _0x4e2eff['name'];}_0x483a3d['status'](_0x469cc4)[_0xd81b('0x2e')](_0x4e2eff);};}exports[_0xd81b('0x2f')]=function(_0x1b1434,_0x289f54){var _0x1a1572={},_0x4654ba={},_0x5527ed={'count':0x0,'rows':[]};var _0x37d381=_[_0xd81b('0x30')](db['AnalyticMetric']['rawAttributes'],function(_0x165892){return{'name':_0x165892[_0xd81b('0x31')],'type':_0x165892['type']['key']};});_0x4654ba['model']=_[_0xd81b('0x30')](_0x37d381,_0xd81b('0x2d'));_0x4654ba[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x1b1434[_0xd81b('0x32')]);_0x4654ba[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x4654ba['model'],_0x4654ba[_0xd81b('0x32')]);_0x1a1572['attributes']=_[_0xd81b('0x35')](_0x4654ba[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x37')]));_0x1a1572[_0xd81b('0x38')]=_0x1a1572[_0xd81b('0x38')][_0xd81b('0x39')]?_0x1a1572[_0xd81b('0x38')]:_0x4654ba[_0xd81b('0x36')];if(!_0x1b1434[_0xd81b('0x32')][_0xd81b('0x3a')](_0xd81b('0x3b'))){_0x1a1572['limit']=qs['limit'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x20')]);_0x1a1572[_0xd81b('0x22')]=qs['offset'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x22')]);}_0x1a1572['order']=qs[_0xd81b('0x3c')](_0x1b1434[_0xd81b('0x32')]['sort']);_0x1a1572[_0xd81b('0x3d')]=qs['filters'](_[_0xd81b('0x3e')](_0x1b1434[_0xd81b('0x32')],_0x4654ba[_0xd81b('0x34')]),_0x37d381);if(_0x1b1434[_0xd81b('0x32')]['filter']){_0x1a1572[_0xd81b('0x3d')]=_[_0xd81b('0x3f')](_0x1a1572[_0xd81b('0x3d')],{'$or':_[_0xd81b('0x30')](_0x37d381,function(_0x3abd60){if(_0x3abd60[_0xd81b('0x40')]!==_0xd81b('0x41')){var _0x532ada={};_0x532ada[_0x3abd60[_0xd81b('0x2d')]]={'$like':'%'+_0x1b1434[_0xd81b('0x32')][_0xd81b('0x42')]+'%'};return _0x532ada;}})});}_0x1a1572=_['merge']({},_0x1a1572,_0x1b1434[_0xd81b('0x43')]);var _0x3a05f4={'where':_0x1a1572[_0xd81b('0x3d')]};return db[_0xd81b('0x44')][_0xd81b('0x21')](_0x3a05f4)['then'](function(_0x3dfba7){_0x5527ed[_0xd81b('0x21')]=_0x3dfba7;if(_0x1b1434[_0xd81b('0x32')][_0xd81b('0x45')]){_0x1a1572[_0xd81b('0x46')]=[{'all':!![]}];}return db[_0xd81b('0x44')][_0xd81b('0x47')](_0x1a1572);})[_0xd81b('0x28')](function(_0x4405a8){_0x5527ed[_0xd81b('0x48')]=_0x4405a8;return _0x5527ed;})[_0xd81b('0x28')](respondWithFilteredResult(_0x289f54,_0x1a1572))['catch'](handleError(_0x289f54,null));};exports[_0xd81b('0x49')]=function(_0x2778b3,_0x25824e){var _0xa5e391={'raw':!![],'where':{'id':_0x2778b3[_0xd81b('0x4a')]['id']}},_0x1e6654={};_0x1e6654[_0xd81b('0x36')]=_[_0xd81b('0x33')](db['AnalyticMetric']['rawAttributes']);_0x1e6654[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x2778b3[_0xd81b('0x32')]);_0x1e6654[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],_0x1e6654[_0xd81b('0x32')]);_0xa5e391[_0xd81b('0x38')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x2778b3[_0xd81b('0x32')]['fields']));_0xa5e391[_0xd81b('0x38')]=_0xa5e391[_0xd81b('0x38')][_0xd81b('0x39')]?_0xa5e391[_0xd81b('0x38')]:_0x1e6654[_0xd81b('0x36')];if(_0x2778b3[_0xd81b('0x32')][_0xd81b('0x45')]){_0xa5e391[_0xd81b('0x46')]=[{'all':!![]}];}_0xa5e391=_[_0xd81b('0x3f')]({},_0xa5e391,_0x2778b3['options']);return db[_0xd81b('0x44')][_0xd81b('0x4b')](_0xa5e391)[_0xd81b('0x28')](handleEntityNotFound(_0x25824e,null))[_0xd81b('0x28')](respondWithResult(_0x25824e,null))['catch'](handleError(_0x25824e,null));};exports[_0xd81b('0x4c')]=function(_0x151127,_0x15030b){return db[_0xd81b('0x44')][_0xd81b('0x4c')](_0x151127[_0xd81b('0x4d')],{})[_0xd81b('0x28')](function(_0x43d7ce){var _0x133a76=_0x151127['user']['get']({'plain':!![]});if(!_0x133a76)throw new Error(_0xd81b('0x4e'));if(_0x133a76[_0xd81b('0x4f')]===_0xd81b('0x50')){var _0x4da281=_0x43d7ce[_0xd81b('0x2a')]({'plain':!![]});var _0x3d6ab3=_0xd81b('0x2b');return db[_0xd81b('0x51')]['find']({'where':{'name':_0x3d6ab3,'userProfileId':_0x133a76[_0xd81b('0x52')]},'raw':!![]})[_0xd81b('0x28')](function(_0x1b523c){if(_0x1b523c&&_0x1b523c[_0xd81b('0x53')]===0x0){return db[_0xd81b('0x54')]['create']({'name':_0x4da281[_0xd81b('0x2d')],'resourceId':_0x4da281['id'],'type':_0x1b523c[_0xd81b('0x2d')],'sectionId':_0x1b523c['id']},{})['then'](function(){return _0x43d7ce;});}else{return _0x43d7ce;}})[_0xd81b('0x55')](function(_0x315bd5){logger[_0xd81b('0x56')](_0xd81b('0x57'),_0x315bd5);throw _0x315bd5;});}return _0x43d7ce;})[_0xd81b('0x28')](respondWithResult(_0x15030b,0xc9))[_0xd81b('0x55')](handleError(_0x15030b,null));};exports[_0xd81b('0x27')]=function(_0x22f588,_0x3ed626){if(_0x22f588[_0xd81b('0x4d')]['id']){delete _0x22f588[_0xd81b('0x4d')]['id'];}return db['AnalyticMetric'][_0xd81b('0x4b')]({'where':{'id':_0x22f588['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x3ed626,null))[_0xd81b('0x28')](saveUpdates(_0x22f588[_0xd81b('0x4d')],null))[_0xd81b('0x28')](respondWithResult(_0x3ed626,null))[_0xd81b('0x55')](handleError(_0x3ed626,null));};exports[_0xd81b('0x29')]=function(_0x5c196a,_0x2d978d){return db[_0xd81b('0x44')]['find']({'where':{'id':_0x5c196a['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x2d978d,null))['then'](removeEntity(_0x2d978d,null))[_0xd81b('0x55')](handleError(_0x2d978d,null));};
\ No newline at end of file