Built motion from commit (unavailable).|2.5.12
[motion2.git] / server / api / analyticMetric / analyticMetric.controller.js
index 72b88ea..27a7c3f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x930f=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','then','UserProfileResource','error','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Metrics','UserProfileSection','userProfileId','autoAssociation','update','body','find','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','lodash','squel'];(function(_0x3ee6cf,_0x22de3a){var _0x5a0ca9=function(_0x4b16f7){while(--_0x4b16f7){_0x3ee6cf['push'](_0x3ee6cf['shift']());}};_0x5a0ca9(++_0x22de3a);}(_0x930f,0x12e));var _0xf930=function(_0x37b595,_0x34b8d3){_0x37b595=_0x37b595-0x0;var _0x56e3d9=_0x930f[_0x37b595];return _0x56e3d9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf930('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf930('0x1'));var jsonpatch=require(_0xf930('0x2'));var rp=require('request-promise');var moment=require(_0xf930('0x3'));var BPromise=require(_0xf930('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf930('0x5'));var sox=require('sox');var csv=require(_0xf930('0x6'));var ejs=require(_0xf930('0x7'));var fs=require('fs');var _=require(_0xf930('0x8'));var squel=require(_0xf930('0x9'));var crypto=require('crypto');var jsforce=require(_0xf930('0xa'));var deskjs=require(_0xf930('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf930('0xc'));var Papa=require(_0xf930('0xd'));var Redis=require(_0xf930('0xe'));var authService=require(_0xf930('0xf'));var qs=require(_0xf930('0x10'));var as=require(_0xf930('0x11'));var hardwareService=require(_0xf930('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xf930('0x13'))['db'];function respondWithStatusCode(_0x3508fd,_0xba921a){_0xba921a=_0xba921a||0xcc;return function(_0x39e73d){if(_0x39e73d){return _0x3508fd[_0xf930('0x14')](_0xba921a);}return _0x3508fd[_0xf930('0x15')](_0xba921a)[_0xf930('0x16')]();};}function respondWithResult(_0x29fd22,_0x4d89e6){_0x4d89e6=_0x4d89e6||0xc8;return function(_0x3ac247){if(_0x3ac247){return _0x29fd22[_0xf930('0x15')](_0x4d89e6)[_0xf930('0x17')](_0x3ac247);}};}function respondWithFilteredResult(_0x1e2236,_0x59dba8){return function(_0x174820){if(_0x174820){var _0x59b719=_0x174820[_0xf930('0x18')],_0xa00e0f=_0x59dba8['offset'],_0x2af95b=_0x59dba8[_0xf930('0x19')]+_0x59dba8[_0xf930('0x1a')],_0x394726;if(_0x2af95b>=_0x59b719){_0x2af95b=_0x59b719;_0x394726=0xc8;}else{_0x394726=0xce;}_0x1e2236['status'](_0x394726);return _0x1e2236['set'](_0xf930('0x1b'),_0xa00e0f+'-'+_0x2af95b+'/'+_0x59b719)['json'](_0x174820);}return null;};}function patchUpdates(_0x1cebfc){return function(_0x32f53f){try{jsonpatch[_0xf930('0x1c')](_0x32f53f,_0x1cebfc,!![]);}catch(_0x13e306){return BPromise[_0xf930('0x1d')](_0x13e306);}return _0x32f53f['save']();};}function saveUpdates(_0x6f9d24,_0x30a2a5){return function(_0x5672e5){if(_0x5672e5){return _0x5672e5['update'](_0x6f9d24)['then'](function(_0x1e85f0){return _0x1e85f0;});}return null;};}function removeEntity(_0xddc668,_0x3849bc){return function(_0x5acfb2){if(_0x5acfb2){return _0x5acfb2['destroy']()[_0xf930('0x1e')](function(){var _0x2a2fd9=_0x5acfb2['get']({'plain':!![]});var _0x3daa28='Metrics';return db[_0xf930('0x1f')]['destroy']({'where':{'type':_0x3daa28,'resourceId':_0x2a2fd9['id']}})['then'](function(){return _0x5acfb2;});})[_0xf930('0x1e')](function(){_0xddc668['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15ed93,_0x53fea6){return function(_0x536a33){if(!_0x536a33){_0x15ed93[_0xf930('0x14')](0x194);}return _0x536a33;};}function handleError(_0x31bd20,_0x434601){_0x434601=_0x434601||0x1f4;return function(_0x5b8f0e){logger[_0xf930('0x20')](_0x5b8f0e[_0xf930('0x21')]);if(_0x5b8f0e[_0xf930('0x22')]){delete _0x5b8f0e[_0xf930('0x22')];}_0x31bd20[_0xf930('0x15')](_0x434601)[_0xf930('0x23')](_0x5b8f0e);};}exports[_0xf930('0x24')]=function(_0x2ee7b6,_0x504bf4){var _0x2925e1={},_0x39943f={},_0xe92c16={'count':0x0,'rows':[]};var _0x28bdac=_['map'](db[_0xf930('0x25')][_0xf930('0x26')],function(_0x284210){return{'name':_0x284210[_0xf930('0x27')],'type':_0x284210[_0xf930('0x28')]['key']};});_0x39943f[_0xf930('0x29')]=_[_0xf930('0x2a')](_0x28bdac,_0xf930('0x22'));_0x39943f[_0xf930('0x2b')]=_[_0xf930('0x2c')](_0x2ee7b6[_0xf930('0x2b')]);_0x39943f[_0xf930('0x2d')]=_[_0xf930('0x2e')](_0x39943f['model'],_0x39943f[_0xf930('0x2b')]);_0x2925e1[_0xf930('0x2f')]=_[_0xf930('0x2e')](_0x39943f['model'],qs['fields'](_0x2ee7b6['query'][_0xf930('0x30')]));_0x2925e1[_0xf930('0x2f')]=_0x2925e1[_0xf930('0x2f')][_0xf930('0x31')]?_0x2925e1['attributes']:_0x39943f[_0xf930('0x29')];if(!_0x2ee7b6[_0xf930('0x2b')]['hasOwnProperty'](_0xf930('0x32'))){_0x2925e1[_0xf930('0x1a')]=qs[_0xf930('0x1a')](_0x2ee7b6['query'][_0xf930('0x1a')]);_0x2925e1[_0xf930('0x19')]=qs[_0xf930('0x19')](_0x2ee7b6[_0xf930('0x2b')]['offset']);}_0x2925e1[_0xf930('0x33')]=qs[_0xf930('0x34')](_0x2ee7b6[_0xf930('0x2b')][_0xf930('0x34')]);_0x2925e1[_0xf930('0x35')]=qs['filters'](_['pick'](_0x2ee7b6['query'],_0x39943f['filters']));if(_0x2ee7b6[_0xf930('0x2b')]['filter']){_0x2925e1[_0xf930('0x35')]=_[_0xf930('0x36')](_0x2925e1[_0xf930('0x35')],{'$or':_[_0xf930('0x2a')](_0x28bdac,function(_0x5e3a4f){if(_0x5e3a4f[_0xf930('0x28')]!==_0xf930('0x37')){var _0x2ea6d6={};_0x2ea6d6[_0x5e3a4f['name']]={'$like':'%'+_0x2ee7b6[_0xf930('0x2b')][_0xf930('0x38')]+'%'};return _0x2ea6d6;}})});}_0x2925e1=_[_0xf930('0x36')]({},_0x2925e1,_0x2ee7b6[_0xf930('0x39')]);var _0x1c5378={'where':_0x2925e1[_0xf930('0x35')]};return db[_0xf930('0x25')][_0xf930('0x18')](_0x1c5378)[_0xf930('0x1e')](function(_0x2e5328){_0xe92c16[_0xf930('0x18')]=_0x2e5328;if(_0x2ee7b6[_0xf930('0x2b')]['includeAll']){_0x2925e1[_0xf930('0x3a')]=[{'all':!![]}];}return db[_0xf930('0x25')][_0xf930('0x3b')](_0x2925e1);})[_0xf930('0x1e')](function(_0x5726bb){_0xe92c16[_0xf930('0x3c')]=_0x5726bb;return _0xe92c16;})[_0xf930('0x1e')](respondWithFilteredResult(_0x504bf4,_0x2925e1))[_0xf930('0x3d')](handleError(_0x504bf4,null));};exports[_0xf930('0x3e')]=function(_0x27b829,_0x314bea){var _0x1dff74={'raw':!![],'where':{'id':_0x27b829[_0xf930('0x3f')]['id']}},_0x2ef89a={};_0x2ef89a['model']=_['keys'](db[_0xf930('0x25')]['rawAttributes']);_0x2ef89a[_0xf930('0x2b')]=_[_0xf930('0x2c')](_0x27b829[_0xf930('0x2b')]);_0x2ef89a[_0xf930('0x2d')]=_['intersection'](_0x2ef89a[_0xf930('0x29')],_0x2ef89a[_0xf930('0x2b')]);_0x1dff74['attributes']=_[_0xf930('0x2e')](_0x2ef89a['model'],qs[_0xf930('0x30')](_0x27b829['query'][_0xf930('0x30')]));_0x1dff74['attributes']=_0x1dff74[_0xf930('0x2f')][_0xf930('0x31')]?_0x1dff74[_0xf930('0x2f')]:_0x2ef89a[_0xf930('0x29')];if(_0x27b829[_0xf930('0x2b')][_0xf930('0x40')]){_0x1dff74['include']=[{'all':!![]}];}_0x1dff74=_[_0xf930('0x36')]({},_0x1dff74,_0x27b829['options']);return db['AnalyticMetric']['find'](_0x1dff74)['then'](handleEntityNotFound(_0x314bea,null))['then'](respondWithResult(_0x314bea,null))[_0xf930('0x3d')](handleError(_0x314bea,null));};exports[_0xf930('0x41')]=function(_0x4d2112,_0xfbdb1){return db[_0xf930('0x25')][_0xf930('0x41')](_0x4d2112['body'],{})[_0xf930('0x1e')](function(_0x41084f){var _0x3a0832=_0x4d2112['user'][_0xf930('0x42')]({'plain':!![]});if(!_0x3a0832)throw new Error(_0xf930('0x43'));if(_0x3a0832[_0xf930('0x44')]===_0xf930('0x45')){var _0xce2acb=_0x41084f[_0xf930('0x42')]({'plain':!![]});var _0x5021cd=_0xf930('0x46');return db[_0xf930('0x47')]['find']({'where':{'name':_0x5021cd,'userProfileId':_0x3a0832[_0xf930('0x48')]},'raw':!![]})[_0xf930('0x1e')](function(_0x214352){if(_0x214352&&_0x214352[_0xf930('0x49')]===0x0){return db[_0xf930('0x1f')][_0xf930('0x41')]({'name':_0xce2acb[_0xf930('0x22')],'resourceId':_0xce2acb['id'],'type':_0x214352[_0xf930('0x22')],'sectionId':_0x214352['id']},{})[_0xf930('0x1e')](function(){return _0x41084f;});}else{return _0x41084f;}})['catch'](function(_0x4d4894){logger[_0xf930('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d4894);throw _0x4d4894;});}return _0x41084f;})[_0xf930('0x1e')](respondWithResult(_0xfbdb1,0xc9))[_0xf930('0x3d')](handleError(_0xfbdb1,null));};exports[_0xf930('0x4a')]=function(_0x36c76c,_0x1e0ffc){if(_0x36c76c[_0xf930('0x4b')]['id']){delete _0x36c76c[_0xf930('0x4b')]['id'];}return db[_0xf930('0x25')][_0xf930('0x4c')]({'where':{'id':_0x36c76c[_0xf930('0x3f')]['id']}})[_0xf930('0x1e')](handleEntityNotFound(_0x1e0ffc,null))[_0xf930('0x1e')](saveUpdates(_0x36c76c[_0xf930('0x4b')],null))[_0xf930('0x1e')](respondWithResult(_0x1e0ffc,null))[_0xf930('0x3d')](handleError(_0x1e0ffc,null));};exports[_0xf930('0x4d')]=function(_0x13bda4,_0xc80979){return db[_0xf930('0x25')][_0xf930('0x4c')]({'where':{'id':_0x13bda4['params']['id']}})[_0xf930('0x1e')](handleEntityNotFound(_0xc80979,null))[_0xf930('0x1e')](removeEntity(_0xc80979,null))['catch'](handleError(_0xc80979,null));};
\ No newline at end of file
+var _0x2725=['merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','then','Metrics','UserProfileResource','destroy','end','stack','name','send','index','map','AnalyticMetric','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x396b2b,_0x3f72f4){var _0x4c1b0d=function(_0x174e53){while(--_0x174e53){_0x396b2b['push'](_0x396b2b['shift']());}};_0x4c1b0d(++_0x3f72f4);}(_0x2725,0x105));var _0x5272=function(_0x45161c,_0x5494fc){_0x45161c=_0x45161c-0x0;var _0x186581=_0x2725[_0x45161c];return _0x186581;};'use strict';var pdf=require(_0x5272('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5272('0x1'));var jsonpatch=require(_0x5272('0x2'));var rp=require(_0x5272('0x3'));var moment=require(_0x5272('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5272('0x5'));var util=require('util');var path=require(_0x5272('0x6'));var sox=require(_0x5272('0x7'));var csv=require(_0x5272('0x8'));var ejs=require(_0x5272('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5272('0xa'));var jsforce=require(_0x5272('0xb'));var deskjs=require(_0x5272('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5272('0xd'));var Papa=require('papaparse');var Redis=require(_0x5272('0xe'));var authService=require(_0x5272('0xf'));var qs=require(_0x5272('0x10'));var as=require(_0x5272('0x11'));var hardwareService=require(_0x5272('0x12'));var logger=require(_0x5272('0x13'))(_0x5272('0x14'));var utils=require(_0x5272('0x15'));var config=require(_0x5272('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1de5e0,_0x5017ac){_0x5017ac=_0x5017ac||0xcc;return function(_0x1b7003){if(_0x1b7003){return _0x1de5e0[_0x5272('0x17')](_0x5017ac);}return _0x1de5e0[_0x5272('0x18')](_0x5017ac)['end']();};}function respondWithResult(_0x217329,_0x27b7e2){_0x27b7e2=_0x27b7e2||0xc8;return function(_0x47b486){if(_0x47b486){return _0x217329[_0x5272('0x18')](_0x27b7e2)[_0x5272('0x19')](_0x47b486);}};}function respondWithFilteredResult(_0x1a48ef,_0x395509){return function(_0x2a6072){if(_0x2a6072){var _0x15831f=_0x2a6072[_0x5272('0x1a')],_0x434b78=_0x395509['offset'],_0x5d9e83=_0x395509[_0x5272('0x1b')]+_0x395509[_0x5272('0x1c')],_0x5014a3;if(_0x5d9e83>=_0x15831f){_0x5d9e83=_0x15831f;_0x5014a3=0xc8;}else{_0x5014a3=0xce;}_0x1a48ef['status'](_0x5014a3);return _0x1a48ef[_0x5272('0x1d')](_0x5272('0x1e'),_0x434b78+'-'+_0x5d9e83+'/'+_0x15831f)[_0x5272('0x19')](_0x2a6072);}return null;};}function patchUpdates(_0x44fafe){return function(_0xb722ec){try{jsonpatch['apply'](_0xb722ec,_0x44fafe,!![]);}catch(_0x3a836a){return BPromise[_0x5272('0x1f')](_0x3a836a);}return _0xb722ec[_0x5272('0x20')]();};}function saveUpdates(_0x57b764,_0x137f1b){return function(_0x35ab2d){if(_0x35ab2d){return _0x35ab2d['update'](_0x57b764)[_0x5272('0x21')](function(_0x18384e){return _0x18384e;});}return null;};}function removeEntity(_0x296f1e,_0x4b6bdd){return function(_0x45ada9){if(_0x45ada9){return _0x45ada9['destroy']()['then'](function(){var _0x5513a3=_0x45ada9['get']({'plain':!![]});var _0x177e92=_0x5272('0x22');return db[_0x5272('0x23')][_0x5272('0x24')]({'where':{'type':_0x177e92,'resourceId':_0x5513a3['id']}})[_0x5272('0x21')](function(){return _0x45ada9;});})[_0x5272('0x21')](function(){_0x296f1e[_0x5272('0x18')](0xcc)[_0x5272('0x25')]();});}};}function handleEntityNotFound(_0x3144e1,_0x36e4c3){return function(_0x4c4d08){if(!_0x4c4d08){_0x3144e1['sendStatus'](0x194);}return _0x4c4d08;};}function handleError(_0x382a32,_0x5983d5){_0x5983d5=_0x5983d5||0x1f4;return function(_0x1651d3){logger['error'](_0x1651d3[_0x5272('0x26')]);if(_0x1651d3[_0x5272('0x27')]){delete _0x1651d3[_0x5272('0x27')];}_0x382a32[_0x5272('0x18')](_0x5983d5)[_0x5272('0x28')](_0x1651d3);};}exports[_0x5272('0x29')]=function(_0x182766,_0x530e3e){var _0x5a486d={},_0x21f28e={},_0x26b378={'count':0x0,'rows':[]};var _0x398004=_[_0x5272('0x2a')](db[_0x5272('0x2b')]['rawAttributes'],function(_0x41d111){return{'name':_0x41d111[_0x5272('0x2c')],'type':_0x41d111['type']['key']};});_0x21f28e['model']=_[_0x5272('0x2a')](_0x398004,_0x5272('0x27'));_0x21f28e[_0x5272('0x2d')]=_[_0x5272('0x2e')](_0x182766[_0x5272('0x2d')]);_0x21f28e[_0x5272('0x2f')]=_[_0x5272('0x30')](_0x21f28e[_0x5272('0x31')],_0x21f28e[_0x5272('0x2d')]);_0x5a486d[_0x5272('0x32')]=_[_0x5272('0x30')](_0x21f28e[_0x5272('0x31')],qs[_0x5272('0x33')](_0x182766[_0x5272('0x2d')]['fields']));_0x5a486d[_0x5272('0x32')]=_0x5a486d[_0x5272('0x32')][_0x5272('0x34')]?_0x5a486d['attributes']:_0x21f28e[_0x5272('0x31')];if(!_0x182766['query'][_0x5272('0x35')]('nolimit')){_0x5a486d[_0x5272('0x1c')]=qs[_0x5272('0x1c')](_0x182766['query'][_0x5272('0x1c')]);_0x5a486d[_0x5272('0x1b')]=qs[_0x5272('0x1b')](_0x182766['query']['offset']);}_0x5a486d[_0x5272('0x36')]=qs['sort'](_0x182766[_0x5272('0x2d')][_0x5272('0x37')]);_0x5a486d[_0x5272('0x38')]=qs[_0x5272('0x2f')](_[_0x5272('0x39')](_0x182766[_0x5272('0x2d')],_0x21f28e[_0x5272('0x2f')]),_0x398004);if(_0x182766[_0x5272('0x2d')][_0x5272('0x3a')]){_0x5a486d[_0x5272('0x38')]=_[_0x5272('0x3b')](_0x5a486d[_0x5272('0x38')],{'$or':_[_0x5272('0x2a')](_0x398004,function(_0x1673e8){if(_0x1673e8[_0x5272('0x3c')]!==_0x5272('0x3d')){var _0x4a9f43={};_0x4a9f43[_0x1673e8[_0x5272('0x27')]]={'$like':'%'+_0x182766[_0x5272('0x2d')][_0x5272('0x3a')]+'%'};return _0x4a9f43;}})});}_0x5a486d=_['merge']({},_0x5a486d,_0x182766[_0x5272('0x3e')]);var _0x4d9e42={'where':_0x5a486d[_0x5272('0x38')]};return db['AnalyticMetric'][_0x5272('0x1a')](_0x4d9e42)[_0x5272('0x21')](function(_0x464feb){_0x26b378['count']=_0x464feb;if(_0x182766[_0x5272('0x2d')][_0x5272('0x3f')]){_0x5a486d['include']=[{'all':!![]}];}return db[_0x5272('0x2b')]['findAll'](_0x5a486d);})['then'](function(_0x156166){_0x26b378[_0x5272('0x40')]=_0x156166;return _0x26b378;})[_0x5272('0x21')](respondWithFilteredResult(_0x530e3e,_0x5a486d))[_0x5272('0x41')](handleError(_0x530e3e,null));};exports[_0x5272('0x42')]=function(_0x2a3f3b,_0x58738b){var _0x529d0b={'raw':!![],'where':{'id':_0x2a3f3b[_0x5272('0x43')]['id']}},_0x4c43ea={};_0x4c43ea[_0x5272('0x31')]=_[_0x5272('0x2e')](db[_0x5272('0x2b')]['rawAttributes']);_0x4c43ea[_0x5272('0x2d')]=_[_0x5272('0x2e')](_0x2a3f3b['query']);_0x4c43ea[_0x5272('0x2f')]=_['intersection'](_0x4c43ea[_0x5272('0x31')],_0x4c43ea[_0x5272('0x2d')]);_0x529d0b[_0x5272('0x32')]=_[_0x5272('0x30')](_0x4c43ea[_0x5272('0x31')],qs[_0x5272('0x33')](_0x2a3f3b[_0x5272('0x2d')][_0x5272('0x33')]));_0x529d0b[_0x5272('0x32')]=_0x529d0b[_0x5272('0x32')][_0x5272('0x34')]?_0x529d0b[_0x5272('0x32')]:_0x4c43ea[_0x5272('0x31')];if(_0x2a3f3b[_0x5272('0x2d')]['includeAll']){_0x529d0b[_0x5272('0x44')]=[{'all':!![]}];}_0x529d0b=_[_0x5272('0x3b')]({},_0x529d0b,_0x2a3f3b[_0x5272('0x3e')]);return db['AnalyticMetric'][_0x5272('0x45')](_0x529d0b)[_0x5272('0x21')](handleEntityNotFound(_0x58738b,null))[_0x5272('0x21')](respondWithResult(_0x58738b,null))[_0x5272('0x41')](handleError(_0x58738b,null));};exports[_0x5272('0x46')]=function(_0x250e48,_0x583e55){return db[_0x5272('0x2b')][_0x5272('0x46')](_0x250e48[_0x5272('0x47')],{})[_0x5272('0x21')](function(_0x2ff1e2){var _0x35a823=_0x250e48['user'][_0x5272('0x48')]({'plain':!![]});if(!_0x35a823)throw new Error(_0x5272('0x49'));if(_0x35a823[_0x5272('0x4a')]==='user'){var _0x3ca7d=_0x2ff1e2[_0x5272('0x48')]({'plain':!![]});var _0x402227=_0x5272('0x22');return db[_0x5272('0x4b')][_0x5272('0x45')]({'where':{'name':_0x402227,'userProfileId':_0x35a823['userProfileId']},'raw':!![]})[_0x5272('0x21')](function(_0x2a2fd1){if(_0x2a2fd1&&_0x2a2fd1[_0x5272('0x4c')]===0x0){return db['UserProfileResource'][_0x5272('0x46')]({'name':_0x3ca7d['name'],'resourceId':_0x3ca7d['id'],'type':_0x2a2fd1[_0x5272('0x27')],'sectionId':_0x2a2fd1['id']},{})['then'](function(){return _0x2ff1e2;});}else{return _0x2ff1e2;}})['catch'](function(_0x507042){logger[_0x5272('0x4d')](_0x5272('0x4e'),_0x507042);throw _0x507042;});}return _0x2ff1e2;})[_0x5272('0x21')](respondWithResult(_0x583e55,0xc9))[_0x5272('0x41')](handleError(_0x583e55,null));};exports[_0x5272('0x4f')]=function(_0x396440,_0x2b4a53){if(_0x396440[_0x5272('0x47')]['id']){delete _0x396440['body']['id'];}return db['AnalyticMetric'][_0x5272('0x45')]({'where':{'id':_0x396440[_0x5272('0x43')]['id']}})[_0x5272('0x21')](handleEntityNotFound(_0x2b4a53,null))[_0x5272('0x21')](saveUpdates(_0x396440[_0x5272('0x47')],null))[_0x5272('0x21')](respondWithResult(_0x2b4a53,null))[_0x5272('0x41')](handleError(_0x2b4a53,null));};exports['destroy']=function(_0x371fcc,_0x3cd9f4){return db[_0x5272('0x2b')]['find']({'where':{'id':_0x371fcc['params']['id']}})[_0x5272('0x21')](handleEntityNotFound(_0x3cd9f4,null))[_0x5272('0x21')](removeEntity(_0x3cd9f4,null))[_0x5272('0x41')](handleError(_0x3cd9f4,null));};
\ No newline at end of file