Built motion from commit 9d1906d1.|2.5.40
[motion2.git] / server / api / tag / tag.controller.js
index 140f22f..9bab5b6 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 _0xb248=['keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','Tag','findAll','rows','catch','params','rawAttributes','includeAll','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','sendStatus','error','name','send','index','fieldName','type','key','model','map','query'];(function(_0x49bed8,_0x519d7d){var _0x2101cb=function(_0x4501da){while(--_0x4501da){_0x49bed8['push'](_0x49bed8['shift']());}};_0x2101cb(++_0x519d7d);}(_0xb248,0xc6));var _0x8b24=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb248[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0x8b24('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8b24('0x1'));var jsonpatch=require(_0x8b24('0x2'));var rp=require(_0x8b24('0x3'));var moment=require(_0x8b24('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8b24('0x5'));var util=require(_0x8b24('0x6'));var path=require('path');var sox=require(_0x8b24('0x7'));var csv=require(_0x8b24('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b24('0x9'));var _=require(_0x8b24('0xa'));var squel=require('squel');var crypto=require(_0x8b24('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8b24('0xc'));var toCsv=require(_0x8b24('0x8'));var querystring=require(_0x8b24('0xd'));var Papa=require('papaparse');var Redis=require(_0x8b24('0xe'));var authService=require(_0x8b24('0xf'));var qs=require(_0x8b24('0x10'));var as=require(_0x8b24('0x11'));var hardwareService=require(_0x8b24('0x12'));var logger=require(_0x8b24('0x13'))(_0x8b24('0x14'));var utils=require(_0x8b24('0x15'));var config=require(_0x8b24('0x16'));var licenseUtil=require(_0x8b24('0x17'));var db=require(_0x8b24('0x18'))['db'];function respondWithStatusCode(_0x3d3450,_0x40c1e6){_0x40c1e6=_0x40c1e6||0xcc;return function(_0x40ea49){if(_0x40ea49){return _0x3d3450['sendStatus'](_0x40c1e6);}return _0x3d3450['status'](_0x40c1e6)[_0x8b24('0x19')]();};}function respondWithResult(_0x4433c0,_0xf92148){_0xf92148=_0xf92148||0xc8;return function(_0x32a451){if(_0x32a451){return _0x4433c0[_0x8b24('0x1a')](_0xf92148)[_0x8b24('0x1b')](_0x32a451);}};}function respondWithFilteredResult(_0x11d2ee,_0x3cd934){return function(_0x4e66ae){if(_0x4e66ae){var _0x5a5745=typeof _0x3cd934['offset']===_0x8b24('0x1c')&&typeof _0x3cd934['limit']==='undefined';var _0xafc423=_0x4e66ae[_0x8b24('0x1d')];var _0x527af7=_0x5a5745?0x0:_0x3cd934[_0x8b24('0x1e')];var _0x5e3c52=_0x5a5745?_0x4e66ae[_0x8b24('0x1d')]:_0x3cd934['offset']+_0x3cd934[_0x8b24('0x1f')];var _0x521f5c;if(_0x5e3c52>=_0xafc423){_0x5e3c52=_0xafc423;_0x521f5c=0xc8;}else{_0x521f5c=0xce;}_0x11d2ee[_0x8b24('0x1a')](_0x521f5c);return _0x11d2ee[_0x8b24('0x20')](_0x8b24('0x21'),_0x527af7+'-'+_0x5e3c52+'/'+_0xafc423)[_0x8b24('0x1b')](_0x4e66ae);}return null;};}function patchUpdates(_0x2a4f2d){return function(_0x44aae9){try{jsonpatch[_0x8b24('0x22')](_0x44aae9,_0x2a4f2d,!![]);}catch(_0x5c9c38){return BPromise[_0x8b24('0x23')](_0x5c9c38);}return _0x44aae9[_0x8b24('0x24')]();};}function saveUpdates(_0x4fff3c,_0xd9b96){return function(_0x13dd68){if(_0x13dd68){return _0x13dd68[_0x8b24('0x25')](_0x4fff3c)[_0x8b24('0x26')](function(_0x12a9f4){return _0x12a9f4;});}return null;};}function removeEntity(_0x10b721,_0x347591){return function(_0x3fddf8){if(_0x3fddf8){return _0x3fddf8[_0x8b24('0x27')]()[_0x8b24('0x26')](function(){var _0x2dd44b=_0x3fddf8[_0x8b24('0x28')]({'plain':!![]});var _0x2cfb27=_0x8b24('0x29');return db[_0x8b24('0x2a')][_0x8b24('0x27')]({'where':{'type':_0x2cfb27,'resourceId':_0x2dd44b['id']}})[_0x8b24('0x26')](function(){return _0x3fddf8;});})[_0x8b24('0x26')](function(){_0x10b721[_0x8b24('0x1a')](0xcc)[_0x8b24('0x19')]();});}};}function handleEntityNotFound(_0x1adcb4,_0xa6f06b){return function(_0x2be377){if(!_0x2be377){_0x1adcb4[_0x8b24('0x2b')](0x194);}return _0x2be377;};}function handleError(_0x1934d2,_0x364f3a){_0x364f3a=_0x364f3a||0x1f4;return function(_0x267f1e){logger[_0x8b24('0x2c')](_0x267f1e['stack']);if(_0x267f1e[_0x8b24('0x2d')]){delete _0x267f1e[_0x8b24('0x2d')];}_0x1934d2[_0x8b24('0x1a')](_0x364f3a)[_0x8b24('0x2e')](_0x267f1e);};}exports[_0x8b24('0x2f')]=function(_0x25b664,_0x1ab949){var _0x4de1cf={},_0xa37fe3={},_0x28d351={'count':0x0,'rows':[]};var _0x2ff6d7=_['map'](db['Tag']['rawAttributes'],function(_0x27cc28){return{'name':_0x27cc28[_0x8b24('0x30')],'type':_0x27cc28[_0x8b24('0x31')][_0x8b24('0x32')]};});_0xa37fe3[_0x8b24('0x33')]=_[_0x8b24('0x34')](_0x2ff6d7,_0x8b24('0x2d'));_0xa37fe3[_0x8b24('0x35')]=_[_0x8b24('0x36')](_0x25b664['query']);_0xa37fe3[_0x8b24('0x37')]=_[_0x8b24('0x38')](_0xa37fe3[_0x8b24('0x33')],_0xa37fe3['query']);_0x4de1cf[_0x8b24('0x39')]=_[_0x8b24('0x38')](_0xa37fe3[_0x8b24('0x33')],qs[_0x8b24('0x3a')](_0x25b664[_0x8b24('0x35')][_0x8b24('0x3a')]));_0x4de1cf[_0x8b24('0x39')]=_0x4de1cf[_0x8b24('0x39')][_0x8b24('0x3b')]?_0x4de1cf['attributes']:_0xa37fe3[_0x8b24('0x33')];if(!_0x25b664[_0x8b24('0x35')]['hasOwnProperty'](_0x8b24('0x3c'))){_0x4de1cf[_0x8b24('0x1f')]=qs['limit'](_0x25b664[_0x8b24('0x35')][_0x8b24('0x1f')]);_0x4de1cf[_0x8b24('0x1e')]=qs[_0x8b24('0x1e')](_0x25b664['query'][_0x8b24('0x1e')]);}_0x4de1cf[_0x8b24('0x3d')]=qs[_0x8b24('0x3e')](_0x25b664[_0x8b24('0x35')][_0x8b24('0x3e')]);_0x4de1cf[_0x8b24('0x3f')]=qs['filters'](_[_0x8b24('0x40')](_0x25b664[_0x8b24('0x35')],_0xa37fe3[_0x8b24('0x37')]),_0x2ff6d7);if(_0x25b664[_0x8b24('0x35')][_0x8b24('0x41')]){_0x4de1cf[_0x8b24('0x3f')]=_[_0x8b24('0x42')](_0x4de1cf[_0x8b24('0x3f')],{'$or':_[_0x8b24('0x34')](_0x2ff6d7,function(_0x261e0f){if(_0x261e0f[_0x8b24('0x31')]!=='VIRTUAL'){var _0x1d319e={};_0x1d319e[_0x261e0f['name']]={'$like':'%'+_0x25b664[_0x8b24('0x35')][_0x8b24('0x41')]+'%'};return _0x1d319e;}})});}_0x4de1cf=_[_0x8b24('0x42')]({},_0x4de1cf,_0x25b664['options']);var _0x8a41d0={'where':_0x4de1cf[_0x8b24('0x3f')]};return db[_0x8b24('0x43')]['count'](_0x8a41d0)[_0x8b24('0x26')](function(_0x4f8da5){_0x28d351['count']=_0x4f8da5;if(_0x25b664[_0x8b24('0x35')]['includeAll']){_0x4de1cf['include']=[{'all':!![]}];}return db[_0x8b24('0x43')][_0x8b24('0x44')](_0x4de1cf);})[_0x8b24('0x26')](function(_0x3c6dc2){_0x28d351[_0x8b24('0x45')]=_0x3c6dc2;return _0x28d351;})[_0x8b24('0x26')](respondWithFilteredResult(_0x1ab949,_0x4de1cf))[_0x8b24('0x46')](handleError(_0x1ab949,null));};exports['show']=function(_0x58cd75,_0x39a9e8){var _0x38f78a={'raw':!![],'where':{'id':_0x58cd75[_0x8b24('0x47')]['id']}},_0x1752b0={};_0x1752b0['model']=_[_0x8b24('0x36')](db[_0x8b24('0x43')][_0x8b24('0x48')]);_0x1752b0['query']=_[_0x8b24('0x36')](_0x58cd75['query']);_0x1752b0[_0x8b24('0x37')]=_[_0x8b24('0x38')](_0x1752b0['model'],_0x1752b0[_0x8b24('0x35')]);_0x38f78a[_0x8b24('0x39')]=_[_0x8b24('0x38')](_0x1752b0[_0x8b24('0x33')],qs[_0x8b24('0x3a')](_0x58cd75[_0x8b24('0x35')][_0x8b24('0x3a')]));_0x38f78a[_0x8b24('0x39')]=_0x38f78a[_0x8b24('0x39')][_0x8b24('0x3b')]?_0x38f78a[_0x8b24('0x39')]:_0x1752b0[_0x8b24('0x33')];if(_0x58cd75['query'][_0x8b24('0x49')]){_0x38f78a['include']=[{'all':!![]}];}_0x38f78a=_[_0x8b24('0x42')]({},_0x38f78a,_0x58cd75[_0x8b24('0x4a')]);return db['Tag']['find'](_0x38f78a)[_0x8b24('0x26')](handleEntityNotFound(_0x39a9e8,null))[_0x8b24('0x26')](respondWithResult(_0x39a9e8,null))[_0x8b24('0x46')](handleError(_0x39a9e8,null));};exports[_0x8b24('0x4b')]=function(_0x407b2f,_0x22619e){return db[_0x8b24('0x43')][_0x8b24('0x4b')](_0x407b2f['body'],{})['then'](function(_0x4b274c){var _0x3cacf8=_0x407b2f['user'][_0x8b24('0x28')]({'plain':!![]});if(!_0x3cacf8)throw new Error(_0x8b24('0x4c'));if(_0x3cacf8[_0x8b24('0x4d')]===_0x8b24('0x4e')){var _0x58a26d=_0x4b274c[_0x8b24('0x28')]({'plain':!![]});var _0x3df397=_0x8b24('0x29');return db[_0x8b24('0x4f')][_0x8b24('0x50')]({'where':{'name':_0x3df397,'userProfileId':_0x3cacf8[_0x8b24('0x51')]},'raw':!![]})[_0x8b24('0x26')](function(_0x1c208f){if(_0x1c208f&&_0x1c208f[_0x8b24('0x52')]===0x0){return db[_0x8b24('0x2a')][_0x8b24('0x4b')]({'name':_0x58a26d[_0x8b24('0x2d')],'resourceId':_0x58a26d['id'],'type':_0x1c208f[_0x8b24('0x2d')],'sectionId':_0x1c208f['id']},{})[_0x8b24('0x26')](function(){return _0x4b274c;});}else{return _0x4b274c;}})[_0x8b24('0x46')](function(_0x19bf6f){logger[_0x8b24('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19bf6f);throw _0x19bf6f;});}return _0x4b274c;})[_0x8b24('0x26')](respondWithResult(_0x22619e,0xc9))[_0x8b24('0x46')](handleError(_0x22619e,null));};exports[_0x8b24('0x25')]=function(_0x3dcec6,_0x4bac9f){if(_0x3dcec6[_0x8b24('0x53')]['id']){delete _0x3dcec6[_0x8b24('0x53')]['id'];}return db[_0x8b24('0x43')][_0x8b24('0x50')]({'where':{'id':_0x3dcec6[_0x8b24('0x47')]['id']}})[_0x8b24('0x26')](handleEntityNotFound(_0x4bac9f,null))[_0x8b24('0x26')](saveUpdates(_0x3dcec6[_0x8b24('0x53')],null))[_0x8b24('0x26')](respondWithResult(_0x4bac9f,null))[_0x8b24('0x46')](handleError(_0x4bac9f,null));};exports[_0x8b24('0x27')]=function(_0x324222,_0x3ee4e2){return db[_0x8b24('0x43')][_0x8b24('0x50')]({'where':{'id':_0x324222[_0x8b24('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ee4e2,null))['then'](removeEntity(_0x3ee4e2,null))['catch'](handleError(_0x3ee4e2,null));};
\ No newline at end of file