Built motion from commit 19a84241.|2.5.34
[motion2.git] / server / api / tag / tag.controller.js
index 10c2299..2fbee7d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x99e8=['send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','catch','show','params','keys','length','includeAll','find','body','user','get','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','json','apply','reject','save','update','then','Tags','UserProfileResource','destroy','end','error','stack','name'];(function(_0x5b3c06,_0x1b7e19){var _0x5a10b3=function(_0x2f92ed){while(--_0x2f92ed){_0x5b3c06['push'](_0x5b3c06['shift']());}};_0x5a10b3(++_0x1b7e19);}(_0x99e8,0x110));var _0x899e=function(_0x432cf1,_0x4a0c36){_0x432cf1=_0x432cf1-0x0;var _0x135f8d=_0x99e8[_0x432cf1];return _0x135f8d;};'use strict';var pdf=require(_0x899e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x899e('0x1'));var zipdir=require(_0x899e('0x2'));var jsonpatch=require(_0x899e('0x3'));var rp=require(_0x899e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x899e('0x5'));var util=require(_0x899e('0x6'));var path=require(_0x899e('0x7'));var sox=require(_0x899e('0x8'));var csv=require('to-csv');var ejs=require(_0x899e('0x9'));var fs=require('fs');var _=require(_0x899e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x899e('0xb'));var toCsv=require(_0x899e('0xc'));var querystring=require(_0x899e('0xd'));var Papa=require(_0x899e('0xe'));var Redis=require(_0x899e('0xf'));var authService=require(_0x899e('0x10'));var qs=require(_0x899e('0x11'));var as=require(_0x899e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x899e('0x13'));var utils=require('../../config/utils');var config=require(_0x899e('0x14'));var db=require(_0x899e('0x15'))['db'];function respondWithStatusCode(_0x3cec08,_0xf24791){_0xf24791=_0xf24791||0xcc;return function(_0x380a8f){if(_0x380a8f){return _0x3cec08[_0x899e('0x16')](_0xf24791);}return _0x3cec08['status'](_0xf24791)['end']();};}function respondWithResult(_0x5b19cb,_0x5011d0){_0x5011d0=_0x5011d0||0xc8;return function(_0x5f5c61){if(_0x5f5c61){return _0x5b19cb[_0x899e('0x17')](_0x5011d0)['json'](_0x5f5c61);}};}function respondWithFilteredResult(_0x4bfc26,_0x226015){return function(_0x1402b7){if(_0x1402b7){var _0x3f35ce=_0x1402b7[_0x899e('0x18')],_0x4b469c=_0x226015[_0x899e('0x19')],_0x56a31b=_0x226015[_0x899e('0x19')]+_0x226015[_0x899e('0x1a')],_0x2f34d5;if(_0x56a31b>=_0x3f35ce){_0x56a31b=_0x3f35ce;_0x2f34d5=0xc8;}else{_0x2f34d5=0xce;}_0x4bfc26[_0x899e('0x17')](_0x2f34d5);return _0x4bfc26['set']('Content-Range',_0x4b469c+'-'+_0x56a31b+'/'+_0x3f35ce)[_0x899e('0x1b')](_0x1402b7);}return null;};}function patchUpdates(_0x473513){return function(_0xfe74e){try{jsonpatch[_0x899e('0x1c')](_0xfe74e,_0x473513,!![]);}catch(_0x124e66){return BPromise[_0x899e('0x1d')](_0x124e66);}return _0xfe74e[_0x899e('0x1e')]();};}function saveUpdates(_0x384fe8,_0x45a568){return function(_0x4f7b2e){if(_0x4f7b2e){return _0x4f7b2e[_0x899e('0x1f')](_0x384fe8)[_0x899e('0x20')](function(_0x58d39e){return _0x58d39e;});}return null;};}function removeEntity(_0x245b0b,_0x308606){return function(_0x117882){if(_0x117882){return _0x117882['destroy']()['then'](function(){var _0x2113fe=_0x117882['get']({'plain':!![]});var _0x558b17=_0x899e('0x21');return db[_0x899e('0x22')][_0x899e('0x23')]({'where':{'type':_0x558b17,'resourceId':_0x2113fe['id']}})['then'](function(){return _0x117882;});})[_0x899e('0x20')](function(){_0x245b0b['status'](0xcc)[_0x899e('0x24')]();});}};}function handleEntityNotFound(_0x30706a,_0xe501d0){return function(_0x1eeea8){if(!_0x1eeea8){_0x30706a[_0x899e('0x16')](0x194);}return _0x1eeea8;};}function handleError(_0xda88d8,_0x174836){_0x174836=_0x174836||0x1f4;return function(_0x4cff01){logger[_0x899e('0x25')](_0x4cff01[_0x899e('0x26')]);if(_0x4cff01[_0x899e('0x27')]){delete _0x4cff01[_0x899e('0x27')];}_0xda88d8[_0x899e('0x17')](_0x174836)[_0x899e('0x28')](_0x4cff01);};}exports[_0x899e('0x29')]=function(_0x42854f,_0x55c52f){var _0x1fbda6={},_0x24e9a2={},_0x46b132={'count':0x0,'rows':[]};var _0x5f0084=_[_0x899e('0x2a')](db[_0x899e('0x2b')][_0x899e('0x2c')],function(_0x4a4997){return{'name':_0x4a4997[_0x899e('0x2d')],'type':_0x4a4997[_0x899e('0x2e')][_0x899e('0x2f')]};});_0x24e9a2[_0x899e('0x30')]=_[_0x899e('0x2a')](_0x5f0084,'name');_0x24e9a2[_0x899e('0x31')]=_['keys'](_0x42854f[_0x899e('0x31')]);_0x24e9a2[_0x899e('0x32')]=_['intersection'](_0x24e9a2[_0x899e('0x30')],_0x24e9a2[_0x899e('0x31')]);_0x1fbda6[_0x899e('0x33')]=_[_0x899e('0x34')](_0x24e9a2['model'],qs['fields'](_0x42854f[_0x899e('0x31')][_0x899e('0x35')]));_0x1fbda6[_0x899e('0x33')]=_0x1fbda6[_0x899e('0x33')]['length']?_0x1fbda6[_0x899e('0x33')]:_0x24e9a2[_0x899e('0x30')];if(!_0x42854f[_0x899e('0x31')][_0x899e('0x36')](_0x899e('0x37'))){_0x1fbda6['limit']=qs[_0x899e('0x1a')](_0x42854f[_0x899e('0x31')]['limit']);_0x1fbda6[_0x899e('0x19')]=qs[_0x899e('0x19')](_0x42854f[_0x899e('0x31')][_0x899e('0x19')]);}_0x1fbda6[_0x899e('0x38')]=qs[_0x899e('0x39')](_0x42854f['query'][_0x899e('0x39')]);_0x1fbda6['where']=qs[_0x899e('0x32')](_[_0x899e('0x3a')](_0x42854f['query'],_0x24e9a2['filters']));if(_0x42854f['query'][_0x899e('0x3b')]){_0x1fbda6['where']=_[_0x899e('0x3c')](_0x1fbda6[_0x899e('0x3d')],{'$or':_['map'](_0x5f0084,function(_0x50543a){if(_0x50543a['type']!==_0x899e('0x3e')){var _0x3891df={};_0x3891df[_0x50543a['name']]={'$like':'%'+_0x42854f['query'][_0x899e('0x3b')]+'%'};return _0x3891df;}})});}_0x1fbda6=_['merge']({},_0x1fbda6,_0x42854f[_0x899e('0x3f')]);var _0x30927e={'where':_0x1fbda6[_0x899e('0x3d')]};return db[_0x899e('0x2b')][_0x899e('0x18')](_0x30927e)[_0x899e('0x20')](function(_0x214e0a){_0x46b132[_0x899e('0x18')]=_0x214e0a;if(_0x42854f[_0x899e('0x31')]['includeAll']){_0x1fbda6[_0x899e('0x40')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x1fbda6);})[_0x899e('0x20')](function(_0x25b2a2){_0x46b132['rows']=_0x25b2a2;return _0x46b132;})[_0x899e('0x20')](respondWithFilteredResult(_0x55c52f,_0x1fbda6))[_0x899e('0x41')](handleError(_0x55c52f,null));};exports[_0x899e('0x42')]=function(_0x4c305c,_0xbe9e16){var _0x3ed1db={'raw':!![],'where':{'id':_0x4c305c[_0x899e('0x43')]['id']}},_0x24f61d={};_0x24f61d[_0x899e('0x30')]=_[_0x899e('0x44')](db[_0x899e('0x2b')][_0x899e('0x2c')]);_0x24f61d[_0x899e('0x31')]=_[_0x899e('0x44')](_0x4c305c['query']);_0x24f61d['filters']=_[_0x899e('0x34')](_0x24f61d[_0x899e('0x30')],_0x24f61d['query']);_0x3ed1db[_0x899e('0x33')]=_['intersection'](_0x24f61d['model'],qs[_0x899e('0x35')](_0x4c305c[_0x899e('0x31')][_0x899e('0x35')]));_0x3ed1db[_0x899e('0x33')]=_0x3ed1db[_0x899e('0x33')][_0x899e('0x45')]?_0x3ed1db['attributes']:_0x24f61d[_0x899e('0x30')];if(_0x4c305c[_0x899e('0x31')][_0x899e('0x46')]){_0x3ed1db['include']=[{'all':!![]}];}_0x3ed1db=_[_0x899e('0x3c')]({},_0x3ed1db,_0x4c305c[_0x899e('0x3f')]);return db[_0x899e('0x2b')][_0x899e('0x47')](_0x3ed1db)[_0x899e('0x20')](handleEntityNotFound(_0xbe9e16,null))['then'](respondWithResult(_0xbe9e16,null))[_0x899e('0x41')](handleError(_0xbe9e16,null));};exports['create']=function(_0x2b4f6c,_0xd2b3d6){return db[_0x899e('0x2b')]['create'](_0x2b4f6c[_0x899e('0x48')],{})[_0x899e('0x20')](function(_0x4f8bc7){var _0x505c6c=_0x2b4f6c[_0x899e('0x49')][_0x899e('0x4a')]({'plain':!![]});if(!_0x505c6c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x505c6c[_0x899e('0x4b')]===_0x899e('0x49')){var _0x5f18fb=_0x4f8bc7[_0x899e('0x4a')]({'plain':!![]});var _0x25665e=_0x899e('0x21');return db['UserProfileSection'][_0x899e('0x47')]({'where':{'name':_0x25665e,'userProfileId':_0x505c6c[_0x899e('0x4c')]},'raw':!![]})[_0x899e('0x20')](function(_0x2d0ef7){if(_0x2d0ef7&&_0x2d0ef7['autoAssociation']===0x0){return db[_0x899e('0x22')]['create']({'name':_0x5f18fb['name'],'resourceId':_0x5f18fb['id'],'type':_0x2d0ef7[_0x899e('0x27')],'sectionId':_0x2d0ef7['id']},{})[_0x899e('0x20')](function(){return _0x4f8bc7;});}else{return _0x4f8bc7;}})[_0x899e('0x41')](function(_0x44274b){logger[_0x899e('0x25')](_0x899e('0x4d'),_0x44274b);throw _0x44274b;});}return _0x4f8bc7;})[_0x899e('0x20')](respondWithResult(_0xd2b3d6,0xc9))['catch'](handleError(_0xd2b3d6,null));};exports['update']=function(_0x578025,_0x3b43ec){if(_0x578025['body']['id']){delete _0x578025[_0x899e('0x48')]['id'];}return db['Tag'][_0x899e('0x47')]({'where':{'id':_0x578025[_0x899e('0x43')]['id']}})[_0x899e('0x20')](handleEntityNotFound(_0x3b43ec,null))[_0x899e('0x20')](saveUpdates(_0x578025[_0x899e('0x48')],null))['then'](respondWithResult(_0x3b43ec,null))[_0x899e('0x41')](handleError(_0x3b43ec,null));};exports[_0x899e('0x23')]=function(_0x1106d0,_0x3ab7cd){return db['Tag'][_0x899e('0x47')]({'where':{'id':_0x1106d0['params']['id']}})['then'](handleEntityNotFound(_0x3ab7cd,null))['then'](removeEntity(_0x3ab7cd,null))[_0x899e('0x41')](handleError(_0x3ab7cd,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