Built motion from commit (unavailable).|2.3.1
[motion2.git] / server / api / analyticMetric / analyticMetric.controller.js
index 4a0b415..1988f07 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x790c=['find','catch','create','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','../../components/auth/service','../../config/license/hardware','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save','then','get','Metrics','destroy','error','stack','name','send','AnalyticMetric','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','field','filter','merge','options','includeAll','include','rows','show','params'];(function(_0x38d6f8,_0x36557c){var _0x3d54fd=function(_0x22e4de){while(--_0x22e4de){_0x38d6f8['push'](_0x38d6f8['shift']());}};_0x3d54fd(++_0x36557c);}(_0x790c,0xad));var _0xc790=function(_0x37419b,_0x1848ff){_0x37419b=_0x37419b-0x0;var _0x3752a3=_0x790c[_0x37419b];return _0x3752a3;};'use strict';var pdf=require(_0xc790('0x0'));var emlformat=require(_0xc790('0x1'));var rimraf=require(_0xc790('0x2'));var zipdir=require(_0xc790('0x3'));var jsonpatch=require(_0xc790('0x4'));var rp=require(_0xc790('0x5'));var moment=require(_0xc790('0x6'));var BPromise=require(_0xc790('0x7'));var Mustache=require(_0xc790('0x8'));var util=require(_0xc790('0x9'));var path=require('path');var sox=require(_0xc790('0xa'));var csv=require(_0xc790('0xb'));var ejs=require(_0xc790('0xc'));var fs=require('fs');var _=require(_0xc790('0xd'));var squel=require(_0xc790('0xe'));var crypto=require(_0xc790('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc790('0xb'));var querystring=require(_0xc790('0x10'));var Papa=require('papaparse');var authService=require(_0xc790('0x11'));var hardwareService=require(_0xc790('0x12'));var Redis=require(_0xc790('0x13'));var qs=require(_0xc790('0x14'));var logger=require(_0xc790('0x15'))(_0xc790('0x16'));var utils=require('../../config/utils');var config=require(_0xc790('0x17'));var db=require(_0xc790('0x18'))['db'];function respondWithStatusCode(_0x2b403b,_0x1459e4){_0x1459e4=_0x1459e4||0xcc;return function(_0x21a159){if(_0x21a159){return _0x2b403b[_0xc790('0x19')](_0x1459e4);}return _0x2b403b[_0xc790('0x1a')](_0x1459e4)[_0xc790('0x1b')]();};}function respondWithResult(_0xa38988,_0x563688){_0x563688=_0x563688||0xc8;return function(_0xeddc37){if(_0xeddc37){return _0xa38988[_0xc790('0x1a')](_0x563688)['json'](_0xeddc37);}};}function respondWithFilteredResult(_0xe0611c,_0x4347f5){return function(_0x455928){if(_0x455928){var _0x4fef85=_0x455928[_0xc790('0x1c')],_0x43ce87=_0x4347f5[_0xc790('0x1d')],_0x586912=_0x4347f5[_0xc790('0x1d')]+_0x4347f5[_0xc790('0x1e')],_0x40f243;if(_0x586912>=_0x4fef85){_0x586912=_0x4fef85;_0x40f243=0xc8;}else{_0x40f243=0xce;}_0xe0611c[_0xc790('0x1a')](_0x40f243);return _0xe0611c[_0xc790('0x1f')]('Content-Range',_0x43ce87+'-'+_0x586912+'/'+_0x4fef85)[_0xc790('0x20')](_0x455928);}return null;};}function patchUpdates(_0xaf49cc){return function(_0x3d6948){try{jsonpatch['apply'](_0x3d6948,_0xaf49cc,!![]);}catch(_0x6cced5){return BPromise[_0xc790('0x21')](_0x6cced5);}return _0x3d6948[_0xc790('0x22')]();};}function saveUpdates(_0x5213de,_0xc8a709){return function(_0x5d8107){if(_0x5d8107){return _0x5d8107['update'](_0x5213de)[_0xc790('0x23')](function(_0x1a36b9){return _0x1a36b9;});}return null;};}function removeEntity(_0x101510,_0x1c459a){return function(_0x2da1e3){if(_0x2da1e3){return _0x2da1e3['destroy']()['then'](function(){var _0x92ffdb=_0x2da1e3[_0xc790('0x24')]({'plain':!![]});var _0x5915d9=_0xc790('0x25');return db['UserProfileResource'][_0xc790('0x26')]({'where':{'type':_0x5915d9,'resourceId':_0x92ffdb['id']}})[_0xc790('0x23')](function(){return _0x2da1e3;});})[_0xc790('0x23')](function(){_0x101510[_0xc790('0x1a')](0xcc)[_0xc790('0x1b')]();});}};}function handleEntityNotFound(_0x3bee84,_0x107438){return function(_0x152b79){if(!_0x152b79){_0x3bee84['sendStatus'](0x194);}return _0x152b79;};}function handleError(_0x5cbb3d,_0x2961a4){_0x2961a4=_0x2961a4||0x1f4;return function(_0x107dee){logger[_0xc790('0x27')](_0x107dee[_0xc790('0x28')]);if(_0x107dee[_0xc790('0x29')]){delete _0x107dee[_0xc790('0x29')];}_0x5cbb3d[_0xc790('0x1a')](_0x2961a4)[_0xc790('0x2a')](_0x107dee);};}exports['index']=function(_0x10abdf,_0x350756){var _0x5e928f={},_0x9aa1d8={},_0x31b570={'count':0x0,'rows':[]};var _0x38915c=db[_0xc790('0x2b')][_0xc790('0x2c')];_0x9aa1d8[_0xc790('0x2d')]=_['keys'](_0x38915c);_0x9aa1d8[_0xc790('0x2e')]=_[_0xc790('0x2f')](_0x10abdf['query']);_0x9aa1d8[_0xc790('0x30')]=_[_0xc790('0x31')](_0x9aa1d8[_0xc790('0x2d')],_0x9aa1d8[_0xc790('0x2e')]);_0x5e928f[_0xc790('0x32')]=_[_0xc790('0x31')](_0x9aa1d8[_0xc790('0x2d')],qs['fields'](_0x10abdf[_0xc790('0x2e')][_0xc790('0x33')]));_0x5e928f['attributes']=_0x5e928f[_0xc790('0x32')][_0xc790('0x34')]?_0x5e928f['attributes']:_0x9aa1d8['model'];if(!_0x10abdf[_0xc790('0x2e')][_0xc790('0x35')](_0xc790('0x36'))){_0x5e928f[_0xc790('0x1e')]=qs['limit'](_0x10abdf[_0xc790('0x2e')][_0xc790('0x1e')]);_0x5e928f[_0xc790('0x1d')]=qs['offset'](_0x10abdf[_0xc790('0x2e')][_0xc790('0x1d')]);}_0x5e928f[_0xc790('0x37')]=qs[_0xc790('0x38')](_0x10abdf[_0xc790('0x2e')][_0xc790('0x38')]);_0x5e928f[_0xc790('0x39')]=qs[_0xc790('0x30')](_[_0xc790('0x3a')](_0x10abdf['query'],_0x9aa1d8['filters']));if(_0x10abdf[_0xc790('0x2e')]['filter']){_0x5e928f[_0xc790('0x39')]=_['merge'](_0x5e928f['where'],{'$or':_['map'](_0x38915c,function(_0x327add){if(_0x327add[_0xc790('0x3b')]['key']!==_0xc790('0x3c')){var _0x4ac172={};_0x4ac172[_0x327add[_0xc790('0x3d')]]={'$like':'%'+_0x10abdf[_0xc790('0x2e')][_0xc790('0x3e')]+'%'};return _0x4ac172;}})});}_0x5e928f=_[_0xc790('0x3f')]({},_0x5e928f,_0x10abdf[_0xc790('0x40')]);var _0x1334f1={'where':_0x5e928f[_0xc790('0x39')]};return db['AnalyticMetric'][_0xc790('0x1c')](_0x1334f1)['then'](function(_0x4cf83e){_0x31b570[_0xc790('0x1c')]=_0x4cf83e;if(_0x10abdf[_0xc790('0x2e')][_0xc790('0x41')]){_0x5e928f[_0xc790('0x42')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x5e928f);})[_0xc790('0x23')](function(_0x59e198){_0x31b570[_0xc790('0x43')]=_0x59e198;return _0x31b570;})[_0xc790('0x23')](respondWithFilteredResult(_0x350756,_0x5e928f))['catch'](handleError(_0x350756,null));};exports[_0xc790('0x44')]=function(_0x5e7926,_0x212b29){var _0x1fc3eb={'raw':!![],'where':{'id':_0x5e7926[_0xc790('0x45')]['id']}},_0xf3469a={};_0xf3469a['model']=_['keys'](db[_0xc790('0x2b')][_0xc790('0x2c')]);_0xf3469a[_0xc790('0x2e')]=_[_0xc790('0x2f')](_0x5e7926['query']);_0xf3469a[_0xc790('0x30')]=_[_0xc790('0x31')](_0xf3469a[_0xc790('0x2d')],_0xf3469a['query']);_0x1fc3eb[_0xc790('0x32')]=_[_0xc790('0x31')](_0xf3469a[_0xc790('0x2d')],qs['fields'](_0x5e7926[_0xc790('0x2e')][_0xc790('0x33')]));_0x1fc3eb[_0xc790('0x32')]=_0x1fc3eb[_0xc790('0x32')][_0xc790('0x34')]?_0x1fc3eb[_0xc790('0x32')]:_0xf3469a['model'];if(_0x5e7926[_0xc790('0x2e')][_0xc790('0x41')]){_0x1fc3eb[_0xc790('0x42')]=[{'all':!![]}];}_0x1fc3eb=_[_0xc790('0x3f')]({},_0x1fc3eb,_0x5e7926[_0xc790('0x40')]);return db['AnalyticMetric'][_0xc790('0x46')](_0x1fc3eb)[_0xc790('0x23')](handleEntityNotFound(_0x212b29,null))['then'](respondWithResult(_0x212b29,null))[_0xc790('0x47')](handleError(_0x212b29,null));};exports[_0xc790('0x48')]=function(_0x17d2b2,_0x443e3d){return db[_0xc790('0x2b')]['create'](_0x17d2b2['body'],{})['then'](function(_0x462bc3){var _0x6b1946=_0x17d2b2[_0xc790('0x49')][_0xc790('0x24')]({'plain':!![]});if(!_0x6b1946)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6b1946[_0xc790('0x4a')]==='user'){var _0x36907f=_0x462bc3['get']({'plain':!![]});var _0x32ab8f=_0xc790('0x25');return db['UserProfileSection'][_0xc790('0x46')]({'where':{'name':_0x32ab8f,'userProfileId':_0x6b1946[_0xc790('0x4b')]},'raw':!![]})[_0xc790('0x23')](function(_0x546beb){if(_0x546beb&&_0x546beb[_0xc790('0x4c')]===0x0){return db[_0xc790('0x4d')][_0xc790('0x48')]({'name':_0x36907f[_0xc790('0x29')],'resourceId':_0x36907f['id'],'type':_0x546beb[_0xc790('0x29')],'sectionId':_0x546beb['id']},{})[_0xc790('0x23')](function(){return _0x462bc3;});}else{return _0x462bc3;}})[_0xc790('0x47')](function(_0x22c286){logger[_0xc790('0x27')](_0xc790('0x4e'),_0x22c286);throw _0x22c286;});}return _0x462bc3;})[_0xc790('0x23')](respondWithResult(_0x443e3d,0xc9))[_0xc790('0x47')](handleError(_0x443e3d,null));};exports[_0xc790('0x4f')]=function(_0x286083,_0x27df10){if(_0x286083[_0xc790('0x50')]['id']){delete _0x286083['body']['id'];}return db[_0xc790('0x2b')][_0xc790('0x46')]({'where':{'id':_0x286083[_0xc790('0x45')]['id']}})['then'](handleEntityNotFound(_0x27df10,null))['then'](saveUpdates(_0x286083['body'],null))['then'](respondWithResult(_0x27df10,null))[_0xc790('0x47')](handleError(_0x27df10,null));};exports[_0xc790('0x26')]=function(_0x48a752,_0x1e6eeb){return db[_0xc790('0x2b')][_0xc790('0x46')]({'where':{'id':_0x48a752[_0xc790('0x45')]['id']}})[_0xc790('0x23')](handleEntityNotFound(_0x1e6eeb,null))[_0xc790('0x23')](removeEntity(_0x1e6eeb,null))[_0xc790('0x47')](handleError(_0x1e6eeb,null));};
\ No newline at end of file
+var _0xabc7=['request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','ioredis','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','Metrics','then','error','stack','name','send','index','AnalyticMetric','rawAttributes','keys','query','model','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','filter','merge','key','field','options','where','include','rows','catch','show','params','fields','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','fast-json-patch'];(function(_0x46b00a,_0x18cd84){var _0xad86f1=function(_0x40da50){while(--_0x40da50){_0x46b00a['push'](_0x46b00a['shift']());}};_0xad86f1(++_0x18cd84);}(_0xabc7,0x139));var _0x7abc=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xabc7[_0x580576];return _0x3f55a0;};'use strict';var pdf=require(_0x7abc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7abc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7abc('0x2'));var rp=require(_0x7abc('0x3'));var moment=require(_0x7abc('0x4'));var BPromise=require(_0x7abc('0x5'));var Mustache=require(_0x7abc('0x6'));var util=require(_0x7abc('0x7'));var path=require(_0x7abc('0x8'));var sox=require('sox');var csv=require(_0x7abc('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7abc('0xa'));var squel=require(_0x7abc('0xb'));var crypto=require(_0x7abc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7abc('0xd'));var toCsv=require(_0x7abc('0x9'));var querystring=require(_0x7abc('0xe'));var Papa=require(_0x7abc('0xf'));var authService=require(_0x7abc('0x10'));var hardwareService=require(_0x7abc('0x11'));var Redis=require(_0x7abc('0x12'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7abc('0x13'));var utils=require(_0x7abc('0x14'));var config=require('../../config/environment');var db=require(_0x7abc('0x15'))['db'];function respondWithStatusCode(_0x7c374f,_0x54c201){_0x54c201=_0x54c201||0xcc;return function(_0x3c8b07){if(_0x3c8b07){return _0x7c374f[_0x7abc('0x16')](_0x54c201);}return _0x7c374f[_0x7abc('0x17')](_0x54c201)[_0x7abc('0x18')]();};}function respondWithResult(_0xdb951,_0x245793){_0x245793=_0x245793||0xc8;return function(_0x50cfd1){if(_0x50cfd1){return _0xdb951[_0x7abc('0x17')](_0x245793)['json'](_0x50cfd1);}};}function respondWithFilteredResult(_0x18f7d7,_0x1ffea4){return function(_0x2524e9){if(_0x2524e9){var _0x175c0d=_0x2524e9[_0x7abc('0x19')],_0x22180d=_0x1ffea4[_0x7abc('0x1a')],_0x5011d4=_0x1ffea4[_0x7abc('0x1a')]+_0x1ffea4['limit'],_0x1d89c7;if(_0x5011d4>=_0x175c0d){_0x5011d4=_0x175c0d;_0x1d89c7=0xc8;}else{_0x1d89c7=0xce;}_0x18f7d7['status'](_0x1d89c7);return _0x18f7d7[_0x7abc('0x1b')](_0x7abc('0x1c'),_0x22180d+'-'+_0x5011d4+'/'+_0x175c0d)['json'](_0x2524e9);}return null;};}function patchUpdates(_0x468191){return function(_0x2f33f9){try{jsonpatch[_0x7abc('0x1d')](_0x2f33f9,_0x468191,!![]);}catch(_0xf1fcd5){return BPromise[_0x7abc('0x1e')](_0xf1fcd5);}return _0x2f33f9[_0x7abc('0x1f')]();};}function saveUpdates(_0xca55c6,_0x23ac10){return function(_0x388dee){if(_0x388dee){return _0x388dee[_0x7abc('0x20')](_0xca55c6)['then'](function(_0x519603){return _0x519603;});}return null;};}function removeEntity(_0x275013,_0x34eba9){return function(_0x1f29c0){if(_0x1f29c0){return _0x1f29c0[_0x7abc('0x21')]()['then'](function(){var _0x2a76f2=_0x1f29c0[_0x7abc('0x22')]({'plain':!![]});var _0x410ea0=_0x7abc('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x410ea0,'resourceId':_0x2a76f2['id']}})[_0x7abc('0x24')](function(){return _0x1f29c0;});})[_0x7abc('0x24')](function(){_0x275013[_0x7abc('0x17')](0xcc)[_0x7abc('0x18')]();});}};}function handleEntityNotFound(_0x4ba9db,_0x31193b){return function(_0x142451){if(!_0x142451){_0x4ba9db[_0x7abc('0x16')](0x194);}return _0x142451;};}function handleError(_0x4541c6,_0x5e68c6){_0x5e68c6=_0x5e68c6||0x1f4;return function(_0x3c376c){logger[_0x7abc('0x25')](_0x3c376c[_0x7abc('0x26')]);if(_0x3c376c[_0x7abc('0x27')]){delete _0x3c376c[_0x7abc('0x27')];}_0x4541c6[_0x7abc('0x17')](_0x5e68c6)[_0x7abc('0x28')](_0x3c376c);};}exports[_0x7abc('0x29')]=function(_0x2da223,_0x5b973b){var _0xf47d5d={},_0x39ad72={},_0x51d37c={'count':0x0,'rows':[]};var _0x43fe11=db[_0x7abc('0x2a')][_0x7abc('0x2b')];_0x39ad72['model']=_[_0x7abc('0x2c')](_0x43fe11);_0x39ad72[_0x7abc('0x2d')]=_['keys'](_0x2da223[_0x7abc('0x2d')]);_0x39ad72['filters']=_['intersection'](_0x39ad72[_0x7abc('0x2e')],_0x39ad72[_0x7abc('0x2d')]);_0xf47d5d['attributes']=_[_0x7abc('0x2f')](_0x39ad72[_0x7abc('0x2e')],qs['fields'](_0x2da223[_0x7abc('0x2d')]['fields']));_0xf47d5d['attributes']=_0xf47d5d[_0x7abc('0x30')][_0x7abc('0x31')]?_0xf47d5d[_0x7abc('0x30')]:_0x39ad72[_0x7abc('0x2e')];if(!_0x2da223[_0x7abc('0x2d')][_0x7abc('0x32')](_0x7abc('0x33'))){_0xf47d5d[_0x7abc('0x34')]=qs[_0x7abc('0x34')](_0x2da223['query'][_0x7abc('0x34')]);_0xf47d5d[_0x7abc('0x1a')]=qs[_0x7abc('0x1a')](_0x2da223[_0x7abc('0x2d')][_0x7abc('0x1a')]);}_0xf47d5d[_0x7abc('0x35')]=qs[_0x7abc('0x36')](_0x2da223[_0x7abc('0x2d')][_0x7abc('0x36')]);_0xf47d5d['where']=qs['filters'](_[_0x7abc('0x37')](_0x2da223[_0x7abc('0x2d')],_0x39ad72[_0x7abc('0x38')]));if(_0x2da223[_0x7abc('0x2d')][_0x7abc('0x39')]){_0xf47d5d['where']=_[_0x7abc('0x3a')](_0xf47d5d['where'],{'$or':_['map'](_0x43fe11,function(_0x457838){if(_0x457838['type'][_0x7abc('0x3b')]!=='VIRTUAL'){var _0x4b1f4a={};_0x4b1f4a[_0x457838[_0x7abc('0x3c')]]={'$like':'%'+_0x2da223[_0x7abc('0x2d')][_0x7abc('0x39')]+'%'};return _0x4b1f4a;}})});}_0xf47d5d=_[_0x7abc('0x3a')]({},_0xf47d5d,_0x2da223[_0x7abc('0x3d')]);var _0x433edf={'where':_0xf47d5d[_0x7abc('0x3e')]};return db[_0x7abc('0x2a')][_0x7abc('0x19')](_0x433edf)[_0x7abc('0x24')](function(_0x463c8b){_0x51d37c['count']=_0x463c8b;if(_0x2da223[_0x7abc('0x2d')]['includeAll']){_0xf47d5d[_0x7abc('0x3f')]=[{'all':!![]}];}return db[_0x7abc('0x2a')]['findAll'](_0xf47d5d);})[_0x7abc('0x24')](function(_0xad0e1e){_0x51d37c[_0x7abc('0x40')]=_0xad0e1e;return _0x51d37c;})[_0x7abc('0x24')](respondWithFilteredResult(_0x5b973b,_0xf47d5d))[_0x7abc('0x41')](handleError(_0x5b973b,null));};exports[_0x7abc('0x42')]=function(_0x145ec,_0x2a7b71){var _0x320faf={'raw':!![],'where':{'id':_0x145ec[_0x7abc('0x43')]['id']}},_0x3b0c16={};_0x3b0c16[_0x7abc('0x2e')]=_[_0x7abc('0x2c')](db[_0x7abc('0x2a')][_0x7abc('0x2b')]);_0x3b0c16['query']=_['keys'](_0x145ec[_0x7abc('0x2d')]);_0x3b0c16[_0x7abc('0x38')]=_[_0x7abc('0x2f')](_0x3b0c16[_0x7abc('0x2e')],_0x3b0c16[_0x7abc('0x2d')]);_0x320faf[_0x7abc('0x30')]=_[_0x7abc('0x2f')](_0x3b0c16[_0x7abc('0x2e')],qs[_0x7abc('0x44')](_0x145ec[_0x7abc('0x2d')][_0x7abc('0x44')]));_0x320faf['attributes']=_0x320faf['attributes'][_0x7abc('0x31')]?_0x320faf[_0x7abc('0x30')]:_0x3b0c16[_0x7abc('0x2e')];if(_0x145ec[_0x7abc('0x2d')][_0x7abc('0x45')]){_0x320faf[_0x7abc('0x3f')]=[{'all':!![]}];}_0x320faf=_[_0x7abc('0x3a')]({},_0x320faf,_0x145ec[_0x7abc('0x3d')]);return db[_0x7abc('0x2a')][_0x7abc('0x46')](_0x320faf)[_0x7abc('0x24')](handleEntityNotFound(_0x2a7b71,null))[_0x7abc('0x24')](respondWithResult(_0x2a7b71,null))[_0x7abc('0x41')](handleError(_0x2a7b71,null));};exports[_0x7abc('0x47')]=function(_0x58a37f,_0x4cbb71){return db[_0x7abc('0x2a')][_0x7abc('0x47')](_0x58a37f['body'],{})[_0x7abc('0x24')](function(_0x4762d7){var _0x3c919a=_0x58a37f[_0x7abc('0x48')][_0x7abc('0x22')]({'plain':!![]});if(!_0x3c919a)throw new Error(_0x7abc('0x49'));if(_0x3c919a['role']==='user'){var _0x2e6ef0=_0x4762d7[_0x7abc('0x22')]({'plain':!![]});var _0xb3c17d=_0x7abc('0x23');return db['UserProfileSection'][_0x7abc('0x46')]({'where':{'name':_0xb3c17d,'userProfileId':_0x3c919a[_0x7abc('0x4a')]},'raw':!![]})[_0x7abc('0x24')](function(_0x4b1da8){if(_0x4b1da8&&_0x4b1da8[_0x7abc('0x4b')]===0x0){return db[_0x7abc('0x4c')][_0x7abc('0x47')]({'name':_0x2e6ef0[_0x7abc('0x27')],'resourceId':_0x2e6ef0['id'],'type':_0x4b1da8[_0x7abc('0x27')],'sectionId':_0x4b1da8['id']},{})[_0x7abc('0x24')](function(){return _0x4762d7;});}else{return _0x4762d7;}})[_0x7abc('0x41')](function(_0x25376a){logger[_0x7abc('0x25')](_0x7abc('0x4d'),_0x25376a);throw _0x25376a;});}return _0x4762d7;})[_0x7abc('0x24')](respondWithResult(_0x4cbb71,0xc9))[_0x7abc('0x41')](handleError(_0x4cbb71,null));};exports['update']=function(_0x476598,_0x448a14){if(_0x476598[_0x7abc('0x4e')]['id']){delete _0x476598[_0x7abc('0x4e')]['id'];}return db[_0x7abc('0x2a')][_0x7abc('0x46')]({'where':{'id':_0x476598[_0x7abc('0x43')]['id']}})[_0x7abc('0x24')](handleEntityNotFound(_0x448a14,null))[_0x7abc('0x24')](saveUpdates(_0x476598[_0x7abc('0x4e')],null))[_0x7abc('0x24')](respondWithResult(_0x448a14,null))['catch'](handleError(_0x448a14,null));};exports['destroy']=function(_0x471630,_0x50b33a){return db[_0x7abc('0x2a')][_0x7abc('0x46')]({'where':{'id':_0x471630[_0x7abc('0x43')]['id']}})[_0x7abc('0x24')](handleEntityNotFound(_0x50b33a,null))[_0x7abc('0x24')](removeEntity(_0x50b33a,null))[_0x7abc('0x41')](handleError(_0x50b33a,null));};
\ No newline at end of file