Built motion from commit e1760111.|2.6.18
[motion2.git] / server / api / tag / tag.controller.js
index 140f22f..7557edb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf72b=['sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','Tags','end','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','params','keys','create','body','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xf72b,0x1d9));var _0xbf72=function(_0x2a1f3d,_0x108153){_0x2a1f3d=_0x2a1f3d-0x0;var _0x48c9aa=_0xf72b[_0x2a1f3d];return _0x48c9aa;};'use strict';var emlformat=require(_0xbf72('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf72('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf72('0x2'));var moment=require(_0xbf72('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbf72('0x4'));var util=require(_0xbf72('0x5'));var path=require(_0xbf72('0x6'));var sox=require(_0xbf72('0x7'));var csv=require(_0xbf72('0x8'));var ejs=require(_0xbf72('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf72('0xa'));var squel=require(_0xbf72('0xb'));var crypto=require(_0xbf72('0xc'));var jsforce=require(_0xbf72('0xd'));var deskjs=require(_0xbf72('0xe'));var toCsv=require(_0xbf72('0x8'));var querystring=require('querystring');var Papa=require(_0xbf72('0xf'));var Redis=require('ioredis');var authService=require(_0xbf72('0x10'));var qs=require(_0xbf72('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf72('0x12'));var logger=require(_0xbf72('0x13'))(_0xbf72('0x14'));var utils=require(_0xbf72('0x15'));var config=require(_0xbf72('0x16'));var licenseUtil=require(_0xbf72('0x17'));var db=require(_0xbf72('0x18'))['db'];function respondWithStatusCode(_0x5eb4cc,_0x5967f5){_0x5967f5=_0x5967f5||0xcc;return function(_0x3bd500){if(_0x3bd500){return _0x5eb4cc[_0xbf72('0x19')](_0x5967f5);}return _0x5eb4cc[_0xbf72('0x1a')](_0x5967f5)['end']();};}function respondWithResult(_0x25255e,_0x4f4fa5){_0x4f4fa5=_0x4f4fa5||0xc8;return function(_0x5625b3){if(_0x5625b3){return _0x25255e['status'](_0x4f4fa5)[_0xbf72('0x1b')](_0x5625b3);}};}function respondWithFilteredResult(_0xb96906,_0x3af48d){return function(_0x723eb1){if(_0x723eb1){var _0x39d0cd=typeof _0x3af48d[_0xbf72('0x1c')]==='undefined'&&typeof _0x3af48d[_0xbf72('0x1d')]===_0xbf72('0x1e');var _0x2a8609=_0x723eb1[_0xbf72('0x1f')];var _0x27dadc=_0x39d0cd?0x0:_0x3af48d['offset'];var _0x51d4c9=_0x39d0cd?_0x723eb1[_0xbf72('0x1f')]:_0x3af48d[_0xbf72('0x1c')]+_0x3af48d[_0xbf72('0x1d')];var _0x2584d9;if(_0x51d4c9>=_0x2a8609){_0x51d4c9=_0x2a8609;_0x2584d9=0xc8;}else{_0x2584d9=0xce;}_0xb96906[_0xbf72('0x1a')](_0x2584d9);return _0xb96906[_0xbf72('0x20')](_0xbf72('0x21'),_0x27dadc+'-'+_0x51d4c9+'/'+_0x2a8609)['json'](_0x723eb1);}return null;};}function patchUpdates(_0x2aecae){return function(_0x42a193){try{jsonpatch[_0xbf72('0x22')](_0x42a193,_0x2aecae,!![]);}catch(_0x200139){return BPromise[_0xbf72('0x23')](_0x200139);}return _0x42a193['save']();};}function saveUpdates(_0x3cd181,_0x1de926){return function(_0x536071){if(_0x536071){return _0x536071[_0xbf72('0x24')](_0x3cd181)[_0xbf72('0x25')](function(_0x267c41){return _0x267c41;});}return null;};}function removeEntity(_0x4c7f3d,_0x44f3f9){return function(_0x428361){if(_0x428361){return _0x428361[_0xbf72('0x26')]()[_0xbf72('0x25')](function(){var _0x4f4dc0=_0x428361[_0xbf72('0x27')]({'plain':!![]});var _0x392a8c=_0xbf72('0x28');return db['UserProfileResource'][_0xbf72('0x26')]({'where':{'type':_0x392a8c,'resourceId':_0x4f4dc0['id']}})[_0xbf72('0x25')](function(){return _0x428361;});})[_0xbf72('0x25')](function(){_0x4c7f3d[_0xbf72('0x1a')](0xcc)[_0xbf72('0x29')]();});}};}function handleEntityNotFound(_0x2b1ff1,_0x182154){return function(_0x25ecdf){if(!_0x25ecdf){_0x2b1ff1[_0xbf72('0x19')](0x194);}return _0x25ecdf;};}function handleError(_0x92307f,_0x280d7a){_0x280d7a=_0x280d7a||0x1f4;return function(_0x20e747){logger[_0xbf72('0x2a')](_0x20e747[_0xbf72('0x2b')]);if(_0x20e747[_0xbf72('0x2c')]){delete _0x20e747['name'];}_0x92307f[_0xbf72('0x1a')](_0x280d7a)[_0xbf72('0x2d')](_0x20e747);};}exports[_0xbf72('0x2e')]=function(_0x28850d,_0xb1ee4e){var _0x82c0f0={},_0x35ecdc={},_0x209b2b={'count':0x0,'rows':[]};var _0x1be26a=_[_0xbf72('0x2f')](db[_0xbf72('0x30')][_0xbf72('0x31')],function(_0x423c61){return{'name':_0x423c61[_0xbf72('0x32')],'type':_0x423c61['type'][_0xbf72('0x33')]};});_0x35ecdc[_0xbf72('0x34')]=_[_0xbf72('0x2f')](_0x1be26a,'name');_0x35ecdc['query']=_['keys'](_0x28850d[_0xbf72('0x35')]);_0x35ecdc[_0xbf72('0x36')]=_[_0xbf72('0x37')](_0x35ecdc['model'],_0x35ecdc[_0xbf72('0x35')]);_0x82c0f0[_0xbf72('0x38')]=_['intersection'](_0x35ecdc[_0xbf72('0x34')],qs['fields'](_0x28850d[_0xbf72('0x35')][_0xbf72('0x39')]));_0x82c0f0['attributes']=_0x82c0f0['attributes'][_0xbf72('0x3a')]?_0x82c0f0[_0xbf72('0x38')]:_0x35ecdc[_0xbf72('0x34')];if(!_0x28850d[_0xbf72('0x35')][_0xbf72('0x3b')](_0xbf72('0x3c'))){_0x82c0f0[_0xbf72('0x1d')]=qs[_0xbf72('0x1d')](_0x28850d[_0xbf72('0x35')]['limit']);_0x82c0f0[_0xbf72('0x1c')]=qs[_0xbf72('0x1c')](_0x28850d[_0xbf72('0x35')][_0xbf72('0x1c')]);}_0x82c0f0['order']=qs[_0xbf72('0x3d')](_0x28850d[_0xbf72('0x35')]['sort']);_0x82c0f0[_0xbf72('0x3e')]=qs['filters'](_['pick'](_0x28850d['query'],_0x35ecdc['filters']),_0x1be26a);if(_0x28850d[_0xbf72('0x35')]['filter']){_0x82c0f0['where']=_[_0xbf72('0x3f')](_0x82c0f0['where'],{'$or':_[_0xbf72('0x2f')](_0x1be26a,function(_0xde4ed9){if(_0xde4ed9['type']!==_0xbf72('0x40')){var _0x4aee64={};_0x4aee64[_0xde4ed9['name']]={'$like':'%'+_0x28850d[_0xbf72('0x35')][_0xbf72('0x41')]+'%'};return _0x4aee64;}})});}_0x82c0f0=_[_0xbf72('0x3f')]({},_0x82c0f0,_0x28850d[_0xbf72('0x42')]);var _0xffb333={'where':_0x82c0f0[_0xbf72('0x3e')]};return db[_0xbf72('0x30')][_0xbf72('0x1f')](_0xffb333)['then'](function(_0x311a0c){_0x209b2b[_0xbf72('0x1f')]=_0x311a0c;if(_0x28850d['query'][_0xbf72('0x43')]){_0x82c0f0['include']=[{'all':!![]}];}return db['Tag'][_0xbf72('0x44')](_0x82c0f0);})[_0xbf72('0x25')](function(_0x3992fd){_0x209b2b[_0xbf72('0x45')]=_0x3992fd;return _0x209b2b;})[_0xbf72('0x25')](respondWithFilteredResult(_0xb1ee4e,_0x82c0f0))['catch'](handleError(_0xb1ee4e,null));};exports['show']=function(_0x4b8f31,_0x359c2b){var _0x3a7828={'raw':!![],'where':{'id':_0x4b8f31[_0xbf72('0x46')]['id']}},_0x3871d0={};_0x3871d0['model']=_['keys'](db[_0xbf72('0x30')]['rawAttributes']);_0x3871d0[_0xbf72('0x35')]=_[_0xbf72('0x47')](_0x4b8f31[_0xbf72('0x35')]);_0x3871d0[_0xbf72('0x36')]=_['intersection'](_0x3871d0[_0xbf72('0x34')],_0x3871d0[_0xbf72('0x35')]);_0x3a7828[_0xbf72('0x38')]=_[_0xbf72('0x37')](_0x3871d0['model'],qs[_0xbf72('0x39')](_0x4b8f31[_0xbf72('0x35')]['fields']));_0x3a7828[_0xbf72('0x38')]=_0x3a7828[_0xbf72('0x38')][_0xbf72('0x3a')]?_0x3a7828[_0xbf72('0x38')]:_0x3871d0[_0xbf72('0x34')];if(_0x4b8f31[_0xbf72('0x35')][_0xbf72('0x43')]){_0x3a7828['include']=[{'all':!![]}];}_0x3a7828=_['merge']({},_0x3a7828,_0x4b8f31['options']);return db[_0xbf72('0x30')]['find'](_0x3a7828)[_0xbf72('0x25')](handleEntityNotFound(_0x359c2b,null))['then'](respondWithResult(_0x359c2b,null))['catch'](handleError(_0x359c2b,null));};exports['create']=function(_0x9f94ea,_0x15a271){return db[_0xbf72('0x30')][_0xbf72('0x48')](_0x9f94ea[_0xbf72('0x49')],{})[_0xbf72('0x25')](function(_0x530663){var _0x3ffa72=_0x9f94ea['user'][_0xbf72('0x27')]({'plain':!![]});if(!_0x3ffa72)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ffa72[_0xbf72('0x4a')]===_0xbf72('0x4b')){var _0x45e4d5=_0x530663[_0xbf72('0x27')]({'plain':!![]});var _0x26ce94=_0xbf72('0x28');return db[_0xbf72('0x4c')][_0xbf72('0x4d')]({'where':{'name':_0x26ce94,'userProfileId':_0x3ffa72[_0xbf72('0x4e')]},'raw':!![]})['then'](function(_0x1fb168){if(_0x1fb168&&_0x1fb168[_0xbf72('0x4f')]===0x0){return db[_0xbf72('0x50')]['create']({'name':_0x45e4d5[_0xbf72('0x2c')],'resourceId':_0x45e4d5['id'],'type':_0x1fb168[_0xbf72('0x2c')],'sectionId':_0x1fb168['id']},{})[_0xbf72('0x25')](function(){return _0x530663;});}else{return _0x530663;}})[_0xbf72('0x51')](function(_0x824918){logger['error'](_0xbf72('0x52'),_0x824918);throw _0x824918;});}return _0x530663;})[_0xbf72('0x25')](respondWithResult(_0x15a271,0xc9))['catch'](handleError(_0x15a271,null));};exports[_0xbf72('0x24')]=function(_0x5e2dcd,_0x58080b){if(_0x5e2dcd[_0xbf72('0x49')]['id']){delete _0x5e2dcd[_0xbf72('0x49')]['id'];}return db[_0xbf72('0x30')][_0xbf72('0x4d')]({'where':{'id':_0x5e2dcd[_0xbf72('0x46')]['id']}})['then'](handleEntityNotFound(_0x58080b,null))['then'](saveUpdates(_0x5e2dcd['body'],null))[_0xbf72('0x25')](respondWithResult(_0x58080b,null))[_0xbf72('0x51')](handleError(_0x58080b,null));};exports[_0xbf72('0x26')]=function(_0x1648d0,_0x5cfbc4){return db['Tag'][_0xbf72('0x4d')]({'where':{'id':_0x1648d0[_0xbf72('0x46')]['id']}})[_0xbf72('0x25')](handleEntityNotFound(_0x5cfbc4,null))['then'](removeEntity(_0x5cfbc4,null))[_0xbf72('0x51')](handleError(_0x5cfbc4,null));};
\ No newline at end of file
+var _0x180f=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','save','update','then','get','Tags','UserProfileResource','destroy','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','findAll','rows','catch','show','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0x180f,0xf3));var _0xf180=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0x180f[_0x53e3fa];return _0xe8584a;};'use strict';var emlformat=require(_0xf180('0x0'));var rimraf=require(_0xf180('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf180('0x2'));var rp=require(_0xf180('0x3'));var moment=require('moment');var BPromise=require(_0xf180('0x4'));var Mustache=require(_0xf180('0x5'));var util=require(_0xf180('0x6'));var path=require(_0xf180('0x7'));var sox=require(_0xf180('0x8'));var csv=require('to-csv');var ejs=require(_0xf180('0x9'));var fs=require('fs');var fs_extra=require(_0xf180('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf180('0xb'));var jsforce=require(_0xf180('0xc'));var deskjs=require(_0xf180('0xd'));var toCsv=require(_0xf180('0xe'));var querystring=require(_0xf180('0xf'));var Papa=require(_0xf180('0x10'));var Redis=require(_0xf180('0x11'));var authService=require(_0xf180('0x12'));var qs=require(_0xf180('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf180('0x14'));var logger=require(_0xf180('0x15'))(_0xf180('0x16'));var utils=require(_0xf180('0x17'));var config=require(_0xf180('0x18'));var licenseUtil=require(_0xf180('0x19'));var db=require(_0xf180('0x1a'))['db'];function respondWithStatusCode(_0x2122a0,_0x171513){_0x171513=_0x171513||0xcc;return function(_0x22a1f8){if(_0x22a1f8){return _0x2122a0[_0xf180('0x1b')](_0x171513);}return _0x2122a0['status'](_0x171513)[_0xf180('0x1c')]();};}function respondWithResult(_0x22d179,_0x1eb0a2){_0x1eb0a2=_0x1eb0a2||0xc8;return function(_0x355b07){if(_0x355b07){return _0x22d179['status'](_0x1eb0a2)[_0xf180('0x1d')](_0x355b07);}};}function respondWithFilteredResult(_0x3d3f48,_0x1dbdcf){return function(_0x4ee79b){if(_0x4ee79b){var _0x105c6a=typeof _0x1dbdcf[_0xf180('0x1e')]==='undefined'&&typeof _0x1dbdcf[_0xf180('0x1f')]===_0xf180('0x20');var _0x492c22=_0x4ee79b[_0xf180('0x21')];var _0x14ddc6=_0x105c6a?0x0:_0x1dbdcf[_0xf180('0x1e')];var _0xf7ab26=_0x105c6a?_0x4ee79b[_0xf180('0x21')]:_0x1dbdcf[_0xf180('0x1e')]+_0x1dbdcf[_0xf180('0x1f')];var _0x43f1f4;if(_0xf7ab26>=_0x492c22){_0xf7ab26=_0x492c22;_0x43f1f4=0xc8;}else{_0x43f1f4=0xce;}_0x3d3f48[_0xf180('0x22')](_0x43f1f4);return _0x3d3f48[_0xf180('0x23')](_0xf180('0x24'),_0x14ddc6+'-'+_0xf7ab26+'/'+_0x492c22)[_0xf180('0x1d')](_0x4ee79b);}return null;};}function patchUpdates(_0x180c0a){return function(_0x5c8e98){try{jsonpatch[_0xf180('0x25')](_0x5c8e98,_0x180c0a,!![]);}catch(_0x185cc6){return BPromise['reject'](_0x185cc6);}return _0x5c8e98[_0xf180('0x26')]();};}function saveUpdates(_0x538bac,_0x36aeee){return function(_0x4c54b6){if(_0x4c54b6){return _0x4c54b6[_0xf180('0x27')](_0x538bac)[_0xf180('0x28')](function(_0x5d5ead){return _0x5d5ead;});}return null;};}function removeEntity(_0x48925e,_0x1b28d6){return function(_0x932e29){if(_0x932e29){return _0x932e29['destroy']()[_0xf180('0x28')](function(){var _0x41772a=_0x932e29[_0xf180('0x29')]({'plain':!![]});var _0x1242d3=_0xf180('0x2a');return db[_0xf180('0x2b')][_0xf180('0x2c')]({'where':{'type':_0x1242d3,'resourceId':_0x41772a['id']}})[_0xf180('0x28')](function(){return _0x932e29;});})[_0xf180('0x28')](function(){_0x48925e[_0xf180('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cda7b,_0x158d1a){return function(_0x151b90){if(!_0x151b90){_0x3cda7b[_0xf180('0x1b')](0x194);}return _0x151b90;};}function handleError(_0x37379c,_0x2aeee4){_0x2aeee4=_0x2aeee4||0x1f4;return function(_0xe1db31){logger[_0xf180('0x2d')](_0xe1db31[_0xf180('0x2e')]);if(_0xe1db31[_0xf180('0x2f')]){delete _0xe1db31['name'];}_0x37379c[_0xf180('0x22')](_0x2aeee4)[_0xf180('0x30')](_0xe1db31);};}exports[_0xf180('0x31')]=function(_0x2cf029,_0x466895){var _0x275c90={},_0x2b4f43={},_0x341af6={'count':0x0,'rows':[]};var _0x2af26b=_[_0xf180('0x32')](db[_0xf180('0x33')][_0xf180('0x34')],function(_0x247068){return{'name':_0x247068[_0xf180('0x35')],'type':_0x247068['type'][_0xf180('0x36')]};});_0x2b4f43[_0xf180('0x37')]=_['map'](_0x2af26b,_0xf180('0x2f'));_0x2b4f43['query']=_[_0xf180('0x38')](_0x2cf029[_0xf180('0x39')]);_0x2b4f43[_0xf180('0x3a')]=_['intersection'](_0x2b4f43[_0xf180('0x37')],_0x2b4f43[_0xf180('0x39')]);_0x275c90[_0xf180('0x3b')]=_[_0xf180('0x3c')](_0x2b4f43['model'],qs[_0xf180('0x3d')](_0x2cf029[_0xf180('0x39')][_0xf180('0x3d')]));_0x275c90[_0xf180('0x3b')]=_0x275c90[_0xf180('0x3b')][_0xf180('0x3e')]?_0x275c90[_0xf180('0x3b')]:_0x2b4f43[_0xf180('0x37')];if(!_0x2cf029[_0xf180('0x39')][_0xf180('0x3f')]('nolimit')){_0x275c90[_0xf180('0x1f')]=qs['limit'](_0x2cf029['query'][_0xf180('0x1f')]);_0x275c90['offset']=qs['offset'](_0x2cf029[_0xf180('0x39')][_0xf180('0x1e')]);}_0x275c90[_0xf180('0x40')]=qs[_0xf180('0x41')](_0x2cf029['query']['sort']);_0x275c90[_0xf180('0x42')]=qs['filters'](_[_0xf180('0x43')](_0x2cf029['query'],_0x2b4f43[_0xf180('0x3a')]),_0x2af26b);if(_0x2cf029[_0xf180('0x39')][_0xf180('0x44')]){_0x275c90[_0xf180('0x42')]=_[_0xf180('0x45')](_0x275c90[_0xf180('0x42')],{'$or':_[_0xf180('0x32')](_0x2af26b,function(_0x1def62){if(_0x1def62[_0xf180('0x46')]!=='VIRTUAL'){var _0x389de4={};_0x389de4[_0x1def62[_0xf180('0x2f')]]={'$like':'%'+_0x2cf029['query'][_0xf180('0x44')]+'%'};return _0x389de4;}})});}_0x275c90=_[_0xf180('0x45')]({},_0x275c90,_0x2cf029[_0xf180('0x47')]);var _0x268e34={'where':_0x275c90['where']};return db[_0xf180('0x33')]['count'](_0x268e34)[_0xf180('0x28')](function(_0xaa961){_0x341af6[_0xf180('0x21')]=_0xaa961;if(_0x2cf029[_0xf180('0x39')]['includeAll']){_0x275c90['include']=[{'all':!![]}];}return db[_0xf180('0x33')][_0xf180('0x48')](_0x275c90);})[_0xf180('0x28')](function(_0x3083ba){_0x341af6[_0xf180('0x49')]=_0x3083ba;return _0x341af6;})[_0xf180('0x28')](respondWithFilteredResult(_0x466895,_0x275c90))[_0xf180('0x4a')](handleError(_0x466895,null));};exports[_0xf180('0x4b')]=function(_0x321668,_0xf42737){var _0x53455a={'raw':!![],'where':{'id':_0x321668['params']['id']}},_0x1c4821={};_0x1c4821[_0xf180('0x37')]=_[_0xf180('0x38')](db[_0xf180('0x33')]['rawAttributes']);_0x1c4821[_0xf180('0x39')]=_[_0xf180('0x38')](_0x321668['query']);_0x1c4821[_0xf180('0x3a')]=_[_0xf180('0x3c')](_0x1c4821[_0xf180('0x37')],_0x1c4821[_0xf180('0x39')]);_0x53455a[_0xf180('0x3b')]=_[_0xf180('0x3c')](_0x1c4821[_0xf180('0x37')],qs[_0xf180('0x3d')](_0x321668[_0xf180('0x39')][_0xf180('0x3d')]));_0x53455a[_0xf180('0x3b')]=_0x53455a[_0xf180('0x3b')][_0xf180('0x3e')]?_0x53455a[_0xf180('0x3b')]:_0x1c4821[_0xf180('0x37')];if(_0x321668[_0xf180('0x39')][_0xf180('0x4c')]){_0x53455a[_0xf180('0x4d')]=[{'all':!![]}];}_0x53455a=_[_0xf180('0x45')]({},_0x53455a,_0x321668[_0xf180('0x47')]);return db['Tag']['find'](_0x53455a)[_0xf180('0x28')](handleEntityNotFound(_0xf42737,null))[_0xf180('0x28')](respondWithResult(_0xf42737,null))[_0xf180('0x4a')](handleError(_0xf42737,null));};exports[_0xf180('0x4e')]=function(_0x1915b4,_0x30e469){return db[_0xf180('0x33')][_0xf180('0x4e')](_0x1915b4[_0xf180('0x4f')],{})[_0xf180('0x28')](function(_0x46f962){var _0x16bc09=_0x1915b4[_0xf180('0x50')][_0xf180('0x29')]({'plain':!![]});if(!_0x16bc09)throw new Error(_0xf180('0x51'));if(_0x16bc09['role']===_0xf180('0x50')){var _0x12fabe=_0x46f962['get']({'plain':!![]});var _0xbf1ed3=_0xf180('0x2a');return db[_0xf180('0x52')][_0xf180('0x53')]({'where':{'name':_0xbf1ed3,'userProfileId':_0x16bc09[_0xf180('0x54')]},'raw':!![]})[_0xf180('0x28')](function(_0x15bc7b){if(_0x15bc7b&&_0x15bc7b[_0xf180('0x55')]===0x0){return db[_0xf180('0x2b')][_0xf180('0x4e')]({'name':_0x12fabe[_0xf180('0x2f')],'resourceId':_0x12fabe['id'],'type':_0x15bc7b[_0xf180('0x2f')],'sectionId':_0x15bc7b['id']},{})['then'](function(){return _0x46f962;});}else{return _0x46f962;}})[_0xf180('0x4a')](function(_0x5c485b){logger[_0xf180('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c485b);throw _0x5c485b;});}return _0x46f962;})['then'](respondWithResult(_0x30e469,0xc9))['catch'](handleError(_0x30e469,null));};exports['update']=function(_0x225c82,_0x3e0e1a){if(_0x225c82['body']['id']){delete _0x225c82[_0xf180('0x4f')]['id'];}return db[_0xf180('0x33')]['find']({'where':{'id':_0x225c82[_0xf180('0x56')]['id']}})['then'](handleEntityNotFound(_0x3e0e1a,null))['then'](saveUpdates(_0x225c82['body'],null))[_0xf180('0x28')](respondWithResult(_0x3e0e1a,null))[_0xf180('0x4a')](handleError(_0x3e0e1a,null));};exports[_0xf180('0x2c')]=function(_0x5cd77f,_0x2dcc9e){return db[_0xf180('0x33')][_0xf180('0x53')]({'where':{'id':_0x5cd77f[_0xf180('0x56')]['id']}})[_0xf180('0x28')](handleEntityNotFound(_0x2dcc9e,null))['then'](removeEntity(_0x2dcc9e,null))[_0xf180('0x4a')](handleError(_0x2dcc9e,null));};
\ No newline at end of file