Built motion from commit (unavailable).|2.5.26
[motion2.git] / server / api / analyticMetric / analyticMetric.controller.js
index 3c2bb23..4522238 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x259b=['include','findAll','rows','show','params','rawAttributes','includeAll','merge','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','fast-json-patch','mustache','path','sox','to-csv','ejs','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','get','Metrics','destroy','sendStatus','stack','name','send','index','map','AnalyticMetric','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','VIRTUAL','where'];(function(_0x9d3eb9,_0x148a27){var _0x91de80=function(_0x59af1d){while(--_0x59af1d){_0x9d3eb9['push'](_0x9d3eb9['shift']());}};_0x91de80(++_0x148a27);}(_0x259b,0x108));var _0xb259=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x259b[_0x3c2a69];return _0x596bc8;};'use strict';var pdf=require(_0xb259('0x0'));var emlformat=require(_0xb259('0x1'));var rimraf=require(_0xb259('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb259('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb259('0x4'));var util=require('util');var path=require(_0xb259('0x5'));var sox=require(_0xb259('0x6'));var csv=require(_0xb259('0x7'));var ejs=require(_0xb259('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb259('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb259('0xa'));var toCsv=require(_0xb259('0x7'));var querystring=require('querystring');var Papa=require(_0xb259('0xb'));var Redis=require('ioredis');var authService=require(_0xb259('0xc'));var qs=require(_0xb259('0xd'));var as=require(_0xb259('0xe'));var hardwareService=require(_0xb259('0xf'));var logger=require('../../config/logger')(_0xb259('0x10'));var utils=require(_0xb259('0x11'));var config=require(_0xb259('0x12'));var licenseUtil=require(_0xb259('0x13'));var db=require(_0xb259('0x14'))['db'];function respondWithStatusCode(_0x232ad3,_0x1efc94){_0x1efc94=_0x1efc94||0xcc;return function(_0x3ed3a5){if(_0x3ed3a5){return _0x232ad3['sendStatus'](_0x1efc94);}return _0x232ad3['status'](_0x1efc94)[_0xb259('0x15')]();};}function respondWithResult(_0x3f8539,_0x1b8572){_0x1b8572=_0x1b8572||0xc8;return function(_0x585b5a){if(_0x585b5a){return _0x3f8539[_0xb259('0x16')](_0x1b8572)[_0xb259('0x17')](_0x585b5a);}};}function respondWithFilteredResult(_0x362df1,_0x3a44f1){return function(_0x28e4ce){if(_0x28e4ce){var _0x1e0adb=_0x28e4ce[_0xb259('0x18')],_0x49178f=_0x3a44f1[_0xb259('0x19')],_0x41015c=_0x3a44f1['offset']+_0x3a44f1[_0xb259('0x1a')],_0x1d8d18;if(_0x41015c>=_0x1e0adb){_0x41015c=_0x1e0adb;_0x1d8d18=0xc8;}else{_0x1d8d18=0xce;}_0x362df1['status'](_0x1d8d18);return _0x362df1[_0xb259('0x1b')](_0xb259('0x1c'),_0x49178f+'-'+_0x41015c+'/'+_0x1e0adb)['json'](_0x28e4ce);}return null;};}function patchUpdates(_0x24404d){return function(_0xd98743){try{jsonpatch[_0xb259('0x1d')](_0xd98743,_0x24404d,!![]);}catch(_0x3a992e){return BPromise[_0xb259('0x1e')](_0x3a992e);}return _0xd98743['save']();};}function saveUpdates(_0x4324b2,_0x20f801){return function(_0x4f141a){if(_0x4f141a){return _0x4f141a[_0xb259('0x1f')](_0x4324b2)[_0xb259('0x20')](function(_0x19c8c7){return _0x19c8c7;});}return null;};}function removeEntity(_0x53d8ec,_0x72cdc0){return function(_0x1ea0ee){if(_0x1ea0ee){return _0x1ea0ee['destroy']()['then'](function(){var _0x24b73c=_0x1ea0ee[_0xb259('0x21')]({'plain':!![]});var _0x14d207=_0xb259('0x22');return db['UserProfileResource'][_0xb259('0x23')]({'where':{'type':_0x14d207,'resourceId':_0x24b73c['id']}})[_0xb259('0x20')](function(){return _0x1ea0ee;});})[_0xb259('0x20')](function(){_0x53d8ec[_0xb259('0x16')](0xcc)[_0xb259('0x15')]();});}};}function handleEntityNotFound(_0xf7168e,_0x14d6c7){return function(_0x258576){if(!_0x258576){_0xf7168e[_0xb259('0x24')](0x194);}return _0x258576;};}function handleError(_0x593fdc,_0x235be5){_0x235be5=_0x235be5||0x1f4;return function(_0x10f926){logger['error'](_0x10f926[_0xb259('0x25')]);if(_0x10f926[_0xb259('0x26')]){delete _0x10f926['name'];}_0x593fdc['status'](_0x235be5)[_0xb259('0x27')](_0x10f926);};}exports[_0xb259('0x28')]=function(_0x2808ff,_0x251d48){var _0x33e6f9={},_0xa4fc40={},_0x34d147={'count':0x0,'rows':[]};var _0x3388d8=_[_0xb259('0x29')](db[_0xb259('0x2a')]['rawAttributes'],function(_0x45b12f){return{'name':_0x45b12f[_0xb259('0x2b')],'type':_0x45b12f['type'][_0xb259('0x2c')]};});_0xa4fc40[_0xb259('0x2d')]=_[_0xb259('0x29')](_0x3388d8,_0xb259('0x26'));_0xa4fc40[_0xb259('0x2e')]=_[_0xb259('0x2f')](_0x2808ff['query']);_0xa4fc40[_0xb259('0x30')]=_[_0xb259('0x31')](_0xa4fc40[_0xb259('0x2d')],_0xa4fc40[_0xb259('0x2e')]);_0x33e6f9[_0xb259('0x32')]=_[_0xb259('0x31')](_0xa4fc40[_0xb259('0x2d')],qs[_0xb259('0x33')](_0x2808ff['query'][_0xb259('0x33')]));_0x33e6f9[_0xb259('0x32')]=_0x33e6f9[_0xb259('0x32')][_0xb259('0x34')]?_0x33e6f9[_0xb259('0x32')]:_0xa4fc40[_0xb259('0x2d')];if(!_0x2808ff[_0xb259('0x2e')]['hasOwnProperty'](_0xb259('0x35'))){_0x33e6f9['limit']=qs['limit'](_0x2808ff[_0xb259('0x2e')][_0xb259('0x1a')]);_0x33e6f9[_0xb259('0x19')]=qs[_0xb259('0x19')](_0x2808ff[_0xb259('0x2e')]['offset']);}_0x33e6f9[_0xb259('0x36')]=qs[_0xb259('0x37')](_0x2808ff['query'][_0xb259('0x37')]);_0x33e6f9['where']=qs['filters'](_[_0xb259('0x38')](_0x2808ff['query'],_0xa4fc40['filters']),_0x3388d8);if(_0x2808ff[_0xb259('0x2e')][_0xb259('0x39')]){_0x33e6f9['where']=_['merge'](_0x33e6f9['where'],{'$or':_[_0xb259('0x29')](_0x3388d8,function(_0x4adee8){if(_0x4adee8['type']!==_0xb259('0x3a')){var _0x432be5={};_0x432be5[_0x4adee8['name']]={'$like':'%'+_0x2808ff[_0xb259('0x2e')][_0xb259('0x39')]+'%'};return _0x432be5;}})});}_0x33e6f9=_['merge']({},_0x33e6f9,_0x2808ff['options']);var _0x3a6e97={'where':_0x33e6f9[_0xb259('0x3b')]};return db[_0xb259('0x2a')]['count'](_0x3a6e97)[_0xb259('0x20')](function(_0x15ea75){_0x34d147[_0xb259('0x18')]=_0x15ea75;if(_0x2808ff[_0xb259('0x2e')]['includeAll']){_0x33e6f9[_0xb259('0x3c')]=[{'all':!![]}];}return db[_0xb259('0x2a')][_0xb259('0x3d')](_0x33e6f9);})[_0xb259('0x20')](function(_0x24463b){_0x34d147[_0xb259('0x3e')]=_0x24463b;return _0x34d147;})[_0xb259('0x20')](respondWithFilteredResult(_0x251d48,_0x33e6f9))['catch'](handleError(_0x251d48,null));};exports[_0xb259('0x3f')]=function(_0x36a729,_0x3f2c07){var _0x417996={'raw':!![],'where':{'id':_0x36a729[_0xb259('0x40')]['id']}},_0x3df483={};_0x3df483[_0xb259('0x2d')]=_[_0xb259('0x2f')](db['AnalyticMetric'][_0xb259('0x41')]);_0x3df483[_0xb259('0x2e')]=_[_0xb259('0x2f')](_0x36a729[_0xb259('0x2e')]);_0x3df483['filters']=_[_0xb259('0x31')](_0x3df483[_0xb259('0x2d')],_0x3df483['query']);_0x417996[_0xb259('0x32')]=_[_0xb259('0x31')](_0x3df483[_0xb259('0x2d')],qs['fields'](_0x36a729[_0xb259('0x2e')][_0xb259('0x33')]));_0x417996[_0xb259('0x32')]=_0x417996[_0xb259('0x32')][_0xb259('0x34')]?_0x417996[_0xb259('0x32')]:_0x3df483[_0xb259('0x2d')];if(_0x36a729[_0xb259('0x2e')][_0xb259('0x42')]){_0x417996['include']=[{'all':!![]}];}_0x417996=_[_0xb259('0x43')]({},_0x417996,_0x36a729['options']);return db[_0xb259('0x2a')][_0xb259('0x44')](_0x417996)[_0xb259('0x20')](handleEntityNotFound(_0x3f2c07,null))[_0xb259('0x20')](respondWithResult(_0x3f2c07,null))[_0xb259('0x45')](handleError(_0x3f2c07,null));};exports[_0xb259('0x46')]=function(_0x3c75e2,_0x1cc434){return db[_0xb259('0x2a')][_0xb259('0x46')](_0x3c75e2['body'],{})[_0xb259('0x20')](function(_0x363cc2){var _0xe3b0b2=_0x3c75e2[_0xb259('0x47')][_0xb259('0x21')]({'plain':!![]});if(!_0xe3b0b2)throw new Error(_0xb259('0x48'));if(_0xe3b0b2[_0xb259('0x49')]===_0xb259('0x47')){var _0x522b86=_0x363cc2['get']({'plain':!![]});var _0x2a342a=_0xb259('0x22');return db[_0xb259('0x4a')]['find']({'where':{'name':_0x2a342a,'userProfileId':_0xe3b0b2[_0xb259('0x4b')]},'raw':!![]})[_0xb259('0x20')](function(_0x2f48c5){if(_0x2f48c5&&_0x2f48c5[_0xb259('0x4c')]===0x0){return db[_0xb259('0x4d')][_0xb259('0x46')]({'name':_0x522b86[_0xb259('0x26')],'resourceId':_0x522b86['id'],'type':_0x2f48c5['name'],'sectionId':_0x2f48c5['id']},{})[_0xb259('0x20')](function(){return _0x363cc2;});}else{return _0x363cc2;}})[_0xb259('0x45')](function(_0x239949){logger[_0xb259('0x4e')](_0xb259('0x4f'),_0x239949);throw _0x239949;});}return _0x363cc2;})[_0xb259('0x20')](respondWithResult(_0x1cc434,0xc9))[_0xb259('0x45')](handleError(_0x1cc434,null));};exports['update']=function(_0x2e81a6,_0x1d8970){if(_0x2e81a6['body']['id']){delete _0x2e81a6[_0xb259('0x50')]['id'];}return db[_0xb259('0x2a')]['find']({'where':{'id':_0x2e81a6['params']['id']}})['then'](handleEntityNotFound(_0x1d8970,null))[_0xb259('0x20')](saveUpdates(_0x2e81a6['body'],null))[_0xb259('0x20')](respondWithResult(_0x1d8970,null))['catch'](handleError(_0x1d8970,null));};exports[_0xb259('0x23')]=function(_0x7ab68d,_0x3f28d5){return db['AnalyticMetric'][_0xb259('0x44')]({'where':{'id':_0x7ab68d[_0xb259('0x40')]['id']}})[_0xb259('0x20')](handleEntityNotFound(_0x3f28d5,null))[_0xb259('0x20')](removeEntity(_0x3f28d5,null))['catch'](handleError(_0x3f28d5,null));};
\ No newline at end of file
+var _0xf072=['save','then','Metrics','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','AnalyticMetric','includeAll','include','findAll','catch','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','count','offset','limit','set','Content-Range','json','apply','reject'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0xf072,0x1d9));var _0x2f07=function(_0x2040f4,_0x4fe5cc){_0x2040f4=_0x2040f4-0x0;var _0x4b8540=_0xf072[_0x2040f4];return _0x4b8540;};'use strict';var emlformat=require(_0x2f07('0x0'));var rimraf=require(_0x2f07('0x1'));var zipdir=require(_0x2f07('0x2'));var jsonpatch=require(_0x2f07('0x3'));var rp=require(_0x2f07('0x4'));var moment=require(_0x2f07('0x5'));var BPromise=require(_0x2f07('0x6'));var Mustache=require(_0x2f07('0x7'));var util=require('util');var path=require(_0x2f07('0x8'));var sox=require(_0x2f07('0x9'));var csv=require(_0x2f07('0xa'));var ejs=require(_0x2f07('0xb'));var fs=require('fs');var fs_extra=require(_0x2f07('0xc'));var _=require(_0x2f07('0xd'));var squel=require(_0x2f07('0xe'));var crypto=require(_0x2f07('0xf'));var jsforce=require(_0x2f07('0x10'));var deskjs=require(_0x2f07('0x11'));var toCsv=require(_0x2f07('0xa'));var querystring=require(_0x2f07('0x12'));var Papa=require(_0x2f07('0x13'));var Redis=require('ioredis');var authService=require(_0x2f07('0x14'));var qs=require(_0x2f07('0x15'));var as=require(_0x2f07('0x16'));var hardwareService=require(_0x2f07('0x17'));var logger=require('../../config/logger')(_0x2f07('0x18'));var utils=require(_0x2f07('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x2f07('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e1d16,_0xbb514f){_0xbb514f=_0xbb514f||0xcc;return function(_0xd3a6){if(_0xd3a6){return _0x1e1d16['sendStatus'](_0xbb514f);}return _0x1e1d16[_0x2f07('0x1b')](_0xbb514f)[_0x2f07('0x1c')]();};}function respondWithResult(_0x57dcd2,_0x1cc5a4){_0x1cc5a4=_0x1cc5a4||0xc8;return function(_0x171380){if(_0x171380){return _0x57dcd2[_0x2f07('0x1b')](_0x1cc5a4)['json'](_0x171380);}};}function respondWithFilteredResult(_0x586dda,_0x3d8b9b){return function(_0x37ffa7){if(_0x37ffa7){var _0x521e99=_0x37ffa7[_0x2f07('0x1d')],_0x3b64b2=_0x3d8b9b['offset'],_0x5337ae=_0x3d8b9b[_0x2f07('0x1e')]+_0x3d8b9b[_0x2f07('0x1f')],_0x60d8e4;if(_0x5337ae>=_0x521e99){_0x5337ae=_0x521e99;_0x60d8e4=0xc8;}else{_0x60d8e4=0xce;}_0x586dda[_0x2f07('0x1b')](_0x60d8e4);return _0x586dda[_0x2f07('0x20')](_0x2f07('0x21'),_0x3b64b2+'-'+_0x5337ae+'/'+_0x521e99)[_0x2f07('0x22')](_0x37ffa7);}return null;};}function patchUpdates(_0x1d7eb8){return function(_0x4f7670){try{jsonpatch[_0x2f07('0x23')](_0x4f7670,_0x1d7eb8,!![]);}catch(_0x319db6){return BPromise[_0x2f07('0x24')](_0x319db6);}return _0x4f7670[_0x2f07('0x25')]();};}function saveUpdates(_0x13c04d,_0x4bb406){return function(_0x253b89){if(_0x253b89){return _0x253b89['update'](_0x13c04d)[_0x2f07('0x26')](function(_0x445808){return _0x445808;});}return null;};}function removeEntity(_0x256f79,_0x5653cd){return function(_0x50f263){if(_0x50f263){return _0x50f263['destroy']()[_0x2f07('0x26')](function(){var _0x4ad315=_0x50f263['get']({'plain':!![]});var _0x34cd67=_0x2f07('0x27');return db['UserProfileResource'][_0x2f07('0x28')]({'where':{'type':_0x34cd67,'resourceId':_0x4ad315['id']}})[_0x2f07('0x26')](function(){return _0x50f263;});})['then'](function(){_0x256f79[_0x2f07('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e276a,_0x38543f){return function(_0x46a5ec){if(!_0x46a5ec){_0x2e276a[_0x2f07('0x29')](0x194);}return _0x46a5ec;};}function handleError(_0x941e91,_0x50186a){_0x50186a=_0x50186a||0x1f4;return function(_0x27b5da){logger[_0x2f07('0x2a')](_0x27b5da[_0x2f07('0x2b')]);if(_0x27b5da[_0x2f07('0x2c')]){delete _0x27b5da['name'];}_0x941e91[_0x2f07('0x1b')](_0x50186a)[_0x2f07('0x2d')](_0x27b5da);};}exports['index']=function(_0x2da386,_0xf48a98){var _0x449da7={},_0x419b3d={},_0x52f3ac={'count':0x0,'rows':[]};var _0x722218=_[_0x2f07('0x2e')](db['AnalyticMetric'][_0x2f07('0x2f')],function(_0x142b33){return{'name':_0x142b33[_0x2f07('0x30')],'type':_0x142b33['type'][_0x2f07('0x31')]};});_0x419b3d[_0x2f07('0x32')]=_['map'](_0x722218,'name');_0x419b3d[_0x2f07('0x33')]=_[_0x2f07('0x34')](_0x2da386[_0x2f07('0x33')]);_0x419b3d[_0x2f07('0x35')]=_[_0x2f07('0x36')](_0x419b3d[_0x2f07('0x32')],_0x419b3d[_0x2f07('0x33')]);_0x449da7[_0x2f07('0x37')]=_['intersection'](_0x419b3d[_0x2f07('0x32')],qs[_0x2f07('0x38')](_0x2da386[_0x2f07('0x33')][_0x2f07('0x38')]));_0x449da7[_0x2f07('0x37')]=_0x449da7[_0x2f07('0x37')]['length']?_0x449da7[_0x2f07('0x37')]:_0x419b3d[_0x2f07('0x32')];if(!_0x2da386['query'][_0x2f07('0x39')](_0x2f07('0x3a'))){_0x449da7[_0x2f07('0x1f')]=qs[_0x2f07('0x1f')](_0x2da386[_0x2f07('0x33')][_0x2f07('0x1f')]);_0x449da7[_0x2f07('0x1e')]=qs[_0x2f07('0x1e')](_0x2da386[_0x2f07('0x33')]['offset']);}_0x449da7[_0x2f07('0x3b')]=qs[_0x2f07('0x3c')](_0x2da386[_0x2f07('0x33')]['sort']);_0x449da7['where']=qs[_0x2f07('0x35')](_[_0x2f07('0x3d')](_0x2da386['query'],_0x419b3d[_0x2f07('0x35')]),_0x722218);if(_0x2da386['query'][_0x2f07('0x3e')]){_0x449da7[_0x2f07('0x3f')]=_[_0x2f07('0x40')](_0x449da7[_0x2f07('0x3f')],{'$or':_[_0x2f07('0x2e')](_0x722218,function(_0x89c268){if(_0x89c268[_0x2f07('0x41')]!==_0x2f07('0x42')){var _0xb347fd={};_0xb347fd[_0x89c268['name']]={'$like':'%'+_0x2da386[_0x2f07('0x33')]['filter']+'%'};return _0xb347fd;}})});}_0x449da7=_['merge']({},_0x449da7,_0x2da386['options']);var _0x20983c={'where':_0x449da7[_0x2f07('0x3f')]};return db[_0x2f07('0x43')][_0x2f07('0x1d')](_0x20983c)['then'](function(_0x3bcf24){_0x52f3ac['count']=_0x3bcf24;if(_0x2da386['query'][_0x2f07('0x44')]){_0x449da7[_0x2f07('0x45')]=[{'all':!![]}];}return db[_0x2f07('0x43')][_0x2f07('0x46')](_0x449da7);})[_0x2f07('0x26')](function(_0x2f3528){_0x52f3ac['rows']=_0x2f3528;return _0x52f3ac;})[_0x2f07('0x26')](respondWithFilteredResult(_0xf48a98,_0x449da7))[_0x2f07('0x47')](handleError(_0xf48a98,null));};exports['show']=function(_0x300082,_0x56aa1a){var _0x42e67c={'raw':!![],'where':{'id':_0x300082['params']['id']}},_0x532ed9={};_0x532ed9['model']=_[_0x2f07('0x34')](db[_0x2f07('0x43')][_0x2f07('0x2f')]);_0x532ed9['query']=_[_0x2f07('0x34')](_0x300082['query']);_0x532ed9['filters']=_[_0x2f07('0x36')](_0x532ed9['model'],_0x532ed9['query']);_0x42e67c[_0x2f07('0x37')]=_[_0x2f07('0x36')](_0x532ed9[_0x2f07('0x32')],qs[_0x2f07('0x38')](_0x300082[_0x2f07('0x33')][_0x2f07('0x38')]));_0x42e67c[_0x2f07('0x37')]=_0x42e67c[_0x2f07('0x37')]['length']?_0x42e67c['attributes']:_0x532ed9['model'];if(_0x300082['query'][_0x2f07('0x44')]){_0x42e67c[_0x2f07('0x45')]=[{'all':!![]}];}_0x42e67c=_[_0x2f07('0x40')]({},_0x42e67c,_0x300082[_0x2f07('0x48')]);return db['AnalyticMetric'][_0x2f07('0x49')](_0x42e67c)[_0x2f07('0x26')](handleEntityNotFound(_0x56aa1a,null))[_0x2f07('0x26')](respondWithResult(_0x56aa1a,null))[_0x2f07('0x47')](handleError(_0x56aa1a,null));};exports[_0x2f07('0x4a')]=function(_0x41764a,_0x4b887a){return db[_0x2f07('0x43')]['create'](_0x41764a[_0x2f07('0x4b')],{})[_0x2f07('0x26')](function(_0x34046d){var _0xfdb50a=_0x41764a['user'][_0x2f07('0x4c')]({'plain':!![]});if(!_0xfdb50a)throw new Error(_0x2f07('0x4d'));if(_0xfdb50a[_0x2f07('0x4e')]==='user'){var _0x252b7b=_0x34046d[_0x2f07('0x4c')]({'plain':!![]});var _0x1c323e=_0x2f07('0x27');return db[_0x2f07('0x4f')][_0x2f07('0x49')]({'where':{'name':_0x1c323e,'userProfileId':_0xfdb50a[_0x2f07('0x50')]},'raw':!![]})[_0x2f07('0x26')](function(_0x373a51){if(_0x373a51&&_0x373a51['autoAssociation']===0x0){return db[_0x2f07('0x51')][_0x2f07('0x4a')]({'name':_0x252b7b[_0x2f07('0x2c')],'resourceId':_0x252b7b['id'],'type':_0x373a51[_0x2f07('0x2c')],'sectionId':_0x373a51['id']},{})[_0x2f07('0x26')](function(){return _0x34046d;});}else{return _0x34046d;}})[_0x2f07('0x47')](function(_0x4b9dc8){logger[_0x2f07('0x2a')](_0x2f07('0x52'),_0x4b9dc8);throw _0x4b9dc8;});}return _0x34046d;})[_0x2f07('0x26')](respondWithResult(_0x4b887a,0xc9))['catch'](handleError(_0x4b887a,null));};exports[_0x2f07('0x53')]=function(_0x8c0432,_0x345d13){if(_0x8c0432[_0x2f07('0x4b')]['id']){delete _0x8c0432[_0x2f07('0x4b')]['id'];}return db[_0x2f07('0x43')][_0x2f07('0x49')]({'where':{'id':_0x8c0432[_0x2f07('0x54')]['id']}})['then'](handleEntityNotFound(_0x345d13,null))[_0x2f07('0x26')](saveUpdates(_0x8c0432[_0x2f07('0x4b')],null))[_0x2f07('0x26')](respondWithResult(_0x345d13,null))[_0x2f07('0x47')](handleError(_0x345d13,null));};exports['destroy']=function(_0x18c671,_0x505edd){return db[_0x2f07('0x43')][_0x2f07('0x49')]({'where':{'id':_0x18c671[_0x2f07('0x54')]['id']}})[_0x2f07('0x26')](handleEntityNotFound(_0x505edd,null))[_0x2f07('0x26')](removeEntity(_0x505edd,null))[_0x2f07('0x47')](handleError(_0x505edd,null));};
\ No newline at end of file