Built motion from commit 19a84241.|2.5.34
[motion2.git] / server / api / tag / tag.controller.js
index 243fbc0..2fbee7d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1f42=['request-promise','moment','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','where','merge','options','includeAll','include','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x272f5d,_0x578e81){var _0x1ce859=function(_0x9df8f9){while(--_0x9df8f9){_0x272f5d['push'](_0x272f5d['shift']());}};_0x1ce859(++_0x578e81);}(_0x1f42,0x1e8));var _0x21f4=function(_0x4adf2d,_0x257bad){_0x4adf2d=_0x4adf2d-0x0;var _0x53dac5=_0x1f42[_0x4adf2d];return _0x53dac5;};'use strict';var pdf=require(_0x21f4('0x0'));var emlformat=require(_0x21f4('0x1'));var rimraf=require(_0x21f4('0x2'));var zipdir=require(_0x21f4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21f4('0x4'));var moment=require(_0x21f4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x21f4('0x6'));var path=require(_0x21f4('0x7'));var sox=require(_0x21f4('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x21f4('0x9'));var squel=require('squel');var crypto=require(_0x21f4('0xa'));var jsforce=require(_0x21f4('0xb'));var deskjs=require(_0x21f4('0xc'));var toCsv=require(_0x21f4('0xd'));var querystring=require(_0x21f4('0xe'));var Papa=require(_0x21f4('0xf'));var Redis=require(_0x21f4('0x10'));var authService=require(_0x21f4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x21f4('0x12'));var hardwareService=require(_0x21f4('0x13'));var logger=require(_0x21f4('0x14'))(_0x21f4('0x15'));var utils=require('../../config/utils');var config=require(_0x21f4('0x16'));var db=require(_0x21f4('0x17'))['db'];function respondWithStatusCode(_0x26f795,_0x301a0b){_0x301a0b=_0x301a0b||0xcc;return function(_0x5713a4){if(_0x5713a4){return _0x26f795[_0x21f4('0x18')](_0x301a0b);}return _0x26f795[_0x21f4('0x19')](_0x301a0b)[_0x21f4('0x1a')]();};}function respondWithResult(_0x2c5c93,_0x54e169){_0x54e169=_0x54e169||0xc8;return function(_0x5d6864){if(_0x5d6864){return _0x2c5c93[_0x21f4('0x19')](_0x54e169)[_0x21f4('0x1b')](_0x5d6864);}};}function respondWithFilteredResult(_0x246b21,_0xb9bd01){return function(_0x1f1c45){if(_0x1f1c45){var _0x596589=_0x1f1c45[_0x21f4('0x1c')],_0x142d81=_0xb9bd01['offset'],_0xfdb3cb=_0xb9bd01[_0x21f4('0x1d')]+_0xb9bd01[_0x21f4('0x1e')],_0x3395e1;if(_0xfdb3cb>=_0x596589){_0xfdb3cb=_0x596589;_0x3395e1=0xc8;}else{_0x3395e1=0xce;}_0x246b21[_0x21f4('0x19')](_0x3395e1);return _0x246b21[_0x21f4('0x1f')](_0x21f4('0x20'),_0x142d81+'-'+_0xfdb3cb+'/'+_0x596589)[_0x21f4('0x1b')](_0x1f1c45);}return null;};}function patchUpdates(_0x311f5b){return function(_0x1e670e){try{jsonpatch[_0x21f4('0x21')](_0x1e670e,_0x311f5b,!![]);}catch(_0x3e7a52){return BPromise['reject'](_0x3e7a52);}return _0x1e670e[_0x21f4('0x22')]();};}function saveUpdates(_0x351b37,_0x1e203d){return function(_0x55323b){if(_0x55323b){return _0x55323b['update'](_0x351b37)[_0x21f4('0x23')](function(_0x3fde1a){return _0x3fde1a;});}return null;};}function removeEntity(_0x563244,_0x4d417f){return function(_0x42db57){if(_0x42db57){return _0x42db57[_0x21f4('0x24')]()[_0x21f4('0x23')](function(){var _0x199864=_0x42db57[_0x21f4('0x25')]({'plain':!![]});var _0x3a3181='Tags';return db[_0x21f4('0x26')][_0x21f4('0x24')]({'where':{'type':_0x3a3181,'resourceId':_0x199864['id']}})[_0x21f4('0x23')](function(){return _0x42db57;});})['then'](function(){_0x563244[_0x21f4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f21c8,_0x2bb9e5){return function(_0xa2ecd0){if(!_0xa2ecd0){_0x1f21c8[_0x21f4('0x18')](0x194);}return _0xa2ecd0;};}function handleError(_0x2dcc71,_0x24db5b){_0x24db5b=_0x24db5b||0x1f4;return function(_0x9a6e0f){logger[_0x21f4('0x27')](_0x9a6e0f[_0x21f4('0x28')]);if(_0x9a6e0f[_0x21f4('0x29')]){delete _0x9a6e0f['name'];}_0x2dcc71['status'](_0x24db5b)[_0x21f4('0x2a')](_0x9a6e0f);};}exports[_0x21f4('0x2b')]=function(_0x22c266,_0x45fc53){var _0x20f887={},_0x2275cb={},_0x3a1cc6={'count':0x0,'rows':[]};var _0x258aa5=_[_0x21f4('0x2c')](db[_0x21f4('0x2d')][_0x21f4('0x2e')],function(_0xf89b93){return{'name':_0xf89b93[_0x21f4('0x2f')],'type':_0xf89b93[_0x21f4('0x30')][_0x21f4('0x31')]};});_0x2275cb[_0x21f4('0x32')]=_[_0x21f4('0x2c')](_0x258aa5,'name');_0x2275cb[_0x21f4('0x33')]=_[_0x21f4('0x34')](_0x22c266[_0x21f4('0x33')]);_0x2275cb[_0x21f4('0x35')]=_['intersection'](_0x2275cb[_0x21f4('0x32')],_0x2275cb[_0x21f4('0x33')]);_0x20f887[_0x21f4('0x36')]=_[_0x21f4('0x37')](_0x2275cb[_0x21f4('0x32')],qs[_0x21f4('0x38')](_0x22c266[_0x21f4('0x33')][_0x21f4('0x38')]));_0x20f887['attributes']=_0x20f887[_0x21f4('0x36')][_0x21f4('0x39')]?_0x20f887['attributes']:_0x2275cb[_0x21f4('0x32')];if(!_0x22c266[_0x21f4('0x33')][_0x21f4('0x3a')]('nolimit')){_0x20f887[_0x21f4('0x1e')]=qs[_0x21f4('0x1e')](_0x22c266[_0x21f4('0x33')][_0x21f4('0x1e')]);_0x20f887['offset']=qs[_0x21f4('0x1d')](_0x22c266[_0x21f4('0x33')][_0x21f4('0x1d')]);}_0x20f887[_0x21f4('0x3b')]=qs[_0x21f4('0x3c')](_0x22c266[_0x21f4('0x33')][_0x21f4('0x3c')]);_0x20f887['where']=qs[_0x21f4('0x35')](_[_0x21f4('0x3d')](_0x22c266[_0x21f4('0x33')],_0x2275cb[_0x21f4('0x35')]));if(_0x22c266[_0x21f4('0x33')]['filter']){_0x20f887[_0x21f4('0x3e')]=_[_0x21f4('0x3f')](_0x20f887[_0x21f4('0x3e')],{'$or':_[_0x21f4('0x2c')](_0x258aa5,function(_0x25905c){if(_0x25905c[_0x21f4('0x30')]!=='VIRTUAL'){var _0x3265e4={};_0x3265e4[_0x25905c[_0x21f4('0x29')]]={'$like':'%'+_0x22c266[_0x21f4('0x33')]['filter']+'%'};return _0x3265e4;}})});}_0x20f887=_[_0x21f4('0x3f')]({},_0x20f887,_0x22c266[_0x21f4('0x40')]);var _0x183cfd={'where':_0x20f887[_0x21f4('0x3e')]};return db[_0x21f4('0x2d')]['count'](_0x183cfd)[_0x21f4('0x23')](function(_0x1f300e){_0x3a1cc6[_0x21f4('0x1c')]=_0x1f300e;if(_0x22c266[_0x21f4('0x33')][_0x21f4('0x41')]){_0x20f887[_0x21f4('0x42')]=[{'all':!![]}];}return db[_0x21f4('0x2d')]['findAll'](_0x20f887);})[_0x21f4('0x23')](function(_0x296861){_0x3a1cc6[_0x21f4('0x43')]=_0x296861;return _0x3a1cc6;})[_0x21f4('0x23')](respondWithFilteredResult(_0x45fc53,_0x20f887))[_0x21f4('0x44')](handleError(_0x45fc53,null));};exports[_0x21f4('0x45')]=function(_0x2d4ccd,_0x23b290){var _0x420bcc={'raw':!![],'where':{'id':_0x2d4ccd[_0x21f4('0x46')]['id']}},_0x735ce0={};_0x735ce0[_0x21f4('0x32')]=_[_0x21f4('0x34')](db['Tag'][_0x21f4('0x2e')]);_0x735ce0[_0x21f4('0x33')]=_['keys'](_0x2d4ccd[_0x21f4('0x33')]);_0x735ce0['filters']=_[_0x21f4('0x37')](_0x735ce0[_0x21f4('0x32')],_0x735ce0[_0x21f4('0x33')]);_0x420bcc[_0x21f4('0x36')]=_[_0x21f4('0x37')](_0x735ce0[_0x21f4('0x32')],qs[_0x21f4('0x38')](_0x2d4ccd[_0x21f4('0x33')][_0x21f4('0x38')]));_0x420bcc[_0x21f4('0x36')]=_0x420bcc[_0x21f4('0x36')][_0x21f4('0x39')]?_0x420bcc['attributes']:_0x735ce0['model'];if(_0x2d4ccd['query']['includeAll']){_0x420bcc['include']=[{'all':!![]}];}_0x420bcc=_['merge']({},_0x420bcc,_0x2d4ccd[_0x21f4('0x40')]);return db[_0x21f4('0x2d')]['find'](_0x420bcc)[_0x21f4('0x23')](handleEntityNotFound(_0x23b290,null))[_0x21f4('0x23')](respondWithResult(_0x23b290,null))[_0x21f4('0x44')](handleError(_0x23b290,null));};exports['create']=function(_0xa61b35,_0x37f1ef){return db[_0x21f4('0x2d')][_0x21f4('0x47')](_0xa61b35[_0x21f4('0x48')],{})[_0x21f4('0x23')](function(_0x4a380b){var _0x20d71a=_0xa61b35[_0x21f4('0x49')]['get']({'plain':!![]});if(!_0x20d71a)throw new Error(_0x21f4('0x4a'));if(_0x20d71a[_0x21f4('0x4b')]===_0x21f4('0x49')){var _0x546ae0=_0x4a380b[_0x21f4('0x25')]({'plain':!![]});var _0x113771='Tags';return db[_0x21f4('0x4c')][_0x21f4('0x4d')]({'where':{'name':_0x113771,'userProfileId':_0x20d71a[_0x21f4('0x4e')]},'raw':!![]})[_0x21f4('0x23')](function(_0x2eb99f){if(_0x2eb99f&&_0x2eb99f[_0x21f4('0x4f')]===0x0){return db[_0x21f4('0x26')][_0x21f4('0x47')]({'name':_0x546ae0['name'],'resourceId':_0x546ae0['id'],'type':_0x2eb99f[_0x21f4('0x29')],'sectionId':_0x2eb99f['id']},{})['then'](function(){return _0x4a380b;});}else{return _0x4a380b;}})[_0x21f4('0x44')](function(_0x59b27c){logger[_0x21f4('0x27')](_0x21f4('0x50'),_0x59b27c);throw _0x59b27c;});}return _0x4a380b;})[_0x21f4('0x23')](respondWithResult(_0x37f1ef,0xc9))[_0x21f4('0x44')](handleError(_0x37f1ef,null));};exports[_0x21f4('0x51')]=function(_0x4f2ddb,_0x2e34d4){if(_0x4f2ddb[_0x21f4('0x48')]['id']){delete _0x4f2ddb[_0x21f4('0x48')]['id'];}return db['Tag'][_0x21f4('0x4d')]({'where':{'id':_0x4f2ddb['params']['id']}})[_0x21f4('0x23')](handleEntityNotFound(_0x2e34d4,null))[_0x21f4('0x23')](saveUpdates(_0x4f2ddb[_0x21f4('0x48')],null))[_0x21f4('0x23')](respondWithResult(_0x2e34d4,null))[_0x21f4('0x44')](handleError(_0x2e34d4,null));};exports[_0x21f4('0x24')]=function(_0x5c968b,_0x40f4a6){return db['Tag'][_0x21f4('0x4d')]({'where':{'id':_0x5c968b['params']['id']}})[_0x21f4('0x23')](handleEntityNotFound(_0x40f4a6,null))['then'](removeEntity(_0x40f4a6,null))['catch'](handleError(_0x40f4a6,null));};
\ No newline at end of file
+var _0x5b02=['sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','get','Tags','UserProfileResource','destroy','error','stack','name','send','index','Tag','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x527d34,_0xec6b66){var _0x301ed8=function(_0xe30817){while(--_0xe30817){_0x527d34['push'](_0x527d34['shift']());}};_0x301ed8(++_0xec6b66);}(_0x5b02,0xe9));var _0x25b0=function(_0x160bed,_0xac3261){_0x160bed=_0x160bed-0x0;var _0x4689d8=_0x5b02[_0x160bed];return _0x4689d8;};'use strict';var emlformat=require(_0x25b0('0x0'));var rimraf=require(_0x25b0('0x1'));var zipdir=require(_0x25b0('0x2'));var jsonpatch=require(_0x25b0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x25b0('0x4'));var Mustache=require('mustache');var util=require(_0x25b0('0x5'));var path=require(_0x25b0('0x6'));var sox=require(_0x25b0('0x7'));var csv=require(_0x25b0('0x8'));var ejs=require(_0x25b0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x25b0('0xa'));var squel=require(_0x25b0('0xb'));var crypto=require('crypto');var jsforce=require(_0x25b0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x25b0('0xd'));var Papa=require(_0x25b0('0xe'));var Redis=require(_0x25b0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b0('0x10'));var as=require(_0x25b0('0x11'));var hardwareService=require(_0x25b0('0x12'));var logger=require(_0x25b0('0x13'))(_0x25b0('0x14'));var utils=require(_0x25b0('0x15'));var config=require(_0x25b0('0x16'));var licenseUtil=require(_0x25b0('0x17'));var db=require(_0x25b0('0x18'))['db'];function respondWithStatusCode(_0x1d3178,_0x184452){_0x184452=_0x184452||0xcc;return function(_0x26a34f){if(_0x26a34f){return _0x1d3178[_0x25b0('0x19')](_0x184452);}return _0x1d3178[_0x25b0('0x1a')](_0x184452)[_0x25b0('0x1b')]();};}function respondWithResult(_0x42cc07,_0x293203){_0x293203=_0x293203||0xc8;return function(_0x211658){if(_0x211658){return _0x42cc07[_0x25b0('0x1a')](_0x293203)[_0x25b0('0x1c')](_0x211658);}};}function respondWithFilteredResult(_0x40071c,_0x5ac18d){return function(_0x51542b){if(_0x51542b){var _0xfe1ea6=typeof _0x5ac18d['offset']===_0x25b0('0x1d')&&typeof _0x5ac18d[_0x25b0('0x1e')]===_0x25b0('0x1d');var _0x3267b9=_0x51542b['count'];var _0x1d850f=_0xfe1ea6?0x0:_0x5ac18d[_0x25b0('0x1f')];var _0x20762e=_0xfe1ea6?_0x51542b[_0x25b0('0x20')]:_0x5ac18d[_0x25b0('0x1f')]+_0x5ac18d[_0x25b0('0x1e')];var _0x54f458;if(_0x20762e>=_0x3267b9){_0x20762e=_0x3267b9;_0x54f458=0xc8;}else{_0x54f458=0xce;}_0x40071c[_0x25b0('0x1a')](_0x54f458);return _0x40071c[_0x25b0('0x21')](_0x25b0('0x22'),_0x1d850f+'-'+_0x20762e+'/'+_0x3267b9)[_0x25b0('0x1c')](_0x51542b);}return null;};}function patchUpdates(_0x1dc691){return function(_0xea4162){try{jsonpatch[_0x25b0('0x23')](_0xea4162,_0x1dc691,!![]);}catch(_0x19599b){return BPromise[_0x25b0('0x24')](_0x19599b);}return _0xea4162[_0x25b0('0x25')]();};}function saveUpdates(_0x2b2eda,_0x3ce1da){return function(_0x5cb746){if(_0x5cb746){return _0x5cb746[_0x25b0('0x26')](_0x2b2eda)[_0x25b0('0x27')](function(_0x517ec5){return _0x517ec5;});}return null;};}function removeEntity(_0x2d7c17,_0x2023d8){return function(_0x3546f0){if(_0x3546f0){return _0x3546f0['destroy']()['then'](function(){var _0x50089e=_0x3546f0[_0x25b0('0x28')]({'plain':!![]});var _0x433085=_0x25b0('0x29');return db[_0x25b0('0x2a')][_0x25b0('0x2b')]({'where':{'type':_0x433085,'resourceId':_0x50089e['id']}})[_0x25b0('0x27')](function(){return _0x3546f0;});})[_0x25b0('0x27')](function(){_0x2d7c17[_0x25b0('0x1a')](0xcc)[_0x25b0('0x1b')]();});}};}function handleEntityNotFound(_0x596d14,_0x2ea408){return function(_0xbfba84){if(!_0xbfba84){_0x596d14['sendStatus'](0x194);}return _0xbfba84;};}function handleError(_0x567775,_0x5de43d){_0x5de43d=_0x5de43d||0x1f4;return function(_0x1a6212){logger[_0x25b0('0x2c')](_0x1a6212[_0x25b0('0x2d')]);if(_0x1a6212[_0x25b0('0x2e')]){delete _0x1a6212[_0x25b0('0x2e')];}_0x567775[_0x25b0('0x1a')](_0x5de43d)[_0x25b0('0x2f')](_0x1a6212);};}exports[_0x25b0('0x30')]=function(_0x36b81d,_0x285a2b){var _0x1e217c={},_0x3161c1={},_0x1ea374={'count':0x0,'rows':[]};var _0x4f640f=_['map'](db[_0x25b0('0x31')]['rawAttributes'],function(_0x4dfeea){return{'name':_0x4dfeea[_0x25b0('0x32')],'type':_0x4dfeea[_0x25b0('0x33')][_0x25b0('0x34')]};});_0x3161c1[_0x25b0('0x35')]=_[_0x25b0('0x36')](_0x4f640f,'name');_0x3161c1[_0x25b0('0x37')]=_[_0x25b0('0x38')](_0x36b81d['query']);_0x3161c1[_0x25b0('0x39')]=_[_0x25b0('0x3a')](_0x3161c1['model'],_0x3161c1[_0x25b0('0x37')]);_0x1e217c['attributes']=_[_0x25b0('0x3a')](_0x3161c1[_0x25b0('0x35')],qs[_0x25b0('0x3b')](_0x36b81d[_0x25b0('0x37')][_0x25b0('0x3b')]));_0x1e217c[_0x25b0('0x3c')]=_0x1e217c[_0x25b0('0x3c')][_0x25b0('0x3d')]?_0x1e217c[_0x25b0('0x3c')]:_0x3161c1['model'];if(!_0x36b81d[_0x25b0('0x37')][_0x25b0('0x3e')](_0x25b0('0x3f'))){_0x1e217c[_0x25b0('0x1e')]=qs[_0x25b0('0x1e')](_0x36b81d[_0x25b0('0x37')][_0x25b0('0x1e')]);_0x1e217c[_0x25b0('0x1f')]=qs[_0x25b0('0x1f')](_0x36b81d[_0x25b0('0x37')]['offset']);}_0x1e217c[_0x25b0('0x40')]=qs[_0x25b0('0x41')](_0x36b81d[_0x25b0('0x37')]['sort']);_0x1e217c[_0x25b0('0x42')]=qs[_0x25b0('0x39')](_[_0x25b0('0x43')](_0x36b81d[_0x25b0('0x37')],_0x3161c1[_0x25b0('0x39')]),_0x4f640f);if(_0x36b81d[_0x25b0('0x37')][_0x25b0('0x44')]){_0x1e217c[_0x25b0('0x42')]=_['merge'](_0x1e217c['where'],{'$or':_[_0x25b0('0x36')](_0x4f640f,function(_0x30d1e3){if(_0x30d1e3[_0x25b0('0x33')]!=='VIRTUAL'){var _0x9c6ab4={};_0x9c6ab4[_0x30d1e3['name']]={'$like':'%'+_0x36b81d[_0x25b0('0x37')][_0x25b0('0x44')]+'%'};return _0x9c6ab4;}})});}_0x1e217c=_[_0x25b0('0x45')]({},_0x1e217c,_0x36b81d[_0x25b0('0x46')]);var _0x8a2eeb={'where':_0x1e217c['where']};return db[_0x25b0('0x31')][_0x25b0('0x20')](_0x8a2eeb)[_0x25b0('0x27')](function(_0x376d8a){_0x1ea374[_0x25b0('0x20')]=_0x376d8a;if(_0x36b81d['query'][_0x25b0('0x47')]){_0x1e217c[_0x25b0('0x48')]=[{'all':!![]}];}return db[_0x25b0('0x31')][_0x25b0('0x49')](_0x1e217c);})[_0x25b0('0x27')](function(_0x1adf8d){_0x1ea374[_0x25b0('0x4a')]=_0x1adf8d;return _0x1ea374;})[_0x25b0('0x27')](respondWithFilteredResult(_0x285a2b,_0x1e217c))[_0x25b0('0x4b')](handleError(_0x285a2b,null));};exports[_0x25b0('0x4c')]=function(_0x124d4b,_0x5186cc){var _0x13e2cf={'raw':!![],'where':{'id':_0x124d4b[_0x25b0('0x4d')]['id']}},_0x5cb047={};_0x5cb047[_0x25b0('0x35')]=_[_0x25b0('0x38')](db[_0x25b0('0x31')]['rawAttributes']);_0x5cb047[_0x25b0('0x37')]=_[_0x25b0('0x38')](_0x124d4b[_0x25b0('0x37')]);_0x5cb047['filters']=_[_0x25b0('0x3a')](_0x5cb047[_0x25b0('0x35')],_0x5cb047[_0x25b0('0x37')]);_0x13e2cf[_0x25b0('0x3c')]=_[_0x25b0('0x3a')](_0x5cb047[_0x25b0('0x35')],qs[_0x25b0('0x3b')](_0x124d4b['query'][_0x25b0('0x3b')]));_0x13e2cf[_0x25b0('0x3c')]=_0x13e2cf[_0x25b0('0x3c')]['length']?_0x13e2cf[_0x25b0('0x3c')]:_0x5cb047[_0x25b0('0x35')];if(_0x124d4b[_0x25b0('0x37')][_0x25b0('0x47')]){_0x13e2cf[_0x25b0('0x48')]=[{'all':!![]}];}_0x13e2cf=_['merge']({},_0x13e2cf,_0x124d4b[_0x25b0('0x46')]);return db[_0x25b0('0x31')][_0x25b0('0x4e')](_0x13e2cf)['then'](handleEntityNotFound(_0x5186cc,null))[_0x25b0('0x27')](respondWithResult(_0x5186cc,null))[_0x25b0('0x4b')](handleError(_0x5186cc,null));};exports[_0x25b0('0x4f')]=function(_0x1d6d55,_0x29165e){return db[_0x25b0('0x31')]['create'](_0x1d6d55['body'],{})['then'](function(_0x1eb908){var _0x4bd7ba=_0x1d6d55['user'][_0x25b0('0x28')]({'plain':!![]});if(!_0x4bd7ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bd7ba[_0x25b0('0x50')]==='user'){var _0x4fc22d=_0x1eb908[_0x25b0('0x28')]({'plain':!![]});var _0x14a8a7=_0x25b0('0x29');return db[_0x25b0('0x51')][_0x25b0('0x4e')]({'where':{'name':_0x14a8a7,'userProfileId':_0x4bd7ba[_0x25b0('0x52')]},'raw':!![]})[_0x25b0('0x27')](function(_0x2d5522){if(_0x2d5522&&_0x2d5522[_0x25b0('0x53')]===0x0){return db[_0x25b0('0x2a')]['create']({'name':_0x4fc22d['name'],'resourceId':_0x4fc22d['id'],'type':_0x2d5522['name'],'sectionId':_0x2d5522['id']},{})[_0x25b0('0x27')](function(){return _0x1eb908;});}else{return _0x1eb908;}})[_0x25b0('0x4b')](function(_0x2a28fb){logger[_0x25b0('0x2c')](_0x25b0('0x54'),_0x2a28fb);throw _0x2a28fb;});}return _0x1eb908;})[_0x25b0('0x27')](respondWithResult(_0x29165e,0xc9))[_0x25b0('0x4b')](handleError(_0x29165e,null));};exports['update']=function(_0x64ffa3,_0x4a8adc){if(_0x64ffa3[_0x25b0('0x55')]['id']){delete _0x64ffa3['body']['id'];}return db['Tag'][_0x25b0('0x4e')]({'where':{'id':_0x64ffa3['params']['id']}})['then'](handleEntityNotFound(_0x4a8adc,null))[_0x25b0('0x27')](saveUpdates(_0x64ffa3[_0x25b0('0x55')],null))[_0x25b0('0x27')](respondWithResult(_0x4a8adc,null))[_0x25b0('0x4b')](handleError(_0x4a8adc,null));};exports[_0x25b0('0x2b')]=function(_0x367d57,_0x8bbdb3){return db[_0x25b0('0x31')][_0x25b0('0x4e')]({'where':{'id':_0x367d57[_0x25b0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x8bbdb3,null))['then'](removeEntity(_0x8bbdb3,null))[_0x25b0('0x4b')](handleError(_0x8bbdb3,null));};
\ No newline at end of file