Built motion from commit 0900f080.|2.5.45
[motion2.git] / server / api / variable / variable.controller.js
index 664d5d0..089ceca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x661f=['status','end','json','count','offset','limit','set','Content-Range','reject','save','then','Variables','UserProfileResource','destroy','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','name','options','Variable','includeAll','include','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0xb1b166,_0x27a312){var _0x5ee259=function(_0x1117ac){while(--_0x1117ac){_0xb1b166['push'](_0xb1b166['shift']());}};_0x5ee259(++_0x27a312);}(_0x661f,0x8c));var _0xf661=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x661f[_0x2261ce];return _0x524640;};'use strict';var pdf=require(_0xf661('0x0'));var emlformat=require(_0xf661('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf661('0x2'));var moment=require(_0xf661('0x3'));var BPromise=require(_0xf661('0x4'));var Mustache=require(_0xf661('0x5'));var util=require(_0xf661('0x6'));var path=require(_0xf661('0x7'));var sox=require(_0xf661('0x8'));var csv=require(_0xf661('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf661('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf661('0xb'));var toCsv=require(_0xf661('0x9'));var querystring=require(_0xf661('0xc'));var Papa=require(_0xf661('0xd'));var Redis=require(_0xf661('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf661('0xf'));var as=require(_0xf661('0x10'));var hardwareService=require(_0xf661('0x11'));var logger=require('../../config/logger')(_0xf661('0x12'));var utils=require(_0xf661('0x13'));var config=require(_0xf661('0x14'));var db=require(_0xf661('0x15'))['db'];function respondWithStatusCode(_0x3af476,_0x2a1e13){_0x2a1e13=_0x2a1e13||0xcc;return function(_0x5d2f30){if(_0x5d2f30){return _0x3af476['sendStatus'](_0x2a1e13);}return _0x3af476[_0xf661('0x16')](_0x2a1e13)[_0xf661('0x17')]();};}function respondWithResult(_0x13c937,_0x4b03ef){_0x4b03ef=_0x4b03ef||0xc8;return function(_0x5e2a4c){if(_0x5e2a4c){return _0x13c937[_0xf661('0x16')](_0x4b03ef)[_0xf661('0x18')](_0x5e2a4c);}};}function respondWithFilteredResult(_0x157e82,_0x44d64b){return function(_0x4a4610){if(_0x4a4610){var _0x530ae3=_0x4a4610[_0xf661('0x19')],_0x34f699=_0x44d64b[_0xf661('0x1a')],_0x51e5b4=_0x44d64b[_0xf661('0x1a')]+_0x44d64b[_0xf661('0x1b')],_0x43a92a;if(_0x51e5b4>=_0x530ae3){_0x51e5b4=_0x530ae3;_0x43a92a=0xc8;}else{_0x43a92a=0xce;}_0x157e82[_0xf661('0x16')](_0x43a92a);return _0x157e82[_0xf661('0x1c')](_0xf661('0x1d'),_0x34f699+'-'+_0x51e5b4+'/'+_0x530ae3)['json'](_0x4a4610);}return null;};}function patchUpdates(_0x4a7cdb){return function(_0x4194a7){try{jsonpatch['apply'](_0x4194a7,_0x4a7cdb,!![]);}catch(_0x11c5ef){return BPromise[_0xf661('0x1e')](_0x11c5ef);}return _0x4194a7[_0xf661('0x1f')]();};}function saveUpdates(_0x1d40db,_0x23528a){return function(_0x5ab193){if(_0x5ab193){return _0x5ab193['update'](_0x1d40db)[_0xf661('0x20')](function(_0x979729){return _0x979729;});}return null;};}function removeEntity(_0x17948,_0xf142ba){return function(_0x1d4193){if(_0x1d4193){return _0x1d4193['destroy']()[_0xf661('0x20')](function(){var _0x51319a=_0x1d4193['get']({'plain':!![]});var _0x49e0b0=_0xf661('0x21');return db[_0xf661('0x22')][_0xf661('0x23')]({'where':{'type':_0x49e0b0,'resourceId':_0x51319a['id']}})['then'](function(){return _0x1d4193;});})['then'](function(){_0x17948['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa78c54,_0x2aefda){return function(_0x47d32a){if(!_0x47d32a){_0xa78c54[_0xf661('0x24')](0x194);}return _0x47d32a;};}function handleError(_0x269290,_0x880d51){_0x880d51=_0x880d51||0x1f4;return function(_0x2e9cc5){logger[_0xf661('0x25')](_0x2e9cc5[_0xf661('0x26')]);if(_0x2e9cc5['name']){delete _0x2e9cc5['name'];}_0x269290['status'](_0x880d51)[_0xf661('0x27')](_0x2e9cc5);};}exports[_0xf661('0x28')]=function(_0x59f68f,_0x243c3c){var _0x125c9c={},_0x52e868={},_0x146bb8={'count':0x0,'rows':[]};var _0x1bc1b4=_[_0xf661('0x29')](db['Variable'][_0xf661('0x2a')],function(_0x5a07d2){return{'name':_0x5a07d2[_0xf661('0x2b')],'type':_0x5a07d2[_0xf661('0x2c')][_0xf661('0x2d')]};});_0x52e868[_0xf661('0x2e')]=_[_0xf661('0x29')](_0x1bc1b4,'name');_0x52e868[_0xf661('0x2f')]=_[_0xf661('0x30')](_0x59f68f[_0xf661('0x2f')]);_0x52e868[_0xf661('0x31')]=_[_0xf661('0x32')](_0x52e868['model'],_0x52e868['query']);_0x125c9c['attributes']=_[_0xf661('0x32')](_0x52e868[_0xf661('0x2e')],qs[_0xf661('0x33')](_0x59f68f['query']['fields']));_0x125c9c[_0xf661('0x34')]=_0x125c9c[_0xf661('0x34')][_0xf661('0x35')]?_0x125c9c[_0xf661('0x34')]:_0x52e868['model'];if(!_0x59f68f[_0xf661('0x2f')][_0xf661('0x36')](_0xf661('0x37'))){_0x125c9c[_0xf661('0x1b')]=qs[_0xf661('0x1b')](_0x59f68f[_0xf661('0x2f')]['limit']);_0x125c9c['offset']=qs[_0xf661('0x1a')](_0x59f68f[_0xf661('0x2f')][_0xf661('0x1a')]);}_0x125c9c['order']=qs['sort'](_0x59f68f[_0xf661('0x2f')][_0xf661('0x38')]);_0x125c9c[_0xf661('0x39')]=qs[_0xf661('0x31')](_[_0xf661('0x3a')](_0x59f68f[_0xf661('0x2f')],_0x52e868[_0xf661('0x31')]),_0x1bc1b4);if(_0x59f68f[_0xf661('0x2f')][_0xf661('0x3b')]){_0x125c9c[_0xf661('0x39')]=_[_0xf661('0x3c')](_0x125c9c[_0xf661('0x39')],{'$or':_['map'](_0x1bc1b4,function(_0x409723){if(_0x409723['type']!==_0xf661('0x3d')){var _0x50d8d8={};_0x50d8d8[_0x409723[_0xf661('0x3e')]]={'$like':'%'+_0x59f68f[_0xf661('0x2f')]['filter']+'%'};return _0x50d8d8;}})});}_0x125c9c=_[_0xf661('0x3c')]({},_0x125c9c,_0x59f68f[_0xf661('0x3f')]);var _0x33c2d4={'where':_0x125c9c[_0xf661('0x39')]};return db[_0xf661('0x40')][_0xf661('0x19')](_0x33c2d4)[_0xf661('0x20')](function(_0x176171){_0x146bb8[_0xf661('0x19')]=_0x176171;if(_0x59f68f[_0xf661('0x2f')][_0xf661('0x41')]){_0x125c9c[_0xf661('0x42')]=[{'all':!![]}];}return db[_0xf661('0x40')]['findAll'](_0x125c9c);})[_0xf661('0x20')](function(_0x1a17ae){_0x146bb8[_0xf661('0x43')]=_0x1a17ae;return _0x146bb8;})[_0xf661('0x20')](respondWithFilteredResult(_0x243c3c,_0x125c9c))[_0xf661('0x44')](handleError(_0x243c3c,null));};exports[_0xf661('0x45')]=function(_0x1013be,_0xba9d90){var _0x40f8b8={'raw':!![],'where':{'id':_0x1013be[_0xf661('0x46')]['id']}},_0xfdbcdc={};_0xfdbcdc[_0xf661('0x2e')]=_[_0xf661('0x30')](db[_0xf661('0x40')][_0xf661('0x2a')]);_0xfdbcdc['query']=_[_0xf661('0x30')](_0x1013be[_0xf661('0x2f')]);_0xfdbcdc['filters']=_[_0xf661('0x32')](_0xfdbcdc[_0xf661('0x2e')],_0xfdbcdc[_0xf661('0x2f')]);_0x40f8b8[_0xf661('0x34')]=_[_0xf661('0x32')](_0xfdbcdc['model'],qs['fields'](_0x1013be[_0xf661('0x2f')][_0xf661('0x33')]));_0x40f8b8[_0xf661('0x34')]=_0x40f8b8[_0xf661('0x34')][_0xf661('0x35')]?_0x40f8b8[_0xf661('0x34')]:_0xfdbcdc[_0xf661('0x2e')];if(_0x1013be['query'][_0xf661('0x41')]){_0x40f8b8[_0xf661('0x42')]=[{'all':!![]}];}_0x40f8b8=_[_0xf661('0x3c')]({},_0x40f8b8,_0x1013be['options']);return db['Variable'][_0xf661('0x47')](_0x40f8b8)['then'](handleEntityNotFound(_0xba9d90,null))[_0xf661('0x20')](respondWithResult(_0xba9d90,null))[_0xf661('0x44')](handleError(_0xba9d90,null));};exports[_0xf661('0x48')]=function(_0x503aa2,_0xae571b){return db[_0xf661('0x40')][_0xf661('0x48')](_0x503aa2[_0xf661('0x49')],{})[_0xf661('0x20')](function(_0x427a09){var _0x48e90f=_0x503aa2[_0xf661('0x4a')][_0xf661('0x4b')]({'plain':!![]});if(!_0x48e90f)throw new Error(_0xf661('0x4c'));if(_0x48e90f['role']==='user'){var _0x596489=_0x427a09[_0xf661('0x4b')]({'plain':!![]});var _0x3b3a6a=_0xf661('0x21');return db[_0xf661('0x4d')][_0xf661('0x47')]({'where':{'name':_0x3b3a6a,'userProfileId':_0x48e90f[_0xf661('0x4e')]},'raw':!![]})[_0xf661('0x20')](function(_0x52b8c5){if(_0x52b8c5&&_0x52b8c5[_0xf661('0x4f')]===0x0){return db[_0xf661('0x22')][_0xf661('0x48')]({'name':_0x596489['name'],'resourceId':_0x596489['id'],'type':_0x52b8c5[_0xf661('0x3e')],'sectionId':_0x52b8c5['id']},{})[_0xf661('0x20')](function(){return _0x427a09;});}else{return _0x427a09;}})[_0xf661('0x44')](function(_0x597dd4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x597dd4);throw _0x597dd4;});}return _0x427a09;})[_0xf661('0x20')](respondWithResult(_0xae571b,0xc9))[_0xf661('0x44')](handleError(_0xae571b,null));};exports[_0xf661('0x50')]=function(_0x344fb8,_0xcabdb0){if(_0x344fb8['body']['id']){delete _0x344fb8[_0xf661('0x49')]['id'];}return db['Variable'][_0xf661('0x47')]({'where':{'id':_0x344fb8[_0xf661('0x46')]['id']}})[_0xf661('0x20')](handleEntityNotFound(_0xcabdb0,null))['then'](saveUpdates(_0x344fb8[_0xf661('0x49')],null))[_0xf661('0x20')](respondWithResult(_0xcabdb0,null))[_0xf661('0x44')](handleError(_0xcabdb0,null));};exports['destroy']=function(_0x1e8d6e,_0x225356){return db[_0xf661('0x40')][_0xf661('0x47')]({'where':{'id':_0x1e8d6e['params']['id']}})[_0xf661('0x20')](handleEntityNotFound(_0x225356,null))[_0xf661('0x20')](removeEntity(_0x225356,null))[_0xf661('0x44')](handleError(_0x225356,null));};
\ No newline at end of file
+var _0x1469=['merge','options','includeAll','include','rows','catch','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','map','Variable','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x58dd80,_0x28da73){var _0x11590e=function(_0x2affb8){while(--_0x2affb8){_0x58dd80['push'](_0x58dd80['shift']());}};_0x11590e(++_0x28da73);}(_0x1469,0x104));var _0x9146=function(_0x2c1dde,_0x3f5223){_0x2c1dde=_0x2c1dde-0x0;var _0x5279ba=_0x1469[_0x2c1dde];return _0x5279ba;};'use strict';var emlformat=require(_0x9146('0x0'));var rimraf=require(_0x9146('0x1'));var zipdir=require(_0x9146('0x2'));var jsonpatch=require(_0x9146('0x3'));var rp=require(_0x9146('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9146('0x5'));var util=require(_0x9146('0x6'));var path=require(_0x9146('0x7'));var sox=require(_0x9146('0x8'));var csv=require(_0x9146('0x9'));var ejs=require(_0x9146('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9146('0xb'));var squel=require(_0x9146('0xc'));var crypto=require(_0x9146('0xd'));var jsforce=require(_0x9146('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9146('0xf'));var Papa=require(_0x9146('0x10'));var Redis=require(_0x9146('0x11'));var authService=require(_0x9146('0x12'));var qs=require(_0x9146('0x13'));var as=require(_0x9146('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9146('0x15'))('api');var utils=require(_0x9146('0x16'));var config=require(_0x9146('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9146('0x18'))['db'];function respondWithStatusCode(_0x938b78,_0x22ae28){_0x22ae28=_0x22ae28||0xcc;return function(_0x5a6b74){if(_0x5a6b74){return _0x938b78[_0x9146('0x19')](_0x22ae28);}return _0x938b78['status'](_0x22ae28)[_0x9146('0x1a')]();};}function respondWithResult(_0x2c3c0f,_0x2a007e){_0x2a007e=_0x2a007e||0xc8;return function(_0x2c7b9d){if(_0x2c7b9d){return _0x2c3c0f[_0x9146('0x1b')](_0x2a007e)[_0x9146('0x1c')](_0x2c7b9d);}};}function respondWithFilteredResult(_0x23c364,_0x4952ba){return function(_0xe58949){if(_0xe58949){var _0x414d7e=typeof _0x4952ba[_0x9146('0x1d')]===_0x9146('0x1e')&&typeof _0x4952ba[_0x9146('0x1f')]===_0x9146('0x1e');var _0x596c55=_0xe58949['count'];var _0x5e2cf6=_0x414d7e?0x0:_0x4952ba['offset'];var _0x1cedfa=_0x414d7e?_0xe58949[_0x9146('0x20')]:_0x4952ba[_0x9146('0x1d')]+_0x4952ba[_0x9146('0x1f')];var _0x43312d;if(_0x1cedfa>=_0x596c55){_0x1cedfa=_0x596c55;_0x43312d=0xc8;}else{_0x43312d=0xce;}_0x23c364[_0x9146('0x1b')](_0x43312d);return _0x23c364['set'](_0x9146('0x21'),_0x5e2cf6+'-'+_0x1cedfa+'/'+_0x596c55)['json'](_0xe58949);}return null;};}function patchUpdates(_0x3145b3){return function(_0x1effd0){try{jsonpatch[_0x9146('0x22')](_0x1effd0,_0x3145b3,!![]);}catch(_0xacd279){return BPromise[_0x9146('0x23')](_0xacd279);}return _0x1effd0[_0x9146('0x24')]();};}function saveUpdates(_0x4e61a7,_0x430bb8){return function(_0x21b52c){if(_0x21b52c){return _0x21b52c[_0x9146('0x25')](_0x4e61a7)[_0x9146('0x26')](function(_0x49c05e){return _0x49c05e;});}return null;};}function removeEntity(_0x1a0b05,_0x5226f7){return function(_0x3dbf6a){if(_0x3dbf6a){return _0x3dbf6a[_0x9146('0x27')]()[_0x9146('0x26')](function(){var _0x8579c3=_0x3dbf6a[_0x9146('0x28')]({'plain':!![]});var _0x5082d4='Variables';return db['UserProfileResource'][_0x9146('0x27')]({'where':{'type':_0x5082d4,'resourceId':_0x8579c3['id']}})[_0x9146('0x26')](function(){return _0x3dbf6a;});})['then'](function(){_0x1a0b05['status'](0xcc)[_0x9146('0x1a')]();});}};}function handleEntityNotFound(_0x5b9a91,_0x238956){return function(_0x35a2f1){if(!_0x35a2f1){_0x5b9a91[_0x9146('0x19')](0x194);}return _0x35a2f1;};}function handleError(_0x5ac402,_0x440c4b){_0x440c4b=_0x440c4b||0x1f4;return function(_0x54dc77){logger[_0x9146('0x29')](_0x54dc77[_0x9146('0x2a')]);if(_0x54dc77['name']){delete _0x54dc77[_0x9146('0x2b')];}_0x5ac402[_0x9146('0x1b')](_0x440c4b)[_0x9146('0x2c')](_0x54dc77);};}exports[_0x9146('0x2d')]=function(_0x48f879,_0x376027){var _0x53b0f8={},_0x3de855={},_0x282481={'count':0x0,'rows':[]};var _0x21f7c6=_[_0x9146('0x2e')](db[_0x9146('0x2f')][_0x9146('0x30')],function(_0x3ae350){return{'name':_0x3ae350['fieldName'],'type':_0x3ae350[_0x9146('0x31')][_0x9146('0x32')]};});_0x3de855[_0x9146('0x33')]=_['map'](_0x21f7c6,'name');_0x3de855[_0x9146('0x34')]=_['keys'](_0x48f879[_0x9146('0x34')]);_0x3de855[_0x9146('0x35')]=_[_0x9146('0x36')](_0x3de855[_0x9146('0x33')],_0x3de855[_0x9146('0x34')]);_0x53b0f8[_0x9146('0x37')]=_[_0x9146('0x36')](_0x3de855[_0x9146('0x33')],qs[_0x9146('0x38')](_0x48f879[_0x9146('0x34')][_0x9146('0x38')]));_0x53b0f8[_0x9146('0x37')]=_0x53b0f8['attributes'][_0x9146('0x39')]?_0x53b0f8[_0x9146('0x37')]:_0x3de855['model'];if(!_0x48f879[_0x9146('0x34')][_0x9146('0x3a')](_0x9146('0x3b'))){_0x53b0f8[_0x9146('0x1f')]=qs['limit'](_0x48f879[_0x9146('0x34')][_0x9146('0x1f')]);_0x53b0f8[_0x9146('0x1d')]=qs[_0x9146('0x1d')](_0x48f879[_0x9146('0x34')][_0x9146('0x1d')]);}_0x53b0f8['order']=qs[_0x9146('0x3c')](_0x48f879[_0x9146('0x34')][_0x9146('0x3c')]);_0x53b0f8[_0x9146('0x3d')]=qs[_0x9146('0x35')](_[_0x9146('0x3e')](_0x48f879[_0x9146('0x34')],_0x3de855[_0x9146('0x35')]),_0x21f7c6);if(_0x48f879[_0x9146('0x34')][_0x9146('0x3f')]){_0x53b0f8[_0x9146('0x3d')]=_['merge'](_0x53b0f8[_0x9146('0x3d')],{'$or':_[_0x9146('0x2e')](_0x21f7c6,function(_0x4d181f){if(_0x4d181f['type']!=='VIRTUAL'){var _0x4a6bd8={};_0x4a6bd8[_0x4d181f[_0x9146('0x2b')]]={'$like':'%'+_0x48f879[_0x9146('0x34')][_0x9146('0x3f')]+'%'};return _0x4a6bd8;}})});}_0x53b0f8=_[_0x9146('0x40')]({},_0x53b0f8,_0x48f879[_0x9146('0x41')]);var _0x2ae9ae={'where':_0x53b0f8['where']};return db['Variable']['count'](_0x2ae9ae)[_0x9146('0x26')](function(_0x2322ab){_0x282481[_0x9146('0x20')]=_0x2322ab;if(_0x48f879[_0x9146('0x34')][_0x9146('0x42')]){_0x53b0f8[_0x9146('0x43')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x53b0f8);})[_0x9146('0x26')](function(_0x4185a7){_0x282481[_0x9146('0x44')]=_0x4185a7;return _0x282481;})['then'](respondWithFilteredResult(_0x376027,_0x53b0f8))[_0x9146('0x45')](handleError(_0x376027,null));};exports['show']=function(_0x33ab3b,_0x3bde5b){var _0x5682c7={'raw':!![],'where':{'id':_0x33ab3b['params']['id']}},_0x50f0a3={};_0x50f0a3[_0x9146('0x33')]=_[_0x9146('0x46')](db[_0x9146('0x2f')][_0x9146('0x30')]);_0x50f0a3[_0x9146('0x34')]=_[_0x9146('0x46')](_0x33ab3b[_0x9146('0x34')]);_0x50f0a3[_0x9146('0x35')]=_[_0x9146('0x36')](_0x50f0a3['model'],_0x50f0a3['query']);_0x5682c7[_0x9146('0x37')]=_[_0x9146('0x36')](_0x50f0a3[_0x9146('0x33')],qs[_0x9146('0x38')](_0x33ab3b[_0x9146('0x34')][_0x9146('0x38')]));_0x5682c7[_0x9146('0x37')]=_0x5682c7[_0x9146('0x37')][_0x9146('0x39')]?_0x5682c7[_0x9146('0x37')]:_0x50f0a3[_0x9146('0x33')];if(_0x33ab3b[_0x9146('0x34')]['includeAll']){_0x5682c7['include']=[{'all':!![]}];}_0x5682c7=_['merge']({},_0x5682c7,_0x33ab3b['options']);return db['Variable']['find'](_0x5682c7)[_0x9146('0x26')](handleEntityNotFound(_0x3bde5b,null))[_0x9146('0x26')](respondWithResult(_0x3bde5b,null))['catch'](handleError(_0x3bde5b,null));};exports[_0x9146('0x47')]=function(_0x4cd863,_0x259e1c){return db['Variable']['create'](_0x4cd863[_0x9146('0x48')],{})[_0x9146('0x26')](function(_0x44fe22){var _0x2a3655=_0x4cd863[_0x9146('0x49')][_0x9146('0x28')]({'plain':!![]});if(!_0x2a3655)throw new Error(_0x9146('0x4a'));if(_0x2a3655[_0x9146('0x4b')]===_0x9146('0x49')){var _0x2d9fc9=_0x44fe22['get']({'plain':!![]});var _0x48f670=_0x9146('0x4c');return db['UserProfileSection'][_0x9146('0x4d')]({'where':{'name':_0x48f670,'userProfileId':_0x2a3655['userProfileId']},'raw':!![]})[_0x9146('0x26')](function(_0x9bd68a){if(_0x9bd68a&&_0x9bd68a[_0x9146('0x4e')]===0x0){return db['UserProfileResource'][_0x9146('0x47')]({'name':_0x2d9fc9[_0x9146('0x2b')],'resourceId':_0x2d9fc9['id'],'type':_0x9bd68a[_0x9146('0x2b')],'sectionId':_0x9bd68a['id']},{})[_0x9146('0x26')](function(){return _0x44fe22;});}else{return _0x44fe22;}})[_0x9146('0x45')](function(_0x29fd61){logger[_0x9146('0x29')](_0x9146('0x4f'),_0x29fd61);throw _0x29fd61;});}return _0x44fe22;})[_0x9146('0x26')](respondWithResult(_0x259e1c,0xc9))['catch'](handleError(_0x259e1c,null));};exports[_0x9146('0x25')]=function(_0x4ce87f,_0x44ff94){if(_0x4ce87f[_0x9146('0x48')]['id']){delete _0x4ce87f['body']['id'];}return db[_0x9146('0x2f')]['find']({'where':{'id':_0x4ce87f['params']['id']}})['then'](handleEntityNotFound(_0x44ff94,null))[_0x9146('0x26')](saveUpdates(_0x4ce87f[_0x9146('0x48')],null))[_0x9146('0x26')](respondWithResult(_0x44ff94,null))['catch'](handleError(_0x44ff94,null));};exports['destroy']=function(_0x43c2de,_0x4f8479){return db[_0x9146('0x2f')][_0x9146('0x4d')]({'where':{'id':_0x43c2de[_0x9146('0x50')]['id']}})[_0x9146('0x26')](handleEntityNotFound(_0x4f8479,null))['then'](removeEntity(_0x4f8479,null))[_0x9146('0x45')](handleError(_0x4f8479,null));};
\ No newline at end of file