Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / tag / tag.controller.js
index d165f00..c63790b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4fce=['send','map','Tag','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','length','find','create','body','role','user','UserProfileSection','userProfileId','UserProfileResource','update','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','status','set','Content-Range','apply','save','then','destroy','get','Tags','error','stack','name'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x4fce,0xcc));var _0xe4fc=function(_0x4ddb35,_0x57441e){_0x4ddb35=_0x4ddb35-0x0;var _0x2a615a=_0x4fce[_0x4ddb35];return _0x2a615a;};'use strict';var pdf=require(_0xe4fc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe4fc('0x1'));var zipdir=require(_0xe4fc('0x2'));var jsonpatch=require(_0xe4fc('0x3'));var rp=require('request-promise');var moment=require(_0xe4fc('0x4'));var BPromise=require(_0xe4fc('0x5'));var Mustache=require('mustache');var util=require(_0xe4fc('0x6'));var path=require(_0xe4fc('0x7'));var sox=require(_0xe4fc('0x8'));var csv=require(_0xe4fc('0x9'));var ejs=require(_0xe4fc('0xa'));var fs=require('fs');var _=require(_0xe4fc('0xb'));var squel=require(_0xe4fc('0xc'));var crypto=require('crypto');var jsforce=require(_0xe4fc('0xd'));var deskjs=require(_0xe4fc('0xe'));var toCsv=require(_0xe4fc('0x9'));var querystring=require(_0xe4fc('0xf'));var Papa=require(_0xe4fc('0x10'));var Redis=require(_0xe4fc('0x11'));var authService=require(_0xe4fc('0x12'));var qs=require(_0xe4fc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4fc('0x14'));var logger=require(_0xe4fc('0x15'))(_0xe4fc('0x16'));var utils=require(_0xe4fc('0x17'));var config=require(_0xe4fc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c322d,_0x2d2ba4){_0x2d2ba4=_0x2d2ba4||0xcc;return function(_0x23ab1f){if(_0x23ab1f){return _0x3c322d[_0xe4fc('0x19')](_0x2d2ba4);}return _0x3c322d['status'](_0x2d2ba4)[_0xe4fc('0x1a')]();};}function respondWithResult(_0x5aeda1,_0x50b2c4){_0x50b2c4=_0x50b2c4||0xc8;return function(_0x586fd0){if(_0x586fd0){return _0x5aeda1['status'](_0x50b2c4)[_0xe4fc('0x1b')](_0x586fd0);}};}function respondWithFilteredResult(_0x35ef07,_0x28a09b){return function(_0x458f9d){if(_0x458f9d){var _0x76a73=_0x458f9d[_0xe4fc('0x1c')],_0x357851=_0x28a09b[_0xe4fc('0x1d')],_0x30dd3f=_0x28a09b[_0xe4fc('0x1d')]+_0x28a09b['limit'],_0x42771b;if(_0x30dd3f>=_0x76a73){_0x30dd3f=_0x76a73;_0x42771b=0xc8;}else{_0x42771b=0xce;}_0x35ef07[_0xe4fc('0x1e')](_0x42771b);return _0x35ef07[_0xe4fc('0x1f')](_0xe4fc('0x20'),_0x357851+'-'+_0x30dd3f+'/'+_0x76a73)[_0xe4fc('0x1b')](_0x458f9d);}return null;};}function patchUpdates(_0x54cbeb){return function(_0x4b0cbe){try{jsonpatch[_0xe4fc('0x21')](_0x4b0cbe,_0x54cbeb,!![]);}catch(_0x591b87){return BPromise['reject'](_0x591b87);}return _0x4b0cbe[_0xe4fc('0x22')]();};}function saveUpdates(_0x385a01,_0x1d69f2){return function(_0x17fb4c){if(_0x17fb4c){return _0x17fb4c['update'](_0x385a01)[_0xe4fc('0x23')](function(_0x55483e){return _0x55483e;});}return null;};}function removeEntity(_0x2aa4bd,_0x1f164c){return function(_0x485232){if(_0x485232){return _0x485232[_0xe4fc('0x24')]()['then'](function(){var _0x4c2d6=_0x485232[_0xe4fc('0x25')]({'plain':!![]});var _0xf92641=_0xe4fc('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0xf92641,'resourceId':_0x4c2d6['id']}})[_0xe4fc('0x23')](function(){return _0x485232;});})[_0xe4fc('0x23')](function(){_0x2aa4bd[_0xe4fc('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x546f30,_0x2fcaeb){return function(_0x121ccd){if(!_0x121ccd){_0x546f30[_0xe4fc('0x19')](0x194);}return _0x121ccd;};}function handleError(_0x2d3d47,_0x3217e5){_0x3217e5=_0x3217e5||0x1f4;return function(_0x340afe){logger[_0xe4fc('0x27')](_0x340afe[_0xe4fc('0x28')]);if(_0x340afe[_0xe4fc('0x29')]){delete _0x340afe[_0xe4fc('0x29')];}_0x2d3d47[_0xe4fc('0x1e')](_0x3217e5)[_0xe4fc('0x2a')](_0x340afe);};}exports['index']=function(_0x32711a,_0xdb45d6){var _0x1644c8={},_0x48fe09={},_0x3b2a44={'count':0x0,'rows':[]};var _0x2a7aec=_[_0xe4fc('0x2b')](db[_0xe4fc('0x2c')][_0xe4fc('0x2d')],function(_0x10fc25){return{'name':_0x10fc25[_0xe4fc('0x2e')],'type':_0x10fc25[_0xe4fc('0x2f')][_0xe4fc('0x30')]};});_0x48fe09['model']=_['map'](_0x2a7aec,_0xe4fc('0x29'));_0x48fe09[_0xe4fc('0x31')]=_[_0xe4fc('0x32')](_0x32711a['query']);_0x48fe09[_0xe4fc('0x33')]=_[_0xe4fc('0x34')](_0x48fe09['model'],_0x48fe09[_0xe4fc('0x31')]);_0x1644c8[_0xe4fc('0x35')]=_[_0xe4fc('0x34')](_0x48fe09[_0xe4fc('0x36')],qs[_0xe4fc('0x37')](_0x32711a['query'][_0xe4fc('0x37')]));_0x1644c8[_0xe4fc('0x35')]=_0x1644c8['attributes']['length']?_0x1644c8[_0xe4fc('0x35')]:_0x48fe09[_0xe4fc('0x36')];if(!_0x32711a['query'][_0xe4fc('0x38')](_0xe4fc('0x39'))){_0x1644c8[_0xe4fc('0x3a')]=qs['limit'](_0x32711a[_0xe4fc('0x31')][_0xe4fc('0x3a')]);_0x1644c8['offset']=qs[_0xe4fc('0x1d')](_0x32711a[_0xe4fc('0x31')][_0xe4fc('0x1d')]);}_0x1644c8[_0xe4fc('0x3b')]=qs[_0xe4fc('0x3c')](_0x32711a[_0xe4fc('0x31')][_0xe4fc('0x3c')]);_0x1644c8[_0xe4fc('0x3d')]=qs[_0xe4fc('0x33')](_[_0xe4fc('0x3e')](_0x32711a['query'],_0x48fe09['filters']),_0x2a7aec);if(_0x32711a[_0xe4fc('0x31')][_0xe4fc('0x3f')]){_0x1644c8[_0xe4fc('0x3d')]=_['merge'](_0x1644c8[_0xe4fc('0x3d')],{'$or':_['map'](_0x2a7aec,function(_0x4c02d2){if(_0x4c02d2[_0xe4fc('0x2f')]!==_0xe4fc('0x40')){var _0x1caf5c={};_0x1caf5c[_0x4c02d2['name']]={'$like':'%'+_0x32711a[_0xe4fc('0x31')][_0xe4fc('0x3f')]+'%'};return _0x1caf5c;}})});}_0x1644c8=_[_0xe4fc('0x41')]({},_0x1644c8,_0x32711a[_0xe4fc('0x42')]);var _0x178d39={'where':_0x1644c8[_0xe4fc('0x3d')]};return db['Tag']['count'](_0x178d39)[_0xe4fc('0x23')](function(_0x2b9246){_0x3b2a44['count']=_0x2b9246;if(_0x32711a[_0xe4fc('0x31')]['includeAll']){_0x1644c8[_0xe4fc('0x43')]=[{'all':!![]}];}return db['Tag'][_0xe4fc('0x44')](_0x1644c8);})[_0xe4fc('0x23')](function(_0x4c022c){_0x3b2a44[_0xe4fc('0x45')]=_0x4c022c;return _0x3b2a44;})[_0xe4fc('0x23')](respondWithFilteredResult(_0xdb45d6,_0x1644c8))[_0xe4fc('0x46')](handleError(_0xdb45d6,null));};exports['show']=function(_0x1a66c5,_0x177b23){var _0x4b174e={'raw':!![],'where':{'id':_0x1a66c5[_0xe4fc('0x47')]['id']}},_0xf596bc={};_0xf596bc[_0xe4fc('0x36')]=_[_0xe4fc('0x32')](db['Tag'][_0xe4fc('0x2d')]);_0xf596bc['query']=_[_0xe4fc('0x32')](_0x1a66c5['query']);_0xf596bc[_0xe4fc('0x33')]=_[_0xe4fc('0x34')](_0xf596bc[_0xe4fc('0x36')],_0xf596bc[_0xe4fc('0x31')]);_0x4b174e[_0xe4fc('0x35')]=_[_0xe4fc('0x34')](_0xf596bc[_0xe4fc('0x36')],qs[_0xe4fc('0x37')](_0x1a66c5['query']['fields']));_0x4b174e[_0xe4fc('0x35')]=_0x4b174e['attributes'][_0xe4fc('0x48')]?_0x4b174e[_0xe4fc('0x35')]:_0xf596bc['model'];if(_0x1a66c5['query']['includeAll']){_0x4b174e[_0xe4fc('0x43')]=[{'all':!![]}];}_0x4b174e=_[_0xe4fc('0x41')]({},_0x4b174e,_0x1a66c5['options']);return db[_0xe4fc('0x2c')][_0xe4fc('0x49')](_0x4b174e)['then'](handleEntityNotFound(_0x177b23,null))[_0xe4fc('0x23')](respondWithResult(_0x177b23,null))[_0xe4fc('0x46')](handleError(_0x177b23,null));};exports[_0xe4fc('0x4a')]=function(_0x15d747,_0x51e9a0){return db[_0xe4fc('0x2c')][_0xe4fc('0x4a')](_0x15d747[_0xe4fc('0x4b')],{})[_0xe4fc('0x23')](function(_0x4013ab){var _0x51cb28=_0x15d747['user']['get']({'plain':!![]});if(!_0x51cb28)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51cb28[_0xe4fc('0x4c')]===_0xe4fc('0x4d')){var _0x2c8c3e=_0x4013ab[_0xe4fc('0x25')]({'plain':!![]});var _0x1da186=_0xe4fc('0x26');return db[_0xe4fc('0x4e')][_0xe4fc('0x49')]({'where':{'name':_0x1da186,'userProfileId':_0x51cb28[_0xe4fc('0x4f')]},'raw':!![]})[_0xe4fc('0x23')](function(_0x4bd88d){if(_0x4bd88d&&_0x4bd88d['autoAssociation']===0x0){return db[_0xe4fc('0x50')]['create']({'name':_0x2c8c3e[_0xe4fc('0x29')],'resourceId':_0x2c8c3e['id'],'type':_0x4bd88d[_0xe4fc('0x29')],'sectionId':_0x4bd88d['id']},{})[_0xe4fc('0x23')](function(){return _0x4013ab;});}else{return _0x4013ab;}})[_0xe4fc('0x46')](function(_0x4448cc){logger[_0xe4fc('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4448cc);throw _0x4448cc;});}return _0x4013ab;})[_0xe4fc('0x23')](respondWithResult(_0x51e9a0,0xc9))[_0xe4fc('0x46')](handleError(_0x51e9a0,null));};exports[_0xe4fc('0x51')]=function(_0x19e579,_0x5b3c5d){if(_0x19e579['body']['id']){delete _0x19e579['body']['id'];}return db['Tag'][_0xe4fc('0x49')]({'where':{'id':_0x19e579[_0xe4fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b3c5d,null))['then'](saveUpdates(_0x19e579[_0xe4fc('0x4b')],null))['then'](respondWithResult(_0x5b3c5d,null))[_0xe4fc('0x46')](handleError(_0x5b3c5d,null));};exports[_0xe4fc('0x24')]=function(_0x441d98,_0xf74938){return db[_0xe4fc('0x2c')][_0xe4fc('0x49')]({'where':{'id':_0x441d98[_0xe4fc('0x47')]['id']}})['then'](handleEntityNotFound(_0xf74938,null))[_0xe4fc('0x23')](removeEntity(_0xf74938,null))[_0xe4fc('0x46')](handleError(_0xf74938,null));};
\ No newline at end of file
+var _0xb821=['create','body','user','get','role','Tags','find','catch','update','rimraf','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','end','sendStatus','error','stack','name','index','map','Tag','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','include','findAll','show','params','keys','includeAll','options'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb821,0xa7));var _0x1b82=function(_0x3460ff,_0x6fd64c){_0x3460ff=_0x3460ff-0x0;var _0xb9d863=_0xb821[_0x3460ff];return _0xb9d863;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];function respondWithStatusCode(_0x241d11,_0x2391f5){_0x2391f5=_0x2391f5||0xcc;return function(_0x61b6eb){if(_0x61b6eb){return _0x241d11['sendStatus'](_0x2391f5);}return _0x241d11[_0x1b82('0x18')](_0x2391f5)['end']();};}function respondWithResult(_0x54915f,_0x1e553a){_0x1e553a=_0x1e553a||0xc8;return function(_0x4bf75b){if(_0x4bf75b){return _0x54915f[_0x1b82('0x18')](_0x1e553a)[_0x1b82('0x19')](_0x4bf75b);}};}function respondWithFilteredResult(_0x5d4cf1,_0x46c2cf){return function(_0x5dab7d){if(_0x5dab7d){var _0x563261=typeof _0x46c2cf[_0x1b82('0x1a')]==='undefined'&&typeof _0x46c2cf[_0x1b82('0x1b')]===_0x1b82('0x1c');var _0xf42818=_0x5dab7d['count'];var _0x514082=_0x563261?0x0:_0x46c2cf[_0x1b82('0x1a')];var _0x5d66c3=_0x563261?_0x5dab7d[_0x1b82('0x1d')]:_0x46c2cf[_0x1b82('0x1a')]+_0x46c2cf[_0x1b82('0x1b')];var _0x594a63;if(_0x5d66c3>=_0xf42818){_0x5d66c3=_0xf42818;_0x594a63=0xc8;}else{_0x594a63=0xce;}_0x5d4cf1[_0x1b82('0x18')](_0x594a63);return _0x5d4cf1[_0x1b82('0x1e')](_0x1b82('0x1f'),_0x514082+'-'+_0x5d66c3+'/'+_0xf42818)[_0x1b82('0x19')](_0x5dab7d);}return null;};}function patchUpdates(_0x10d45c){return function(_0x47e99b){try{jsonpatch[_0x1b82('0x20')](_0x47e99b,_0x10d45c,!![]);}catch(_0x1892b0){return BPromise[_0x1b82('0x21')](_0x1892b0);}return _0x47e99b[_0x1b82('0x22')]();};}function saveUpdates(_0x26e481,_0x31fd64){return function(_0x2d07f4){if(_0x2d07f4){return _0x2d07f4['update'](_0x26e481)[_0x1b82('0x23')](function(_0x233740){return _0x233740;});}return null;};}function removeEntity(_0x5b8d09,_0x561d78){return function(_0x225b81){if(_0x225b81){return _0x225b81[_0x1b82('0x24')]()['then'](function(){var _0x3a1226=_0x225b81['get']({'plain':!![]});var _0x5cd458='Tags';return db[_0x1b82('0x25')][_0x1b82('0x24')]({'where':{'type':_0x5cd458,'resourceId':_0x3a1226['id']}})[_0x1b82('0x23')](function(){return _0x225b81;});})[_0x1b82('0x23')](function(){_0x5b8d09['status'](0xcc)[_0x1b82('0x26')]();});}};}function handleEntityNotFound(_0x165b45,_0x1b5260){return function(_0x7455e8){if(!_0x7455e8){_0x165b45[_0x1b82('0x27')](0x194);}return _0x7455e8;};}function handleError(_0x1b8b6f,_0x223b6a){_0x223b6a=_0x223b6a||0x1f4;return function(_0x21ea34){logger[_0x1b82('0x28')](_0x21ea34[_0x1b82('0x29')]);if(_0x21ea34[_0x1b82('0x2a')]){delete _0x21ea34[_0x1b82('0x2a')];}_0x1b8b6f[_0x1b82('0x18')](_0x223b6a)['send'](_0x21ea34);};}exports[_0x1b82('0x2b')]=function(_0x2931d0,_0x155a34){var _0x457dbb={},_0x18e4ff={},_0x115ce7={'count':0x0,'rows':[]};var _0xd3c4a=_[_0x1b82('0x2c')](db[_0x1b82('0x2d')][_0x1b82('0x2e')],function(_0x501ab0){return{'name':_0x501ab0[_0x1b82('0x2f')],'type':_0x501ab0[_0x1b82('0x30')][_0x1b82('0x31')]};});_0x18e4ff[_0x1b82('0x32')]=_['map'](_0xd3c4a,_0x1b82('0x2a'));_0x18e4ff[_0x1b82('0x33')]=_['keys'](_0x2931d0[_0x1b82('0x33')]);_0x18e4ff[_0x1b82('0x34')]=_[_0x1b82('0x35')](_0x18e4ff['model'],_0x18e4ff['query']);_0x457dbb[_0x1b82('0x36')]=_['intersection'](_0x18e4ff['model'],qs[_0x1b82('0x37')](_0x2931d0[_0x1b82('0x33')][_0x1b82('0x37')]));_0x457dbb['attributes']=_0x457dbb[_0x1b82('0x36')][_0x1b82('0x38')]?_0x457dbb[_0x1b82('0x36')]:_0x18e4ff[_0x1b82('0x32')];if(!_0x2931d0['query'][_0x1b82('0x39')](_0x1b82('0x3a'))){_0x457dbb[_0x1b82('0x1b')]=qs['limit'](_0x2931d0['query'][_0x1b82('0x1b')]);_0x457dbb['offset']=qs[_0x1b82('0x1a')](_0x2931d0[_0x1b82('0x33')][_0x1b82('0x1a')]);}_0x457dbb[_0x1b82('0x3b')]=qs[_0x1b82('0x3c')](_0x2931d0[_0x1b82('0x33')][_0x1b82('0x3c')]);_0x457dbb[_0x1b82('0x3d')]=qs['filters'](_['pick'](_0x2931d0[_0x1b82('0x33')],_0x18e4ff['filters']),_0xd3c4a);if(_0x2931d0[_0x1b82('0x33')]['filter']){_0x457dbb[_0x1b82('0x3d')]=_[_0x1b82('0x3e')](_0x457dbb[_0x1b82('0x3d')],{'$or':_[_0x1b82('0x2c')](_0xd3c4a,function(_0x2af0bd){if(_0x2af0bd[_0x1b82('0x30')]!=='VIRTUAL'){var _0x17d214={};_0x17d214[_0x2af0bd['name']]={'$like':'%'+_0x2931d0[_0x1b82('0x33')]['filter']+'%'};return _0x17d214;}})});}_0x457dbb=_[_0x1b82('0x3e')]({},_0x457dbb,_0x2931d0['options']);var _0x5aeac1={'where':_0x457dbb[_0x1b82('0x3d')]};return db[_0x1b82('0x2d')][_0x1b82('0x1d')](_0x5aeac1)[_0x1b82('0x23')](function(_0x3eb429){_0x115ce7['count']=_0x3eb429;if(_0x2931d0[_0x1b82('0x33')]['includeAll']){_0x457dbb[_0x1b82('0x3f')]=[{'all':!![]}];}return db[_0x1b82('0x2d')][_0x1b82('0x40')](_0x457dbb);})[_0x1b82('0x23')](function(_0x365ab4){_0x115ce7['rows']=_0x365ab4;return _0x115ce7;})[_0x1b82('0x23')](respondWithFilteredResult(_0x155a34,_0x457dbb))['catch'](handleError(_0x155a34,null));};exports[_0x1b82('0x41')]=function(_0x14b3ab,_0x5a50ba){var _0xa88eb2={'raw':!![],'where':{'id':_0x14b3ab[_0x1b82('0x42')]['id']}},_0x225f6b={};_0x225f6b[_0x1b82('0x32')]=_[_0x1b82('0x43')](db[_0x1b82('0x2d')][_0x1b82('0x2e')]);_0x225f6b['query']=_[_0x1b82('0x43')](_0x14b3ab['query']);_0x225f6b[_0x1b82('0x34')]=_[_0x1b82('0x35')](_0x225f6b[_0x1b82('0x32')],_0x225f6b[_0x1b82('0x33')]);_0xa88eb2[_0x1b82('0x36')]=_[_0x1b82('0x35')](_0x225f6b[_0x1b82('0x32')],qs[_0x1b82('0x37')](_0x14b3ab[_0x1b82('0x33')][_0x1b82('0x37')]));_0xa88eb2[_0x1b82('0x36')]=_0xa88eb2[_0x1b82('0x36')][_0x1b82('0x38')]?_0xa88eb2[_0x1b82('0x36')]:_0x225f6b['model'];if(_0x14b3ab['query'][_0x1b82('0x44')]){_0xa88eb2['include']=[{'all':!![]}];}_0xa88eb2=_[_0x1b82('0x3e')]({},_0xa88eb2,_0x14b3ab[_0x1b82('0x45')]);return db[_0x1b82('0x2d')]['find'](_0xa88eb2)[_0x1b82('0x23')](handleEntityNotFound(_0x5a50ba,null))['then'](respondWithResult(_0x5a50ba,null))['catch'](handleError(_0x5a50ba,null));};exports[_0x1b82('0x46')]=function(_0x2aadf7,_0x242324){return db['Tag'][_0x1b82('0x46')](_0x2aadf7[_0x1b82('0x47')],{})['then'](function(_0x5ca898){var _0x106282=_0x2aadf7[_0x1b82('0x48')][_0x1b82('0x49')]({'plain':!![]});if(!_0x106282)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x106282[_0x1b82('0x4a')]===_0x1b82('0x48')){var _0x31fb5d=_0x5ca898[_0x1b82('0x49')]({'plain':!![]});var _0xbba448=_0x1b82('0x4b');return db['UserProfileSection'][_0x1b82('0x4c')]({'where':{'name':_0xbba448,'userProfileId':_0x106282['userProfileId']},'raw':!![]})[_0x1b82('0x23')](function(_0x247cb7){if(_0x247cb7&&_0x247cb7['autoAssociation']===0x0){return db[_0x1b82('0x25')]['create']({'name':_0x31fb5d[_0x1b82('0x2a')],'resourceId':_0x31fb5d['id'],'type':_0x247cb7[_0x1b82('0x2a')],'sectionId':_0x247cb7['id']},{})[_0x1b82('0x23')](function(){return _0x5ca898;});}else{return _0x5ca898;}})[_0x1b82('0x4d')](function(_0xd46842){logger[_0x1b82('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd46842);throw _0xd46842;});}return _0x5ca898;})['then'](respondWithResult(_0x242324,0xc9))[_0x1b82('0x4d')](handleError(_0x242324,null));};exports[_0x1b82('0x4e')]=function(_0x1b9e81,_0x26c1ec){if(_0x1b9e81[_0x1b82('0x47')]['id']){delete _0x1b9e81[_0x1b82('0x47')]['id'];}return db[_0x1b82('0x2d')][_0x1b82('0x4c')]({'where':{'id':_0x1b9e81['params']['id']}})['then'](handleEntityNotFound(_0x26c1ec,null))['then'](saveUpdates(_0x1b9e81[_0x1b82('0x47')],null))[_0x1b82('0x23')](respondWithResult(_0x26c1ec,null))[_0x1b82('0x4d')](handleError(_0x26c1ec,null));};exports[_0x1b82('0x24')]=function(_0x1eb4a4,_0x15b0d3){return db[_0x1b82('0x2d')]['find']({'where':{'id':_0x1eb4a4[_0x1b82('0x42')]['id']}})[_0x1b82('0x23')](handleEntityNotFound(_0x15b0d3,null))[_0x1b82('0x23')](removeEntity(_0x15b0d3,null))[_0x1b82('0x4d')](handleError(_0x15b0d3,null));};
\ No newline at end of file