Built motion from commit 9d1906d1.|2.5.40
[motion2.git] / server / api / tag / tag.controller.js
index a0eea9b..9bab5b6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x867f=['../../config/logger','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','get','Tags','UserProfileResource','then','end','sendStatus','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','show','keys','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4aece7,_0x252c11){var _0x1263c5=function(_0xb7ee4e){while(--_0xb7ee4e){_0x4aece7['push'](_0x4aece7['shift']());}};_0x1263c5(++_0x252c11);}(_0x867f,0xe6));var _0xf867=function(_0x229be5,_0x9156f6){_0x229be5=_0x229be5-0x0;var _0x326189=_0x867f[_0x229be5];return _0x326189;};'use strict';var emlformat=require(_0xf867('0x0'));var rimraf=require(_0xf867('0x1'));var zipdir=require(_0xf867('0x2'));var jsonpatch=require(_0xf867('0x3'));var rp=require(_0xf867('0x4'));var moment=require(_0xf867('0x5'));var BPromise=require(_0xf867('0x6'));var Mustache=require(_0xf867('0x7'));var util=require(_0xf867('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf867('0x9'));var ejs=require(_0xf867('0xa'));var fs=require('fs');var fs_extra=require(_0xf867('0xb'));var _=require(_0xf867('0xc'));var squel=require(_0xf867('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf867('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf867('0xf'));var Papa=require(_0xf867('0x10'));var Redis=require(_0xf867('0x11'));var authService=require(_0xf867('0x12'));var qs=require(_0xf867('0x13'));var as=require(_0xf867('0x14'));var hardwareService=require(_0xf867('0x15'));var logger=require(_0xf867('0x16'))('api');var utils=require(_0xf867('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf867('0x18'))['db'];function respondWithStatusCode(_0x1792ae,_0x20fe34){_0x20fe34=_0x20fe34||0xcc;return function(_0x56740c){if(_0x56740c){return _0x1792ae['sendStatus'](_0x20fe34);}return _0x1792ae[_0xf867('0x19')](_0x20fe34)['end']();};}function respondWithResult(_0x352f0b,_0x49ff40){_0x49ff40=_0x49ff40||0xc8;return function(_0x48ff28){if(_0x48ff28){return _0x352f0b[_0xf867('0x19')](_0x49ff40)[_0xf867('0x1a')](_0x48ff28);}};}function respondWithFilteredResult(_0x7a143e,_0x13973b){return function(_0x38fed9){if(_0x38fed9){var _0x1e5161=typeof _0x13973b[_0xf867('0x1b')]===_0xf867('0x1c')&&typeof _0x13973b[_0xf867('0x1d')]==='undefined';var _0x44f6f1=_0x38fed9['count'];var _0x39f9e8=_0x1e5161?0x0:_0x13973b['offset'];var _0x51bdb3=_0x1e5161?_0x38fed9[_0xf867('0x1e')]:_0x13973b['offset']+_0x13973b['limit'];var _0x2092af;if(_0x51bdb3>=_0x44f6f1){_0x51bdb3=_0x44f6f1;_0x2092af=0xc8;}else{_0x2092af=0xce;}_0x7a143e[_0xf867('0x19')](_0x2092af);return _0x7a143e['set']('Content-Range',_0x39f9e8+'-'+_0x51bdb3+'/'+_0x44f6f1)[_0xf867('0x1a')](_0x38fed9);}return null;};}function patchUpdates(_0x23e7dd){return function(_0x1456ce){try{jsonpatch[_0xf867('0x1f')](_0x1456ce,_0x23e7dd,!![]);}catch(_0x419f75){return BPromise[_0xf867('0x20')](_0x419f75);}return _0x1456ce[_0xf867('0x21')]();};}function saveUpdates(_0x34db74,_0x586a25){return function(_0x568aba){if(_0x568aba){return _0x568aba[_0xf867('0x22')](_0x34db74)['then'](function(_0x3072b7){return _0x3072b7;});}return null;};}function removeEntity(_0x3fc971,_0x4da34b){return function(_0x419b6f){if(_0x419b6f){return _0x419b6f[_0xf867('0x23')]()['then'](function(){var _0x231076=_0x419b6f[_0xf867('0x24')]({'plain':!![]});var _0x167e70=_0xf867('0x25');return db[_0xf867('0x26')][_0xf867('0x23')]({'where':{'type':_0x167e70,'resourceId':_0x231076['id']}})[_0xf867('0x27')](function(){return _0x419b6f;});})[_0xf867('0x27')](function(){_0x3fc971[_0xf867('0x19')](0xcc)[_0xf867('0x28')]();});}};}function handleEntityNotFound(_0x28b44a,_0x1f8aa1){return function(_0xa40271){if(!_0xa40271){_0x28b44a[_0xf867('0x29')](0x194);}return _0xa40271;};}function handleError(_0x327a13,_0x3ed616){_0x3ed616=_0x3ed616||0x1f4;return function(_0x57bf28){logger[_0xf867('0x2a')](_0x57bf28[_0xf867('0x2b')]);if(_0x57bf28[_0xf867('0x2c')]){delete _0x57bf28[_0xf867('0x2c')];}_0x327a13[_0xf867('0x19')](_0x3ed616)[_0xf867('0x2d')](_0x57bf28);};}exports[_0xf867('0x2e')]=function(_0x517b9c,_0x44ddd4){var _0x3e076c={},_0x216716={},_0x36ed62={'count':0x0,'rows':[]};var _0x40517f=_[_0xf867('0x2f')](db[_0xf867('0x30')][_0xf867('0x31')],function(_0x4ffce9){return{'name':_0x4ffce9[_0xf867('0x32')],'type':_0x4ffce9['type'][_0xf867('0x33')]};});_0x216716['model']=_[_0xf867('0x2f')](_0x40517f,_0xf867('0x2c'));_0x216716[_0xf867('0x34')]=_['keys'](_0x517b9c[_0xf867('0x34')]);_0x216716[_0xf867('0x35')]=_['intersection'](_0x216716['model'],_0x216716[_0xf867('0x34')]);_0x3e076c['attributes']=_[_0xf867('0x36')](_0x216716[_0xf867('0x37')],qs[_0xf867('0x38')](_0x517b9c[_0xf867('0x34')]['fields']));_0x3e076c['attributes']=_0x3e076c[_0xf867('0x39')][_0xf867('0x3a')]?_0x3e076c[_0xf867('0x39')]:_0x216716['model'];if(!_0x517b9c[_0xf867('0x34')][_0xf867('0x3b')]('nolimit')){_0x3e076c[_0xf867('0x1d')]=qs['limit'](_0x517b9c[_0xf867('0x34')][_0xf867('0x1d')]);_0x3e076c[_0xf867('0x1b')]=qs['offset'](_0x517b9c[_0xf867('0x34')]['offset']);}_0x3e076c[_0xf867('0x3c')]=qs[_0xf867('0x3d')](_0x517b9c[_0xf867('0x34')][_0xf867('0x3d')]);_0x3e076c[_0xf867('0x3e')]=qs[_0xf867('0x35')](_[_0xf867('0x3f')](_0x517b9c[_0xf867('0x34')],_0x216716['filters']),_0x40517f);if(_0x517b9c['query'][_0xf867('0x40')]){_0x3e076c[_0xf867('0x3e')]=_[_0xf867('0x41')](_0x3e076c[_0xf867('0x3e')],{'$or':_[_0xf867('0x2f')](_0x40517f,function(_0x462df6){if(_0x462df6[_0xf867('0x42')]!=='VIRTUAL'){var _0x4513e1={};_0x4513e1[_0x462df6[_0xf867('0x2c')]]={'$like':'%'+_0x517b9c[_0xf867('0x34')][_0xf867('0x40')]+'%'};return _0x4513e1;}})});}_0x3e076c=_[_0xf867('0x41')]({},_0x3e076c,_0x517b9c[_0xf867('0x43')]);var _0x419b34={'where':_0x3e076c[_0xf867('0x3e')]};return db[_0xf867('0x30')]['count'](_0x419b34)[_0xf867('0x27')](function(_0x4e31d8){_0x36ed62[_0xf867('0x1e')]=_0x4e31d8;if(_0x517b9c[_0xf867('0x34')][_0xf867('0x44')]){_0x3e076c['include']=[{'all':!![]}];}return db[_0xf867('0x30')][_0xf867('0x45')](_0x3e076c);})[_0xf867('0x27')](function(_0xed868d){_0x36ed62[_0xf867('0x46')]=_0xed868d;return _0x36ed62;})[_0xf867('0x27')](respondWithFilteredResult(_0x44ddd4,_0x3e076c))['catch'](handleError(_0x44ddd4,null));};exports[_0xf867('0x47')]=function(_0x2d02f8,_0x1d5dad){var _0x20ec01={'raw':!![],'where':{'id':_0x2d02f8['params']['id']}},_0x3b8929={};_0x3b8929[_0xf867('0x37')]=_['keys'](db[_0xf867('0x30')][_0xf867('0x31')]);_0x3b8929['query']=_[_0xf867('0x48')](_0x2d02f8[_0xf867('0x34')]);_0x3b8929[_0xf867('0x35')]=_[_0xf867('0x36')](_0x3b8929[_0xf867('0x37')],_0x3b8929[_0xf867('0x34')]);_0x20ec01['attributes']=_[_0xf867('0x36')](_0x3b8929['model'],qs[_0xf867('0x38')](_0x2d02f8[_0xf867('0x34')][_0xf867('0x38')]));_0x20ec01[_0xf867('0x39')]=_0x20ec01[_0xf867('0x39')][_0xf867('0x3a')]?_0x20ec01[_0xf867('0x39')]:_0x3b8929['model'];if(_0x2d02f8['query'][_0xf867('0x44')]){_0x20ec01[_0xf867('0x49')]=[{'all':!![]}];}_0x20ec01=_[_0xf867('0x41')]({},_0x20ec01,_0x2d02f8['options']);return db[_0xf867('0x30')][_0xf867('0x4a')](_0x20ec01)[_0xf867('0x27')](handleEntityNotFound(_0x1d5dad,null))['then'](respondWithResult(_0x1d5dad,null))[_0xf867('0x4b')](handleError(_0x1d5dad,null));};exports['create']=function(_0xc01c03,_0x2d56c0){return db[_0xf867('0x30')][_0xf867('0x4c')](_0xc01c03[_0xf867('0x4d')],{})[_0xf867('0x27')](function(_0x422b28){var _0x1b6253=_0xc01c03['user']['get']({'plain':!![]});if(!_0x1b6253)throw new Error(_0xf867('0x4e'));if(_0x1b6253[_0xf867('0x4f')]===_0xf867('0x50')){var _0x199ce0=_0x422b28[_0xf867('0x24')]({'plain':!![]});var _0x42990f=_0xf867('0x25');return db['UserProfileSection'][_0xf867('0x4a')]({'where':{'name':_0x42990f,'userProfileId':_0x1b6253[_0xf867('0x51')]},'raw':!![]})[_0xf867('0x27')](function(_0x357bc4){if(_0x357bc4&&_0x357bc4['autoAssociation']===0x0){return db[_0xf867('0x26')][_0xf867('0x4c')]({'name':_0x199ce0['name'],'resourceId':_0x199ce0['id'],'type':_0x357bc4['name'],'sectionId':_0x357bc4['id']},{})['then'](function(){return _0x422b28;});}else{return _0x422b28;}})[_0xf867('0x4b')](function(_0x347273){logger['error'](_0xf867('0x52'),_0x347273);throw _0x347273;});}return _0x422b28;})[_0xf867('0x27')](respondWithResult(_0x2d56c0,0xc9))['catch'](handleError(_0x2d56c0,null));};exports[_0xf867('0x22')]=function(_0x3041cf,_0x59d460){if(_0x3041cf[_0xf867('0x4d')]['id']){delete _0x3041cf[_0xf867('0x4d')]['id'];}return db[_0xf867('0x30')][_0xf867('0x4a')]({'where':{'id':_0x3041cf[_0xf867('0x53')]['id']}})['then'](handleEntityNotFound(_0x59d460,null))['then'](saveUpdates(_0x3041cf[_0xf867('0x4d')],null))[_0xf867('0x27')](respondWithResult(_0x59d460,null))[_0xf867('0x4b')](handleError(_0x59d460,null));};exports[_0xf867('0x23')]=function(_0x3afdc9,_0x44229e){return db['Tag'][_0xf867('0x4a')]({'where':{'id':_0x3afdc9[_0xf867('0x53')]['id']}})[_0xf867('0x27')](handleEntityNotFound(_0x44229e,null))[_0xf867('0x27')](removeEntity(_0x44229e,null))[_0xf867('0x4b')](handleError(_0x44229e,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