Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / variable / variable.controller.js
index fa7a9b9..ba0055a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xae5d=['userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','json','offset','limit','status','set','Content-Range','save','update','then','destroy','get','UserProfileResource','stack','name','index','Variable','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables'];(function(_0x30b836,_0x5a2f15){var _0xa4a102=function(_0x55cbad){while(--_0x55cbad){_0x30b836['push'](_0x30b836['shift']());}};_0xa4a102(++_0x5a2f15);}(_0xae5d,0xa5));var _0xdae5=function(_0x25cd2c,_0x57498e){_0x25cd2c=_0x25cd2c-0x0;var _0x1e364c=_0xae5d[_0x25cd2c];return _0x1e364c;};'use strict';var pdf=require(_0xdae5('0x0'));var emlformat=require(_0xdae5('0x1'));var rimraf=require(_0xdae5('0x2'));var zipdir=require(_0xdae5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdae5('0x4'));var BPromise=require(_0xdae5('0x5'));var Mustache=require(_0xdae5('0x6'));var util=require(_0xdae5('0x7'));var path=require(_0xdae5('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdae5('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdae5('0xa'));var crypto=require(_0xdae5('0xb'));var jsforce=require(_0xdae5('0xc'));var deskjs=require(_0xdae5('0xd'));var toCsv=require(_0xdae5('0xe'));var querystring=require(_0xdae5('0xf'));var Papa=require('papaparse');var Redis=require(_0xdae5('0x10'));var authService=require(_0xdae5('0x11'));var qs=require(_0xdae5('0x12'));var as=require(_0xdae5('0x13'));var hardwareService=require(_0xdae5('0x14'));var logger=require(_0xdae5('0x15'))(_0xdae5('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdae5('0x17'))['db'];function respondWithStatusCode(_0x49f809,_0xecaecc){_0xecaecc=_0xecaecc||0xcc;return function(_0x2a79c5){if(_0x2a79c5){return _0x49f809[_0xdae5('0x18')](_0xecaecc);}return _0x49f809['status'](_0xecaecc)[_0xdae5('0x19')]();};}function respondWithResult(_0x1b1abc,_0xb67928){_0xb67928=_0xb67928||0xc8;return function(_0x46282d){if(_0x46282d){return _0x1b1abc['status'](_0xb67928)[_0xdae5('0x1a')](_0x46282d);}};}function respondWithFilteredResult(_0x3977f2,_0x371ef2){return function(_0x190c5b){if(_0x190c5b){var _0xf55b4c=_0x190c5b['count'],_0x402863=_0x371ef2[_0xdae5('0x1b')],_0x34e454=_0x371ef2[_0xdae5('0x1b')]+_0x371ef2[_0xdae5('0x1c')],_0x478581;if(_0x34e454>=_0xf55b4c){_0x34e454=_0xf55b4c;_0x478581=0xc8;}else{_0x478581=0xce;}_0x3977f2[_0xdae5('0x1d')](_0x478581);return _0x3977f2[_0xdae5('0x1e')](_0xdae5('0x1f'),_0x402863+'-'+_0x34e454+'/'+_0xf55b4c)[_0xdae5('0x1a')](_0x190c5b);}return null;};}function patchUpdates(_0x218ed2){return function(_0x27ba87){try{jsonpatch['apply'](_0x27ba87,_0x218ed2,!![]);}catch(_0x15d73a){return BPromise['reject'](_0x15d73a);}return _0x27ba87[_0xdae5('0x20')]();};}function saveUpdates(_0x3e517c,_0x4f2e8c){return function(_0x127476){if(_0x127476){return _0x127476[_0xdae5('0x21')](_0x3e517c)[_0xdae5('0x22')](function(_0x583871){return _0x583871;});}return null;};}function removeEntity(_0x2e03db,_0x264629){return function(_0x4e9bdd){if(_0x4e9bdd){return _0x4e9bdd[_0xdae5('0x23')]()[_0xdae5('0x22')](function(){var _0x83e9af=_0x4e9bdd[_0xdae5('0x24')]({'plain':!![]});var _0x55332e='Variables';return db[_0xdae5('0x25')][_0xdae5('0x23')]({'where':{'type':_0x55332e,'resourceId':_0x83e9af['id']}})[_0xdae5('0x22')](function(){return _0x4e9bdd;});})['then'](function(){_0x2e03db[_0xdae5('0x1d')](0xcc)[_0xdae5('0x19')]();});}};}function handleEntityNotFound(_0x1e7962,_0x59c8a8){return function(_0x1559a2){if(!_0x1559a2){_0x1e7962[_0xdae5('0x18')](0x194);}return _0x1559a2;};}function handleError(_0x301443,_0x5a6f3d){_0x5a6f3d=_0x5a6f3d||0x1f4;return function(_0x15b8b1){logger['error'](_0x15b8b1[_0xdae5('0x26')]);if(_0x15b8b1[_0xdae5('0x27')]){delete _0x15b8b1[_0xdae5('0x27')];}_0x301443[_0xdae5('0x1d')](_0x5a6f3d)['send'](_0x15b8b1);};}exports[_0xdae5('0x28')]=function(_0x3b0098,_0x414f72){var _0x287086={},_0x3a1117={},_0xb2987d={'count':0x0,'rows':[]};var _0x4e506c=_['map'](db[_0xdae5('0x29')][_0xdae5('0x2a')],function(_0xedc21f){return{'name':_0xedc21f[_0xdae5('0x2b')],'type':_0xedc21f[_0xdae5('0x2c')][_0xdae5('0x2d')]};});_0x3a1117[_0xdae5('0x2e')]=_['map'](_0x4e506c,_0xdae5('0x27'));_0x3a1117['query']=_[_0xdae5('0x2f')](_0x3b0098[_0xdae5('0x30')]);_0x3a1117[_0xdae5('0x31')]=_[_0xdae5('0x32')](_0x3a1117[_0xdae5('0x2e')],_0x3a1117[_0xdae5('0x30')]);_0x287086['attributes']=_[_0xdae5('0x32')](_0x3a1117[_0xdae5('0x2e')],qs[_0xdae5('0x33')](_0x3b0098[_0xdae5('0x30')][_0xdae5('0x33')]));_0x287086['attributes']=_0x287086[_0xdae5('0x34')]['length']?_0x287086['attributes']:_0x3a1117[_0xdae5('0x2e')];if(!_0x3b0098[_0xdae5('0x30')][_0xdae5('0x35')](_0xdae5('0x36'))){_0x287086[_0xdae5('0x1c')]=qs['limit'](_0x3b0098[_0xdae5('0x30')][_0xdae5('0x1c')]);_0x287086[_0xdae5('0x1b')]=qs[_0xdae5('0x1b')](_0x3b0098[_0xdae5('0x30')][_0xdae5('0x1b')]);}_0x287086[_0xdae5('0x37')]=qs[_0xdae5('0x38')](_0x3b0098['query'][_0xdae5('0x38')]);_0x287086[_0xdae5('0x39')]=qs[_0xdae5('0x31')](_[_0xdae5('0x3a')](_0x3b0098[_0xdae5('0x30')],_0x3a1117[_0xdae5('0x31')]),_0x4e506c);if(_0x3b0098[_0xdae5('0x30')]['filter']){_0x287086[_0xdae5('0x39')]=_[_0xdae5('0x3b')](_0x287086['where'],{'$or':_['map'](_0x4e506c,function(_0x18ca03){if(_0x18ca03[_0xdae5('0x2c')]!==_0xdae5('0x3c')){var _0x5c8704={};_0x5c8704[_0x18ca03[_0xdae5('0x27')]]={'$like':'%'+_0x3b0098['query'][_0xdae5('0x3d')]+'%'};return _0x5c8704;}})});}_0x287086=_['merge']({},_0x287086,_0x3b0098[_0xdae5('0x3e')]);var _0x1f0507={'where':_0x287086['where']};return db['Variable']['count'](_0x1f0507)[_0xdae5('0x22')](function(_0x3e4986){_0xb2987d['count']=_0x3e4986;if(_0x3b0098[_0xdae5('0x30')][_0xdae5('0x3f')]){_0x287086[_0xdae5('0x40')]=[{'all':!![]}];}return db[_0xdae5('0x29')]['findAll'](_0x287086);})[_0xdae5('0x22')](function(_0x250de8){_0xb2987d['rows']=_0x250de8;return _0xb2987d;})[_0xdae5('0x22')](respondWithFilteredResult(_0x414f72,_0x287086))[_0xdae5('0x41')](handleError(_0x414f72,null));};exports[_0xdae5('0x42')]=function(_0x13e4ed,_0x517e74){var _0x2e73ab={'raw':!![],'where':{'id':_0x13e4ed['params']['id']}},_0x548f94={};_0x548f94['model']=_['keys'](db['Variable'][_0xdae5('0x2a')]);_0x548f94[_0xdae5('0x30')]=_[_0xdae5('0x2f')](_0x13e4ed[_0xdae5('0x30')]);_0x548f94[_0xdae5('0x31')]=_[_0xdae5('0x32')](_0x548f94[_0xdae5('0x2e')],_0x548f94[_0xdae5('0x30')]);_0x2e73ab[_0xdae5('0x34')]=_[_0xdae5('0x32')](_0x548f94[_0xdae5('0x2e')],qs[_0xdae5('0x33')](_0x13e4ed['query'][_0xdae5('0x33')]));_0x2e73ab[_0xdae5('0x34')]=_0x2e73ab[_0xdae5('0x34')][_0xdae5('0x43')]?_0x2e73ab[_0xdae5('0x34')]:_0x548f94[_0xdae5('0x2e')];if(_0x13e4ed['query']['includeAll']){_0x2e73ab[_0xdae5('0x40')]=[{'all':!![]}];}_0x2e73ab=_['merge']({},_0x2e73ab,_0x13e4ed[_0xdae5('0x3e')]);return db[_0xdae5('0x29')][_0xdae5('0x44')](_0x2e73ab)[_0xdae5('0x22')](handleEntityNotFound(_0x517e74,null))[_0xdae5('0x22')](respondWithResult(_0x517e74,null))['catch'](handleError(_0x517e74,null));};exports[_0xdae5('0x45')]=function(_0x1feaac,_0x4865dc){return db[_0xdae5('0x29')]['create'](_0x1feaac[_0xdae5('0x46')],{})[_0xdae5('0x22')](function(_0x2f6adb){var _0x5419e5=_0x1feaac[_0xdae5('0x47')]['get']({'plain':!![]});if(!_0x5419e5)throw new Error(_0xdae5('0x48'));if(_0x5419e5[_0xdae5('0x49')]===_0xdae5('0x47')){var _0x1e57b2=_0x2f6adb[_0xdae5('0x24')]({'plain':!![]});var _0x16f3b8=_0xdae5('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x16f3b8,'userProfileId':_0x5419e5[_0xdae5('0x4b')]},'raw':!![]})[_0xdae5('0x22')](function(_0x42c986){if(_0x42c986&&_0x42c986[_0xdae5('0x4c')]===0x0){return db[_0xdae5('0x25')][_0xdae5('0x45')]({'name':_0x1e57b2[_0xdae5('0x27')],'resourceId':_0x1e57b2['id'],'type':_0x42c986[_0xdae5('0x27')],'sectionId':_0x42c986['id']},{})['then'](function(){return _0x2f6adb;});}else{return _0x2f6adb;}})[_0xdae5('0x41')](function(_0x2913bf){logger[_0xdae5('0x4d')](_0xdae5('0x4e'),_0x2913bf);throw _0x2913bf;});}return _0x2f6adb;})[_0xdae5('0x22')](respondWithResult(_0x4865dc,0xc9))[_0xdae5('0x41')](handleError(_0x4865dc,null));};exports[_0xdae5('0x21')]=function(_0x384a0f,_0x3cc2d4){if(_0x384a0f[_0xdae5('0x46')]['id']){delete _0x384a0f['body']['id'];}return db[_0xdae5('0x29')][_0xdae5('0x44')]({'where':{'id':_0x384a0f[_0xdae5('0x4f')]['id']}})[_0xdae5('0x22')](handleEntityNotFound(_0x3cc2d4,null))['then'](saveUpdates(_0x384a0f[_0xdae5('0x46')],null))['then'](respondWithResult(_0x3cc2d4,null))['catch'](handleError(_0x3cc2d4,null));};exports[_0xdae5('0x23')]=function(_0x261c2f,_0x556be3){return db['Variable'][_0xdae5('0x44')]({'where':{'id':_0x261c2f[_0xdae5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x556be3,null))['then'](removeEntity(_0x556be3,null))[_0xdae5('0x41')](handleError(_0x556be3,null));};
\ No newline at end of file
+var _0xaeef=['catch','show','params','intersection','options','create','body','user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','Variables','UserProfileResource','sendStatus','error','stack','name','send','index','Variable','rawAttributes','fieldName','type','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x28c776,_0x32db20){var _0x25ec69=function(_0x479216){while(--_0x479216){_0x28c776['push'](_0x28c776['shift']());}};_0x25ec69(++_0x32db20);}(_0xaeef,0xae));var _0xfaee=function(_0x51bd6b,_0x409463){_0x51bd6b=_0x51bd6b-0x0;var _0x39cf82=_0xaeef[_0x51bd6b];return _0x39cf82;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfaee('0x0'));var moment=require(_0xfaee('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfaee('0x2'));var path=require(_0xfaee('0x3'));var sox=require(_0xfaee('0x4'));var csv=require('to-csv');var ejs=require(_0xfaee('0x5'));var fs=require('fs');var fs_extra=require(_0xfaee('0x6'));var _=require(_0xfaee('0x7'));var squel=require(_0xfaee('0x8'));var crypto=require(_0xfaee('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfaee('0xa'));var querystring=require(_0xfaee('0xb'));var Papa=require(_0xfaee('0xc'));var Redis=require(_0xfaee('0xd'));var authService=require(_0xfaee('0xe'));var qs=require(_0xfaee('0xf'));var as=require(_0xfaee('0x10'));var hardwareService=require(_0xfaee('0x11'));var logger=require(_0xfaee('0x12'))('api');var utils=require(_0xfaee('0x13'));var config=require(_0xfaee('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xfaee('0x15'))['db'];function respondWithStatusCode(_0x8a0048,_0x207ce1){_0x207ce1=_0x207ce1||0xcc;return function(_0x262bbc){if(_0x262bbc){return _0x8a0048['sendStatus'](_0x207ce1);}return _0x8a0048[_0xfaee('0x16')](_0x207ce1)[_0xfaee('0x17')]();};}function respondWithResult(_0x4ee364,_0x798c5){_0x798c5=_0x798c5||0xc8;return function(_0x58c9d6){if(_0x58c9d6){return _0x4ee364[_0xfaee('0x16')](_0x798c5)[_0xfaee('0x18')](_0x58c9d6);}};}function respondWithFilteredResult(_0x40eb43,_0x4cf216){return function(_0x2103b4){if(_0x2103b4){var _0x49a9c2=typeof _0x4cf216[_0xfaee('0x19')]===_0xfaee('0x1a')&&typeof _0x4cf216[_0xfaee('0x1b')]===_0xfaee('0x1a');var _0x40aa1b=_0x2103b4['count'];var _0x488661=_0x49a9c2?0x0:_0x4cf216[_0xfaee('0x19')];var _0x3e5445=_0x49a9c2?_0x2103b4[_0xfaee('0x1c')]:_0x4cf216[_0xfaee('0x19')]+_0x4cf216[_0xfaee('0x1b')];var _0x338679;if(_0x3e5445>=_0x40aa1b){_0x3e5445=_0x40aa1b;_0x338679=0xc8;}else{_0x338679=0xce;}_0x40eb43['status'](_0x338679);return _0x40eb43[_0xfaee('0x1d')]('Content-Range',_0x488661+'-'+_0x3e5445+'/'+_0x40aa1b)[_0xfaee('0x18')](_0x2103b4);}return null;};}function patchUpdates(_0x16e9f2){return function(_0x5a80ec){try{jsonpatch[_0xfaee('0x1e')](_0x5a80ec,_0x16e9f2,!![]);}catch(_0x591410){return BPromise[_0xfaee('0x1f')](_0x591410);}return _0x5a80ec[_0xfaee('0x20')]();};}function saveUpdates(_0x645ca2,_0x17900f){return function(_0x33c889){if(_0x33c889){return _0x33c889[_0xfaee('0x21')](_0x645ca2)['then'](function(_0x46a908){return _0x46a908;});}return null;};}function removeEntity(_0x1c8961,_0x448313){return function(_0x7ad79a){if(_0x7ad79a){return _0x7ad79a[_0xfaee('0x22')]()[_0xfaee('0x23')](function(){var _0x33de47=_0x7ad79a[_0xfaee('0x24')]({'plain':!![]});var _0x2ee06c=_0xfaee('0x25');return db[_0xfaee('0x26')][_0xfaee('0x22')]({'where':{'type':_0x2ee06c,'resourceId':_0x33de47['id']}})[_0xfaee('0x23')](function(){return _0x7ad79a;});})[_0xfaee('0x23')](function(){_0x1c8961['status'](0xcc)[_0xfaee('0x17')]();});}};}function handleEntityNotFound(_0x4e4973,_0x127817){return function(_0x5809a0){if(!_0x5809a0){_0x4e4973[_0xfaee('0x27')](0x194);}return _0x5809a0;};}function handleError(_0x2065f0,_0x172654){_0x172654=_0x172654||0x1f4;return function(_0x70ef6a){logger[_0xfaee('0x28')](_0x70ef6a[_0xfaee('0x29')]);if(_0x70ef6a['name']){delete _0x70ef6a[_0xfaee('0x2a')];}_0x2065f0[_0xfaee('0x16')](_0x172654)[_0xfaee('0x2b')](_0x70ef6a);};}exports[_0xfaee('0x2c')]=function(_0x129196,_0x509085){var _0x4a4c61={},_0x4f7e7c={},_0x218fdb={'count':0x0,'rows':[]};var _0x23ea2b=_['map'](db[_0xfaee('0x2d')][_0xfaee('0x2e')],function(_0x28b170){return{'name':_0x28b170[_0xfaee('0x2f')],'type':_0x28b170[_0xfaee('0x30')]['key']};});_0x4f7e7c[_0xfaee('0x31')]=_[_0xfaee('0x32')](_0x23ea2b,_0xfaee('0x2a'));_0x4f7e7c[_0xfaee('0x33')]=_[_0xfaee('0x34')](_0x129196[_0xfaee('0x33')]);_0x4f7e7c['filters']=_['intersection'](_0x4f7e7c[_0xfaee('0x31')],_0x4f7e7c['query']);_0x4a4c61[_0xfaee('0x35')]=_['intersection'](_0x4f7e7c[_0xfaee('0x31')],qs[_0xfaee('0x36')](_0x129196[_0xfaee('0x33')]['fields']));_0x4a4c61['attributes']=_0x4a4c61[_0xfaee('0x35')][_0xfaee('0x37')]?_0x4a4c61[_0xfaee('0x35')]:_0x4f7e7c[_0xfaee('0x31')];if(!_0x129196[_0xfaee('0x33')][_0xfaee('0x38')](_0xfaee('0x39'))){_0x4a4c61[_0xfaee('0x1b')]=qs['limit'](_0x129196['query'][_0xfaee('0x1b')]);_0x4a4c61['offset']=qs[_0xfaee('0x19')](_0x129196[_0xfaee('0x33')]['offset']);}_0x4a4c61[_0xfaee('0x3a')]=qs['sort'](_0x129196[_0xfaee('0x33')][_0xfaee('0x3b')]);_0x4a4c61[_0xfaee('0x3c')]=qs[_0xfaee('0x3d')](_[_0xfaee('0x3e')](_0x129196[_0xfaee('0x33')],_0x4f7e7c[_0xfaee('0x3d')]),_0x23ea2b);if(_0x129196[_0xfaee('0x33')][_0xfaee('0x3f')]){_0x4a4c61[_0xfaee('0x3c')]=_[_0xfaee('0x40')](_0x4a4c61['where'],{'$or':_[_0xfaee('0x32')](_0x23ea2b,function(_0x55b54a){if(_0x55b54a[_0xfaee('0x30')]!==_0xfaee('0x41')){var _0x1653fa={};_0x1653fa[_0x55b54a[_0xfaee('0x2a')]]={'$like':'%'+_0x129196[_0xfaee('0x33')][_0xfaee('0x3f')]+'%'};return _0x1653fa;}})});}_0x4a4c61=_[_0xfaee('0x40')]({},_0x4a4c61,_0x129196['options']);var _0x4829f5={'where':_0x4a4c61[_0xfaee('0x3c')]};return db[_0xfaee('0x2d')][_0xfaee('0x1c')](_0x4829f5)[_0xfaee('0x23')](function(_0x214cb5){_0x218fdb[_0xfaee('0x1c')]=_0x214cb5;if(_0x129196['query'][_0xfaee('0x42')]){_0x4a4c61[_0xfaee('0x43')]=[{'all':!![]}];}return db[_0xfaee('0x2d')][_0xfaee('0x44')](_0x4a4c61);})['then'](function(_0x57335e){_0x218fdb['rows']=_0x57335e;return _0x218fdb;})['then'](respondWithFilteredResult(_0x509085,_0x4a4c61))[_0xfaee('0x45')](handleError(_0x509085,null));};exports[_0xfaee('0x46')]=function(_0x2a1020,_0x4b1fb5){var _0x5c4219={'raw':!![],'where':{'id':_0x2a1020[_0xfaee('0x47')]['id']}},_0x4094f7={};_0x4094f7[_0xfaee('0x31')]=_['keys'](db[_0xfaee('0x2d')][_0xfaee('0x2e')]);_0x4094f7[_0xfaee('0x33')]=_[_0xfaee('0x34')](_0x2a1020['query']);_0x4094f7[_0xfaee('0x3d')]=_[_0xfaee('0x48')](_0x4094f7[_0xfaee('0x31')],_0x4094f7['query']);_0x5c4219['attributes']=_[_0xfaee('0x48')](_0x4094f7[_0xfaee('0x31')],qs[_0xfaee('0x36')](_0x2a1020[_0xfaee('0x33')][_0xfaee('0x36')]));_0x5c4219[_0xfaee('0x35')]=_0x5c4219[_0xfaee('0x35')][_0xfaee('0x37')]?_0x5c4219[_0xfaee('0x35')]:_0x4094f7['model'];if(_0x2a1020['query'][_0xfaee('0x42')]){_0x5c4219['include']=[{'all':!![]}];}_0x5c4219=_[_0xfaee('0x40')]({},_0x5c4219,_0x2a1020[_0xfaee('0x49')]);return db[_0xfaee('0x2d')]['find'](_0x5c4219)[_0xfaee('0x23')](handleEntityNotFound(_0x4b1fb5,null))[_0xfaee('0x23')](respondWithResult(_0x4b1fb5,null))[_0xfaee('0x45')](handleError(_0x4b1fb5,null));};exports[_0xfaee('0x4a')]=function(_0x2758af,_0x486ad5){return db[_0xfaee('0x2d')][_0xfaee('0x4a')](_0x2758af[_0xfaee('0x4b')],{})[_0xfaee('0x23')](function(_0x1a77db){var _0x133555=_0x2758af[_0xfaee('0x4c')][_0xfaee('0x24')]({'plain':!![]});if(!_0x133555)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x133555[_0xfaee('0x4d')]==='user'){var _0x10ed38=_0x1a77db[_0xfaee('0x24')]({'plain':!![]});var _0x10bf7d=_0xfaee('0x25');return db['UserProfileSection'][_0xfaee('0x4e')]({'where':{'name':_0x10bf7d,'userProfileId':_0x133555[_0xfaee('0x4f')]},'raw':!![]})[_0xfaee('0x23')](function(_0x127cda){if(_0x127cda&&_0x127cda['autoAssociation']===0x0){return db[_0xfaee('0x26')]['create']({'name':_0x10ed38[_0xfaee('0x2a')],'resourceId':_0x10ed38['id'],'type':_0x127cda[_0xfaee('0x2a')],'sectionId':_0x127cda['id']},{})[_0xfaee('0x23')](function(){return _0x1a77db;});}else{return _0x1a77db;}})[_0xfaee('0x45')](function(_0x19723d){logger[_0xfaee('0x28')](_0xfaee('0x50'),_0x19723d);throw _0x19723d;});}return _0x1a77db;})[_0xfaee('0x23')](respondWithResult(_0x486ad5,0xc9))['catch'](handleError(_0x486ad5,null));};exports[_0xfaee('0x21')]=function(_0x3ac772,_0x54c1ba){if(_0x3ac772['body']['id']){delete _0x3ac772[_0xfaee('0x4b')]['id'];}return db[_0xfaee('0x2d')][_0xfaee('0x4e')]({'where':{'id':_0x3ac772[_0xfaee('0x47')]['id']}})['then'](handleEntityNotFound(_0x54c1ba,null))[_0xfaee('0x23')](saveUpdates(_0x3ac772[_0xfaee('0x4b')],null))[_0xfaee('0x23')](respondWithResult(_0x54c1ba,null))[_0xfaee('0x45')](handleError(_0x54c1ba,null));};exports[_0xfaee('0x22')]=function(_0x2509ab,_0x3f7025){return db[_0xfaee('0x2d')][_0xfaee('0x4e')]({'where':{'id':_0x2509ab['params']['id']}})['then'](handleEntityNotFound(_0x3f7025,null))[_0xfaee('0x23')](removeEntity(_0x3f7025,null))['catch'](handleError(_0x3f7025,null));};
\ No newline at end of file