Built motion from commit 44b1f254.|2.6.26
[motion2.git] / server / api / template / template.controller.js
index b00b254..30509f1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2b87=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','save','then','destroy','Templates','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','Template','findAll','rows','show','params','keys','merge','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce'];(function(_0x5d30b4,_0x199248){var _0x1acfb8=function(_0x3544b2){while(--_0x3544b2){_0x5d30b4['push'](_0x5d30b4['shift']());}};_0x1acfb8(++_0x199248);}(_0x2b87,0x93));var _0x72b8=function(_0x48f5f1,_0x52906c){_0x48f5f1=_0x48f5f1-0x0;var _0x3f36a4=_0x2b87[_0x48f5f1];return _0x3f36a4;};'use strict';var emlformat=require(_0x72b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x72b8('0x1'));var jsonpatch=require(_0x72b8('0x2'));var rp=require(_0x72b8('0x3'));var moment=require(_0x72b8('0x4'));var BPromise=require(_0x72b8('0x5'));var Mustache=require(_0x72b8('0x6'));var util=require('util');var path=require(_0x72b8('0x7'));var sox=require(_0x72b8('0x8'));var csv=require(_0x72b8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72b8('0xa'));var _=require('lodash');var squel=require(_0x72b8('0xb'));var crypto=require('crypto');var jsforce=require(_0x72b8('0xc'));var deskjs=require(_0x72b8('0xd'));var toCsv=require(_0x72b8('0x9'));var querystring=require(_0x72b8('0xe'));var Papa=require(_0x72b8('0xf'));var Redis=require('ioredis');var authService=require(_0x72b8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x72b8('0x11'));var hardwareService=require(_0x72b8('0x12'));var logger=require(_0x72b8('0x13'))(_0x72b8('0x14'));var utils=require('../../config/utils');var config=require(_0x72b8('0x15'));var licenseUtil=require(_0x72b8('0x16'));var db=require(_0x72b8('0x17'))['db'];function respondWithStatusCode(_0x5f597f,_0x5c253c){_0x5c253c=_0x5c253c||0xcc;return function(_0x3284fd){if(_0x3284fd){return _0x5f597f[_0x72b8('0x18')](_0x5c253c);}return _0x5f597f[_0x72b8('0x19')](_0x5c253c)[_0x72b8('0x1a')]();};}function respondWithResult(_0x3a549d,_0x123975){_0x123975=_0x123975||0xc8;return function(_0x2d22eb){if(_0x2d22eb){return _0x3a549d[_0x72b8('0x19')](_0x123975)[_0x72b8('0x1b')](_0x2d22eb);}};}function respondWithFilteredResult(_0x5ecc0c,_0x31c43c){return function(_0x175206){if(_0x175206){var _0x2de30f=typeof _0x31c43c[_0x72b8('0x1c')]===_0x72b8('0x1d')&&typeof _0x31c43c['limit']===_0x72b8('0x1d');var _0x46842a=_0x175206['count'];var _0x575ee9=_0x2de30f?0x0:_0x31c43c[_0x72b8('0x1c')];var _0x5713fe=_0x2de30f?_0x175206[_0x72b8('0x1e')]:_0x31c43c[_0x72b8('0x1c')]+_0x31c43c[_0x72b8('0x1f')];var _0x4e0b52;if(_0x5713fe>=_0x46842a){_0x5713fe=_0x46842a;_0x4e0b52=0xc8;}else{_0x4e0b52=0xce;}_0x5ecc0c[_0x72b8('0x19')](_0x4e0b52);return _0x5ecc0c['set']('Content-Range',_0x575ee9+'-'+_0x5713fe+'/'+_0x46842a)[_0x72b8('0x1b')](_0x175206);}return null;};}function patchUpdates(_0x2224e0){return function(_0x1a13a4){try{jsonpatch['apply'](_0x1a13a4,_0x2224e0,!![]);}catch(_0x228b65){return BPromise['reject'](_0x228b65);}return _0x1a13a4[_0x72b8('0x20')]();};}function saveUpdates(_0x4a743c,_0x358e1c){return function(_0x1d9456){if(_0x1d9456){return _0x1d9456['update'](_0x4a743c)[_0x72b8('0x21')](function(_0x1e2f35){return _0x1e2f35;});}return null;};}function removeEntity(_0x596046,_0x17f23d){return function(_0x7906b7){if(_0x7906b7){return _0x7906b7[_0x72b8('0x22')]()[_0x72b8('0x21')](function(){var _0x58af95=_0x7906b7['get']({'plain':!![]});var _0x3c9b2b=_0x72b8('0x23');return db[_0x72b8('0x24')][_0x72b8('0x22')]({'where':{'type':_0x3c9b2b,'resourceId':_0x58af95['id']}})[_0x72b8('0x21')](function(){return _0x7906b7;});})['then'](function(){_0x596046[_0x72b8('0x19')](0xcc)[_0x72b8('0x1a')]();});}};}function handleEntityNotFound(_0x3ed8a7,_0x5b586a){return function(_0x34c5f9){if(!_0x34c5f9){_0x3ed8a7[_0x72b8('0x18')](0x194);}return _0x34c5f9;};}function handleError(_0x1ba1d1,_0x3eacb4){_0x3eacb4=_0x3eacb4||0x1f4;return function(_0x1b5cdc){logger[_0x72b8('0x25')](_0x1b5cdc[_0x72b8('0x26')]);if(_0x1b5cdc['name']){delete _0x1b5cdc[_0x72b8('0x27')];}_0x1ba1d1[_0x72b8('0x19')](_0x3eacb4)[_0x72b8('0x28')](_0x1b5cdc);};}exports['index']=function(_0x5e35de,_0x380fb7){var _0x59e418={},_0x57cceb={},_0x452a78={'count':0x0,'rows':[]};var _0x1cdd6c=_[_0x72b8('0x29')](db['Template'][_0x72b8('0x2a')],function(_0x58537){return{'name':_0x58537[_0x72b8('0x2b')],'type':_0x58537[_0x72b8('0x2c')][_0x72b8('0x2d')]};});_0x57cceb[_0x72b8('0x2e')]=_[_0x72b8('0x29')](_0x1cdd6c,_0x72b8('0x27'));_0x57cceb['query']=_['keys'](_0x5e35de[_0x72b8('0x2f')]);_0x57cceb[_0x72b8('0x30')]=_['intersection'](_0x57cceb['model'],_0x57cceb[_0x72b8('0x2f')]);_0x59e418[_0x72b8('0x31')]=_[_0x72b8('0x32')](_0x57cceb[_0x72b8('0x2e')],qs[_0x72b8('0x33')](_0x5e35de['query'][_0x72b8('0x33')]));_0x59e418[_0x72b8('0x31')]=_0x59e418[_0x72b8('0x31')][_0x72b8('0x34')]?_0x59e418[_0x72b8('0x31')]:_0x57cceb[_0x72b8('0x2e')];if(!_0x5e35de[_0x72b8('0x2f')]['hasOwnProperty'](_0x72b8('0x35'))){_0x59e418[_0x72b8('0x1f')]=qs[_0x72b8('0x1f')](_0x5e35de[_0x72b8('0x2f')]['limit']);_0x59e418[_0x72b8('0x1c')]=qs['offset'](_0x5e35de[_0x72b8('0x2f')][_0x72b8('0x1c')]);}_0x59e418[_0x72b8('0x36')]=qs[_0x72b8('0x37')](_0x5e35de[_0x72b8('0x2f')][_0x72b8('0x37')]);_0x59e418[_0x72b8('0x38')]=qs[_0x72b8('0x30')](_['pick'](_0x5e35de[_0x72b8('0x2f')],_0x57cceb['filters']),_0x1cdd6c);if(_0x5e35de['query'][_0x72b8('0x39')]){_0x59e418[_0x72b8('0x38')]=_['merge'](_0x59e418[_0x72b8('0x38')],{'$or':_[_0x72b8('0x29')](_0x1cdd6c,function(_0x300bc7){if(_0x300bc7[_0x72b8('0x2c')]!==_0x72b8('0x3a')){var _0x1cd9c9={};_0x1cd9c9[_0x300bc7[_0x72b8('0x27')]]={'$like':'%'+_0x5e35de[_0x72b8('0x2f')]['filter']+'%'};return _0x1cd9c9;}})});}_0x59e418=_['merge']({},_0x59e418,_0x5e35de[_0x72b8('0x3b')]);var _0x358b0b={'where':_0x59e418['where']};return db['Template'][_0x72b8('0x1e')](_0x358b0b)[_0x72b8('0x21')](function(_0x35a0bb){_0x452a78[_0x72b8('0x1e')]=_0x35a0bb;if(_0x5e35de[_0x72b8('0x2f')][_0x72b8('0x3c')]){_0x59e418[_0x72b8('0x3d')]=[{'all':!![]}];}return db[_0x72b8('0x3e')][_0x72b8('0x3f')](_0x59e418);})[_0x72b8('0x21')](function(_0xf792ca){_0x452a78[_0x72b8('0x40')]=_0xf792ca;return _0x452a78;})[_0x72b8('0x21')](respondWithFilteredResult(_0x380fb7,_0x59e418))['catch'](handleError(_0x380fb7,null));};exports[_0x72b8('0x41')]=function(_0x4cb318,_0x3dff97){var _0x2accbe={'raw':!![],'where':{'id':_0x4cb318[_0x72b8('0x42')]['id']}},_0x4bd36e={};_0x4bd36e[_0x72b8('0x2e')]=_[_0x72b8('0x43')](db[_0x72b8('0x3e')]['rawAttributes']);_0x4bd36e[_0x72b8('0x2f')]=_[_0x72b8('0x43')](_0x4cb318['query']);_0x4bd36e['filters']=_[_0x72b8('0x32')](_0x4bd36e[_0x72b8('0x2e')],_0x4bd36e[_0x72b8('0x2f')]);_0x2accbe[_0x72b8('0x31')]=_[_0x72b8('0x32')](_0x4bd36e['model'],qs[_0x72b8('0x33')](_0x4cb318['query'][_0x72b8('0x33')]));_0x2accbe[_0x72b8('0x31')]=_0x2accbe['attributes'][_0x72b8('0x34')]?_0x2accbe[_0x72b8('0x31')]:_0x4bd36e[_0x72b8('0x2e')];if(_0x4cb318[_0x72b8('0x2f')][_0x72b8('0x3c')]){_0x2accbe[_0x72b8('0x3d')]=[{'all':!![]}];}_0x2accbe=_[_0x72b8('0x44')]({},_0x2accbe,_0x4cb318[_0x72b8('0x3b')]);return db[_0x72b8('0x3e')]['find'](_0x2accbe)[_0x72b8('0x21')](handleEntityNotFound(_0x3dff97,null))['then'](respondWithResult(_0x3dff97,null))[_0x72b8('0x45')](handleError(_0x3dff97,null));};exports['create']=function(_0x4cfda2,_0x5c193f){return db[_0x72b8('0x3e')][_0x72b8('0x46')](_0x4cfda2[_0x72b8('0x47')],{})[_0x72b8('0x21')](function(_0x1ad4ca){var _0x5bf42b=_0x4cfda2[_0x72b8('0x48')][_0x72b8('0x49')]({'plain':!![]});if(!_0x5bf42b)throw new Error(_0x72b8('0x4a'));if(_0x5bf42b[_0x72b8('0x4b')]===_0x72b8('0x48')){var _0xe0550d=_0x1ad4ca[_0x72b8('0x49')]({'plain':!![]});var _0x5cf026=_0x72b8('0x23');return db[_0x72b8('0x4c')]['find']({'where':{'name':_0x5cf026,'userProfileId':_0x5bf42b['userProfileId']},'raw':!![]})[_0x72b8('0x21')](function(_0x9fb437){if(_0x9fb437&&_0x9fb437['autoAssociation']===0x0){return db[_0x72b8('0x24')]['create']({'name':_0xe0550d[_0x72b8('0x27')],'resourceId':_0xe0550d['id'],'type':_0x9fb437[_0x72b8('0x27')],'sectionId':_0x9fb437['id']},{})[_0x72b8('0x21')](function(){return _0x1ad4ca;});}else{return _0x1ad4ca;}})[_0x72b8('0x45')](function(_0x10e5c2){logger['error'](_0x72b8('0x4d'),_0x10e5c2);throw _0x10e5c2;});}return _0x1ad4ca;})[_0x72b8('0x21')](respondWithResult(_0x5c193f,0xc9))['catch'](handleError(_0x5c193f,null));};exports[_0x72b8('0x4e')]=function(_0x4deda7,_0x5a10db){if(_0x4deda7[_0x72b8('0x47')]['id']){delete _0x4deda7[_0x72b8('0x47')]['id'];}return db[_0x72b8('0x3e')][_0x72b8('0x4f')]({'where':{'id':_0x4deda7[_0x72b8('0x42')]['id']}})['then'](handleEntityNotFound(_0x5a10db,null))[_0x72b8('0x21')](saveUpdates(_0x4deda7['body'],null))[_0x72b8('0x21')](respondWithResult(_0x5a10db,null))['catch'](handleError(_0x5a10db,null));};exports[_0x72b8('0x22')]=function(_0xbe84bd,_0x334846){return db['Template'][_0x72b8('0x4f')]({'where':{'id':_0xbe84bd[_0x72b8('0x42')]['id']}})[_0x72b8('0x21')](handleEntityNotFound(_0x334846,null))[_0x72b8('0x21')](removeEntity(_0x334846,null))[_0x72b8('0x45')](handleError(_0x334846,null));};
\ No newline at end of file
+var _0xfc54=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','get','Templates','then','end','sendStatus','error','stack','name','index','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','Template','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xfc54,0x1a9));var _0x4fc5=function(_0xb6afe,_0x38671f){_0xb6afe=_0xb6afe-0x0;var _0x335218=_0xfc54[_0xb6afe];return _0x335218;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4fc5('0x0'));var zipdir=require(_0x4fc5('0x1'));var jsonpatch=require(_0x4fc5('0x2'));var rp=require(_0x4fc5('0x3'));var moment=require(_0x4fc5('0x4'));var BPromise=require(_0x4fc5('0x5'));var Mustache=require(_0x4fc5('0x6'));var util=require(_0x4fc5('0x7'));var path=require(_0x4fc5('0x8'));var sox=require(_0x4fc5('0x9'));var csv=require(_0x4fc5('0xa'));var ejs=require(_0x4fc5('0xb'));var fs=require('fs');var fs_extra=require(_0x4fc5('0xc'));var _=require(_0x4fc5('0xd'));var squel=require(_0x4fc5('0xe'));var crypto=require(_0x4fc5('0xf'));var jsforce=require(_0x4fc5('0x10'));var deskjs=require(_0x4fc5('0x11'));var toCsv=require(_0x4fc5('0xa'));var querystring=require(_0x4fc5('0x12'));var Papa=require(_0x4fc5('0x13'));var Redis=require(_0x4fc5('0x14'));var authService=require(_0x4fc5('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4fc5('0x16'));var logger=require(_0x4fc5('0x17'))(_0x4fc5('0x18'));var utils=require(_0x4fc5('0x19'));var config=require(_0x4fc5('0x1a'));var licenseUtil=require(_0x4fc5('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22847f,_0x579d49){_0x579d49=_0x579d49||0xcc;return function(_0x1ea74a){if(_0x1ea74a){return _0x22847f['sendStatus'](_0x579d49);}return _0x22847f[_0x4fc5('0x1c')](_0x579d49)['end']();};}function respondWithResult(_0x223772,_0x5a12a5){_0x5a12a5=_0x5a12a5||0xc8;return function(_0x4d1d71){if(_0x4d1d71){return _0x223772[_0x4fc5('0x1c')](_0x5a12a5)[_0x4fc5('0x1d')](_0x4d1d71);}};}function respondWithFilteredResult(_0x5bdc87,_0x443aef){return function(_0x37f60b){if(_0x37f60b){var _0x5609f4=typeof _0x443aef[_0x4fc5('0x1e')]===_0x4fc5('0x1f')&&typeof _0x443aef[_0x4fc5('0x20')]===_0x4fc5('0x1f');var _0x29bcab=_0x37f60b['count'];var _0x6ada1=_0x5609f4?0x0:_0x443aef[_0x4fc5('0x1e')];var _0x99bc05=_0x5609f4?_0x37f60b[_0x4fc5('0x21')]:_0x443aef[_0x4fc5('0x1e')]+_0x443aef['limit'];var _0x3826d1;if(_0x99bc05>=_0x29bcab){_0x99bc05=_0x29bcab;_0x3826d1=0xc8;}else{_0x3826d1=0xce;}_0x5bdc87[_0x4fc5('0x1c')](_0x3826d1);return _0x5bdc87[_0x4fc5('0x22')]('Content-Range',_0x6ada1+'-'+_0x99bc05+'/'+_0x29bcab)['json'](_0x37f60b);}return null;};}function patchUpdates(_0x4ea261){return function(_0x2564c4){try{jsonpatch[_0x4fc5('0x23')](_0x2564c4,_0x4ea261,!![]);}catch(_0x2d772e){return BPromise[_0x4fc5('0x24')](_0x2d772e);}return _0x2564c4[_0x4fc5('0x25')]();};}function saveUpdates(_0x43ca76,_0x1b3af3){return function(_0x1421d3){if(_0x1421d3){return _0x1421d3['update'](_0x43ca76)['then'](function(_0x46f22d){return _0x46f22d;});}return null;};}function removeEntity(_0x58820c,_0x2698ce){return function(_0x409ef3){if(_0x409ef3){return _0x409ef3[_0x4fc5('0x26')]()['then'](function(){var _0x353fe5=_0x409ef3[_0x4fc5('0x27')]({'plain':!![]});var _0x58d806=_0x4fc5('0x28');return db['UserProfileResource'][_0x4fc5('0x26')]({'where':{'type':_0x58d806,'resourceId':_0x353fe5['id']}})[_0x4fc5('0x29')](function(){return _0x409ef3;});})['then'](function(){_0x58820c[_0x4fc5('0x1c')](0xcc)[_0x4fc5('0x2a')]();});}};}function handleEntityNotFound(_0x29a83a,_0x5b4df4){return function(_0xc47b80){if(!_0xc47b80){_0x29a83a[_0x4fc5('0x2b')](0x194);}return _0xc47b80;};}function handleError(_0x6cdfb,_0x4e9a51){_0x4e9a51=_0x4e9a51||0x1f4;return function(_0x1c4b37){logger[_0x4fc5('0x2c')](_0x1c4b37[_0x4fc5('0x2d')]);if(_0x1c4b37[_0x4fc5('0x2e')]){delete _0x1c4b37[_0x4fc5('0x2e')];}_0x6cdfb[_0x4fc5('0x1c')](_0x4e9a51)['send'](_0x1c4b37);};}exports[_0x4fc5('0x2f')]=function(_0x2e5cc8,_0x1ee36d){var _0x6483b2={},_0xc91afe={},_0x2af8a6={'count':0x0,'rows':[]};var _0x4ca0bc=_[_0x4fc5('0x30')](db['Template'][_0x4fc5('0x31')],function(_0x157d59){return{'name':_0x157d59['fieldName'],'type':_0x157d59[_0x4fc5('0x32')][_0x4fc5('0x33')]};});_0xc91afe[_0x4fc5('0x34')]=_['map'](_0x4ca0bc,_0x4fc5('0x2e'));_0xc91afe[_0x4fc5('0x35')]=_['keys'](_0x2e5cc8[_0x4fc5('0x35')]);_0xc91afe[_0x4fc5('0x36')]=_[_0x4fc5('0x37')](_0xc91afe['model'],_0xc91afe[_0x4fc5('0x35')]);_0x6483b2['attributes']=_['intersection'](_0xc91afe['model'],qs[_0x4fc5('0x38')](_0x2e5cc8[_0x4fc5('0x35')]['fields']));_0x6483b2[_0x4fc5('0x39')]=_0x6483b2[_0x4fc5('0x39')][_0x4fc5('0x3a')]?_0x6483b2[_0x4fc5('0x39')]:_0xc91afe[_0x4fc5('0x34')];if(!_0x2e5cc8[_0x4fc5('0x35')][_0x4fc5('0x3b')](_0x4fc5('0x3c'))){_0x6483b2[_0x4fc5('0x20')]=qs[_0x4fc5('0x20')](_0x2e5cc8[_0x4fc5('0x35')][_0x4fc5('0x20')]);_0x6483b2[_0x4fc5('0x1e')]=qs['offset'](_0x2e5cc8['query'][_0x4fc5('0x1e')]);}_0x6483b2['order']=qs['sort'](_0x2e5cc8[_0x4fc5('0x35')][_0x4fc5('0x3d')]);_0x6483b2[_0x4fc5('0x3e')]=qs[_0x4fc5('0x36')](_['pick'](_0x2e5cc8[_0x4fc5('0x35')],_0xc91afe[_0x4fc5('0x36')]),_0x4ca0bc);if(_0x2e5cc8['query'][_0x4fc5('0x3f')]){_0x6483b2[_0x4fc5('0x3e')]=_[_0x4fc5('0x40')](_0x6483b2[_0x4fc5('0x3e')],{'$or':_[_0x4fc5('0x30')](_0x4ca0bc,function(_0x2d6fdb){if(_0x2d6fdb['type']!==_0x4fc5('0x41')){var _0x8c42d3={};_0x8c42d3[_0x2d6fdb[_0x4fc5('0x2e')]]={'$like':'%'+_0x2e5cc8[_0x4fc5('0x35')][_0x4fc5('0x3f')]+'%'};return _0x8c42d3;}})});}_0x6483b2=_[_0x4fc5('0x40')]({},_0x6483b2,_0x2e5cc8[_0x4fc5('0x42')]);var _0x54a713={'where':_0x6483b2[_0x4fc5('0x3e')]};return db[_0x4fc5('0x43')][_0x4fc5('0x21')](_0x54a713)[_0x4fc5('0x29')](function(_0x59e9c4){_0x2af8a6['count']=_0x59e9c4;if(_0x2e5cc8[_0x4fc5('0x35')][_0x4fc5('0x44')]){_0x6483b2[_0x4fc5('0x45')]=[{'all':!![]}];}return db[_0x4fc5('0x43')][_0x4fc5('0x46')](_0x6483b2);})[_0x4fc5('0x29')](function(_0x5d8084){_0x2af8a6[_0x4fc5('0x47')]=_0x5d8084;return _0x2af8a6;})[_0x4fc5('0x29')](respondWithFilteredResult(_0x1ee36d,_0x6483b2))[_0x4fc5('0x48')](handleError(_0x1ee36d,null));};exports[_0x4fc5('0x49')]=function(_0x2f4544,_0x199e9a){var _0x299e3e={'raw':!![],'where':{'id':_0x2f4544[_0x4fc5('0x4a')]['id']}},_0x55b4e4={};_0x55b4e4[_0x4fc5('0x34')]=_[_0x4fc5('0x4b')](db[_0x4fc5('0x43')][_0x4fc5('0x31')]);_0x55b4e4[_0x4fc5('0x35')]=_[_0x4fc5('0x4b')](_0x2f4544[_0x4fc5('0x35')]);_0x55b4e4[_0x4fc5('0x36')]=_['intersection'](_0x55b4e4[_0x4fc5('0x34')],_0x55b4e4['query']);_0x299e3e['attributes']=_['intersection'](_0x55b4e4[_0x4fc5('0x34')],qs[_0x4fc5('0x38')](_0x2f4544['query'][_0x4fc5('0x38')]));_0x299e3e[_0x4fc5('0x39')]=_0x299e3e['attributes']['length']?_0x299e3e[_0x4fc5('0x39')]:_0x55b4e4[_0x4fc5('0x34')];if(_0x2f4544[_0x4fc5('0x35')][_0x4fc5('0x44')]){_0x299e3e[_0x4fc5('0x45')]=[{'all':!![]}];}_0x299e3e=_['merge']({},_0x299e3e,_0x2f4544[_0x4fc5('0x42')]);return db[_0x4fc5('0x43')][_0x4fc5('0x4c')](_0x299e3e)[_0x4fc5('0x29')](handleEntityNotFound(_0x199e9a,null))[_0x4fc5('0x29')](respondWithResult(_0x199e9a,null))['catch'](handleError(_0x199e9a,null));};exports[_0x4fc5('0x4d')]=function(_0x46ffce,_0x3fa6a3){return db[_0x4fc5('0x43')][_0x4fc5('0x4d')](_0x46ffce[_0x4fc5('0x4e')],{})[_0x4fc5('0x29')](function(_0x1c5226){var _0xc57da9=_0x46ffce[_0x4fc5('0x4f')][_0x4fc5('0x27')]({'plain':!![]});if(!_0xc57da9)throw new Error(_0x4fc5('0x50'));if(_0xc57da9[_0x4fc5('0x51')]==='user'){var _0x1e82c7=_0x1c5226[_0x4fc5('0x27')]({'plain':!![]});var _0x3e022a=_0x4fc5('0x28');return db['UserProfileSection'][_0x4fc5('0x4c')]({'where':{'name':_0x3e022a,'userProfileId':_0xc57da9[_0x4fc5('0x52')]},'raw':!![]})[_0x4fc5('0x29')](function(_0x3c872f){if(_0x3c872f&&_0x3c872f['autoAssociation']===0x0){return db[_0x4fc5('0x53')][_0x4fc5('0x4d')]({'name':_0x1e82c7['name'],'resourceId':_0x1e82c7['id'],'type':_0x3c872f['name'],'sectionId':_0x3c872f['id']},{})[_0x4fc5('0x29')](function(){return _0x1c5226;});}else{return _0x1c5226;}})[_0x4fc5('0x48')](function(_0x560705){logger[_0x4fc5('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x560705);throw _0x560705;});}return _0x1c5226;})[_0x4fc5('0x29')](respondWithResult(_0x3fa6a3,0xc9))[_0x4fc5('0x48')](handleError(_0x3fa6a3,null));};exports['update']=function(_0x4e7efe,_0x28e12a){if(_0x4e7efe[_0x4fc5('0x4e')]['id']){delete _0x4e7efe[_0x4fc5('0x4e')]['id'];}return db[_0x4fc5('0x43')][_0x4fc5('0x4c')]({'where':{'id':_0x4e7efe['params']['id']}})[_0x4fc5('0x29')](handleEntityNotFound(_0x28e12a,null))[_0x4fc5('0x29')](saveUpdates(_0x4e7efe[_0x4fc5('0x4e')],null))[_0x4fc5('0x29')](respondWithResult(_0x28e12a,null))[_0x4fc5('0x48')](handleError(_0x28e12a,null));};exports[_0x4fc5('0x26')]=function(_0x5af41f,_0x2daeb6){return db[_0x4fc5('0x43')][_0x4fc5('0x4c')]({'where':{'id':_0x5af41f[_0x4fc5('0x4a')]['id']}})[_0x4fc5('0x29')](handleEntityNotFound(_0x2daeb6,null))[_0x4fc5('0x29')](removeEntity(_0x2daeb6,null))['catch'](handleError(_0x2daeb6,null));};
\ No newline at end of file