Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / api / tag / tag.controller.js
index 9e30bdc..71019bc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2f68=['fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','Tags','error','stack','name','send','index','Tag','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','body','destroy','rimraf','zip-dir'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x2f68,0x9a));var _0x82f6=function(_0x27bee4,_0x4ca770){_0x27bee4=_0x27bee4-0x0;var _0x58b946=_0x2f68[_0x27bee4];return _0x58b946;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82f6('0x0'));var zipdir=require(_0x82f6('0x1'));var jsonpatch=require(_0x82f6('0x2'));var rp=require(_0x82f6('0x3'));var moment=require('moment');var BPromise=require(_0x82f6('0x4'));var Mustache=require('mustache');var util=require(_0x82f6('0x5'));var path=require(_0x82f6('0x6'));var sox=require('sox');var csv=require(_0x82f6('0x7'));var ejs=require(_0x82f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x82f6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x82f6('0xa'));var toCsv=require(_0x82f6('0x7'));var querystring=require(_0x82f6('0xb'));var Papa=require('papaparse');var Redis=require(_0x82f6('0xc'));var authService=require(_0x82f6('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x82f6('0xe'));var hardwareService=require(_0x82f6('0xf'));var logger=require(_0x82f6('0x10'))(_0x82f6('0x11'));var utils=require(_0x82f6('0x12'));var config=require(_0x82f6('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x82f6('0x14'))['db'];function respondWithStatusCode(_0x442262,_0x4cc967){_0x4cc967=_0x4cc967||0xcc;return function(_0x194da7){if(_0x194da7){return _0x442262[_0x82f6('0x15')](_0x4cc967);}return _0x442262[_0x82f6('0x16')](_0x4cc967)[_0x82f6('0x17')]();};}function respondWithResult(_0x371481,_0xa00275){_0xa00275=_0xa00275||0xc8;return function(_0x115c7b){if(_0x115c7b){return _0x371481[_0x82f6('0x16')](_0xa00275)[_0x82f6('0x18')](_0x115c7b);}};}function respondWithFilteredResult(_0x55b58e,_0x389949){return function(_0x5d0827){if(_0x5d0827){var _0x249222=typeof _0x389949[_0x82f6('0x19')]===_0x82f6('0x1a')&&typeof _0x389949[_0x82f6('0x1b')]===_0x82f6('0x1a');var _0x2326ae=_0x5d0827[_0x82f6('0x1c')];var _0xcbc95f=_0x249222?0x0:_0x389949[_0x82f6('0x19')];var _0x2bfd57=_0x249222?_0x5d0827[_0x82f6('0x1c')]:_0x389949[_0x82f6('0x19')]+_0x389949[_0x82f6('0x1b')];var _0x4fe226;if(_0x2bfd57>=_0x2326ae){_0x2bfd57=_0x2326ae;_0x4fe226=0xc8;}else{_0x4fe226=0xce;}_0x55b58e[_0x82f6('0x16')](_0x4fe226);return _0x55b58e['set'](_0x82f6('0x1d'),_0xcbc95f+'-'+_0x2bfd57+'/'+_0x2326ae)[_0x82f6('0x18')](_0x5d0827);}return null;};}function patchUpdates(_0x55cbce){return function(_0x2b03ad){try{jsonpatch[_0x82f6('0x1e')](_0x2b03ad,_0x55cbce,!![]);}catch(_0x46713a){return BPromise[_0x82f6('0x1f')](_0x46713a);}return _0x2b03ad['save']();};}function saveUpdates(_0xdc4dea,_0x4beccf){return function(_0x8668bb){if(_0x8668bb){return _0x8668bb[_0x82f6('0x20')](_0xdc4dea)['then'](function(_0x516deb){return _0x516deb;});}return null;};}function removeEntity(_0x3af5f7,_0x1d96d5){return function(_0x4c57c5){if(_0x4c57c5){return _0x4c57c5['destroy']()[_0x82f6('0x21')](function(){var _0x31face=_0x4c57c5['get']({'plain':!![]});var _0xfd8b68=_0x82f6('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0xfd8b68,'resourceId':_0x31face['id']}})[_0x82f6('0x21')](function(){return _0x4c57c5;});})['then'](function(){_0x3af5f7[_0x82f6('0x16')](0xcc)[_0x82f6('0x17')]();});}};}function handleEntityNotFound(_0x54ce11,_0x3795ef){return function(_0x15c9b7){if(!_0x15c9b7){_0x54ce11[_0x82f6('0x15')](0x194);}return _0x15c9b7;};}function handleError(_0x1125a0,_0x4f9fa4){_0x4f9fa4=_0x4f9fa4||0x1f4;return function(_0x40a071){logger[_0x82f6('0x23')](_0x40a071[_0x82f6('0x24')]);if(_0x40a071[_0x82f6('0x25')]){delete _0x40a071[_0x82f6('0x25')];}_0x1125a0[_0x82f6('0x16')](_0x4f9fa4)[_0x82f6('0x26')](_0x40a071);};}exports[_0x82f6('0x27')]=function(_0x1e1aa4,_0x402449){var _0x3c9419={},_0x20d1c5={},_0x6ce179={'count':0x0,'rows':[]};var _0x91117b=_['map'](db[_0x82f6('0x28')][_0x82f6('0x29')],function(_0x418f34){return{'name':_0x418f34['fieldName'],'type':_0x418f34[_0x82f6('0x2a')][_0x82f6('0x2b')]};});_0x20d1c5[_0x82f6('0x2c')]=_[_0x82f6('0x2d')](_0x91117b,_0x82f6('0x25'));_0x20d1c5[_0x82f6('0x2e')]=_[_0x82f6('0x2f')](_0x1e1aa4[_0x82f6('0x2e')]);_0x20d1c5[_0x82f6('0x30')]=_[_0x82f6('0x31')](_0x20d1c5[_0x82f6('0x2c')],_0x20d1c5[_0x82f6('0x2e')]);_0x3c9419[_0x82f6('0x32')]=_[_0x82f6('0x31')](_0x20d1c5['model'],qs[_0x82f6('0x33')](_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x33')]));_0x3c9419[_0x82f6('0x32')]=_0x3c9419[_0x82f6('0x32')][_0x82f6('0x34')]?_0x3c9419[_0x82f6('0x32')]:_0x20d1c5[_0x82f6('0x2c')];if(!_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x35')](_0x82f6('0x36'))){_0x3c9419[_0x82f6('0x1b')]=qs[_0x82f6('0x1b')](_0x1e1aa4[_0x82f6('0x2e')]['limit']);_0x3c9419[_0x82f6('0x19')]=qs['offset'](_0x1e1aa4['query'][_0x82f6('0x19')]);}_0x3c9419[_0x82f6('0x37')]=qs['sort'](_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x38')]);_0x3c9419[_0x82f6('0x39')]=qs['filters'](_[_0x82f6('0x3a')](_0x1e1aa4['query'],_0x20d1c5[_0x82f6('0x30')]),_0x91117b);if(_0x1e1aa4['query'][_0x82f6('0x3b')]){_0x3c9419['where']=_[_0x82f6('0x3c')](_0x3c9419[_0x82f6('0x39')],{'$or':_['map'](_0x91117b,function(_0xfce1dd){if(_0xfce1dd[_0x82f6('0x2a')]!==_0x82f6('0x3d')){var _0x43dcd1={};_0x43dcd1[_0xfce1dd['name']]={'$like':'%'+_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x3b')]+'%'};return _0x43dcd1;}})});}_0x3c9419=_[_0x82f6('0x3c')]({},_0x3c9419,_0x1e1aa4[_0x82f6('0x3e')]);var _0x55ecd4={'where':_0x3c9419[_0x82f6('0x39')]};return db[_0x82f6('0x28')]['count'](_0x55ecd4)[_0x82f6('0x21')](function(_0x699803){_0x6ce179[_0x82f6('0x1c')]=_0x699803;if(_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x3f')]){_0x3c9419['include']=[{'all':!![]}];}return db[_0x82f6('0x28')]['findAll'](_0x3c9419);})[_0x82f6('0x21')](function(_0x38e82d){_0x6ce179[_0x82f6('0x40')]=_0x38e82d;return _0x6ce179;})[_0x82f6('0x21')](respondWithFilteredResult(_0x402449,_0x3c9419))[_0x82f6('0x41')](handleError(_0x402449,null));};exports[_0x82f6('0x42')]=function(_0x43fefc,_0x47a0d1){var _0x165493={'raw':!![],'where':{'id':_0x43fefc[_0x82f6('0x43')]['id']}},_0x297cda={};_0x297cda[_0x82f6('0x2c')]=_['keys'](db[_0x82f6('0x28')]['rawAttributes']);_0x297cda[_0x82f6('0x2e')]=_[_0x82f6('0x2f')](_0x43fefc[_0x82f6('0x2e')]);_0x297cda[_0x82f6('0x30')]=_[_0x82f6('0x31')](_0x297cda[_0x82f6('0x2c')],_0x297cda['query']);_0x165493[_0x82f6('0x32')]=_[_0x82f6('0x31')](_0x297cda[_0x82f6('0x2c')],qs[_0x82f6('0x33')](_0x43fefc[_0x82f6('0x2e')][_0x82f6('0x33')]));_0x165493[_0x82f6('0x32')]=_0x165493[_0x82f6('0x32')]['length']?_0x165493[_0x82f6('0x32')]:_0x297cda[_0x82f6('0x2c')];if(_0x43fefc['query'][_0x82f6('0x3f')]){_0x165493['include']=[{'all':!![]}];}_0x165493=_[_0x82f6('0x3c')]({},_0x165493,_0x43fefc['options']);return db[_0x82f6('0x28')][_0x82f6('0x44')](_0x165493)[_0x82f6('0x21')](handleEntityNotFound(_0x47a0d1,null))[_0x82f6('0x21')](respondWithResult(_0x47a0d1,null))[_0x82f6('0x41')](handleError(_0x47a0d1,null));};exports[_0x82f6('0x45')]=function(_0x53f7d4,_0x3cb1f0){return db[_0x82f6('0x28')]['create'](_0x53f7d4['body'],{})[_0x82f6('0x21')](function(_0x2a6366){var _0x2c2b64=_0x53f7d4['user'][_0x82f6('0x46')]({'plain':!![]});if(!_0x2c2b64)throw new Error(_0x82f6('0x47'));if(_0x2c2b64[_0x82f6('0x48')]===_0x82f6('0x49')){var _0x4e9e13=_0x2a6366['get']({'plain':!![]});var _0x1695ea=_0x82f6('0x22');return db[_0x82f6('0x4a')]['find']({'where':{'name':_0x1695ea,'userProfileId':_0x2c2b64[_0x82f6('0x4b')]},'raw':!![]})[_0x82f6('0x21')](function(_0x4bc646){if(_0x4bc646&&_0x4bc646['autoAssociation']===0x0){return db['UserProfileResource'][_0x82f6('0x45')]({'name':_0x4e9e13['name'],'resourceId':_0x4e9e13['id'],'type':_0x4bc646[_0x82f6('0x25')],'sectionId':_0x4bc646['id']},{})['then'](function(){return _0x2a6366;});}else{return _0x2a6366;}})[_0x82f6('0x41')](function(_0x4f69de){logger[_0x82f6('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f69de);throw _0x4f69de;});}return _0x2a6366;})[_0x82f6('0x21')](respondWithResult(_0x3cb1f0,0xc9))[_0x82f6('0x41')](handleError(_0x3cb1f0,null));};exports[_0x82f6('0x20')]=function(_0x1633cf,_0xb8d7d8){if(_0x1633cf[_0x82f6('0x4c')]['id']){delete _0x1633cf['body']['id'];}return db[_0x82f6('0x28')][_0x82f6('0x44')]({'where':{'id':_0x1633cf[_0x82f6('0x43')]['id']}})['then'](handleEntityNotFound(_0xb8d7d8,null))['then'](saveUpdates(_0x1633cf[_0x82f6('0x4c')],null))[_0x82f6('0x21')](respondWithResult(_0xb8d7d8,null))[_0x82f6('0x41')](handleError(_0xb8d7d8,null));};exports[_0x82f6('0x4d')]=function(_0x49a204,_0x2c1c0e){return db[_0x82f6('0x28')][_0x82f6('0x44')]({'where':{'id':_0x49a204['params']['id']}})['then'](handleEntityNotFound(_0x2c1c0e,null))['then'](removeEntity(_0x2c1c0e,null))[_0x82f6('0x41')](handleError(_0x2c1c0e,null));};
\ No newline at end of file
+var _0xbec5=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','name','send','index','map','Tag','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','pick','filter','where','options','includeAll','include','catch','show','merge','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','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x1eb841,_0x255fa5){var _0x3297ed=function(_0xbd61e9){while(--_0xbd61e9){_0x1eb841['push'](_0x1eb841['shift']());}};_0x3297ed(++_0x255fa5);}(_0xbec5,0xe5));var _0x5bec=function(_0x318256,_0xa773f3){_0x318256=_0x318256-0x0;var _0xb1e352=_0xbec5[_0x318256];return _0xb1e352;};'use strict';var emlformat=require(_0x5bec('0x0'));var rimraf=require(_0x5bec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bec('0x2'));var rp=require(_0x5bec('0x3'));var moment=require(_0x5bec('0x4'));var BPromise=require(_0x5bec('0x5'));var Mustache=require(_0x5bec('0x6'));var util=require('util');var path=require(_0x5bec('0x7'));var sox=require(_0x5bec('0x8'));var csv=require(_0x5bec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bec('0xa'));var _=require(_0x5bec('0xb'));var squel=require(_0x5bec('0xc'));var crypto=require(_0x5bec('0xd'));var jsforce=require(_0x5bec('0xe'));var deskjs=require(_0x5bec('0xf'));var toCsv=require(_0x5bec('0x9'));var querystring=require(_0x5bec('0x10'));var Papa=require('papaparse');var Redis=require(_0x5bec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5bec('0x12'));var as=require(_0x5bec('0x13'));var hardwareService=require(_0x5bec('0x14'));var logger=require('../../config/logger')(_0x5bec('0x15'));var utils=require(_0x5bec('0x16'));var config=require(_0x5bec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bec('0x18'))['db'];function respondWithStatusCode(_0x1c888f,_0x589d14){_0x589d14=_0x589d14||0xcc;return function(_0x2d2ba2){if(_0x2d2ba2){return _0x1c888f[_0x5bec('0x19')](_0x589d14);}return _0x1c888f[_0x5bec('0x1a')](_0x589d14)[_0x5bec('0x1b')]();};}function respondWithResult(_0x3198e0,_0xcd6d90){_0xcd6d90=_0xcd6d90||0xc8;return function(_0x24dcd6){if(_0x24dcd6){return _0x3198e0[_0x5bec('0x1a')](_0xcd6d90)[_0x5bec('0x1c')](_0x24dcd6);}};}function respondWithFilteredResult(_0x3ebc41,_0x31b9e4){return function(_0x325daf){if(_0x325daf){var _0x11fb8e=typeof _0x31b9e4['offset']==='undefined'&&typeof _0x31b9e4[_0x5bec('0x1d')]===_0x5bec('0x1e');var _0x31ad9c=_0x325daf[_0x5bec('0x1f')];var _0x5cd7ae=_0x11fb8e?0x0:_0x31b9e4['offset'];var _0x3cd354=_0x11fb8e?_0x325daf[_0x5bec('0x1f')]:_0x31b9e4['offset']+_0x31b9e4[_0x5bec('0x1d')];var _0xa7e223;if(_0x3cd354>=_0x31ad9c){_0x3cd354=_0x31ad9c;_0xa7e223=0xc8;}else{_0xa7e223=0xce;}_0x3ebc41[_0x5bec('0x1a')](_0xa7e223);return _0x3ebc41[_0x5bec('0x20')]('Content-Range',_0x5cd7ae+'-'+_0x3cd354+'/'+_0x31ad9c)[_0x5bec('0x1c')](_0x325daf);}return null;};}function patchUpdates(_0x5be91c){return function(_0x191c0f){try{jsonpatch[_0x5bec('0x21')](_0x191c0f,_0x5be91c,!![]);}catch(_0x3e1896){return BPromise[_0x5bec('0x22')](_0x3e1896);}return _0x191c0f[_0x5bec('0x23')]();};}function saveUpdates(_0x5e154e,_0x232584){return function(_0x4cfcb8){if(_0x4cfcb8){return _0x4cfcb8[_0x5bec('0x24')](_0x5e154e)[_0x5bec('0x25')](function(_0x5b2636){return _0x5b2636;});}return null;};}function removeEntity(_0xa414f8,_0xbef70b){return function(_0x4e0ca2){if(_0x4e0ca2){return _0x4e0ca2[_0x5bec('0x26')]()[_0x5bec('0x25')](function(){var _0x43d460=_0x4e0ca2[_0x5bec('0x27')]({'plain':!![]});var _0x226d55=_0x5bec('0x28');return db[_0x5bec('0x29')]['destroy']({'where':{'type':_0x226d55,'resourceId':_0x43d460['id']}})['then'](function(){return _0x4e0ca2;});})['then'](function(){_0xa414f8[_0x5bec('0x1a')](0xcc)[_0x5bec('0x1b')]();});}};}function handleEntityNotFound(_0x338c25,_0x4939a5){return function(_0x2b3b2c){if(!_0x2b3b2c){_0x338c25[_0x5bec('0x19')](0x194);}return _0x2b3b2c;};}function handleError(_0x57331b,_0x29e358){_0x29e358=_0x29e358||0x1f4;return function(_0x63ac8){logger['error'](_0x63ac8['stack']);if(_0x63ac8[_0x5bec('0x2a')]){delete _0x63ac8[_0x5bec('0x2a')];}_0x57331b[_0x5bec('0x1a')](_0x29e358)[_0x5bec('0x2b')](_0x63ac8);};}exports[_0x5bec('0x2c')]=function(_0x3f224c,_0x5d6621){var _0x2987ca={},_0x59b5b6={},_0x45863b={'count':0x0,'rows':[]};var _0xafbd94=_[_0x5bec('0x2d')](db[_0x5bec('0x2e')]['rawAttributes'],function(_0x2b42c8){return{'name':_0x2b42c8[_0x5bec('0x2f')],'type':_0x2b42c8[_0x5bec('0x30')]['key']};});_0x59b5b6[_0x5bec('0x31')]=_['map'](_0xafbd94,_0x5bec('0x2a'));_0x59b5b6[_0x5bec('0x32')]=_[_0x5bec('0x33')](_0x3f224c['query']);_0x59b5b6[_0x5bec('0x34')]=_[_0x5bec('0x35')](_0x59b5b6['model'],_0x59b5b6[_0x5bec('0x32')]);_0x2987ca[_0x5bec('0x36')]=_[_0x5bec('0x35')](_0x59b5b6[_0x5bec('0x31')],qs[_0x5bec('0x37')](_0x3f224c['query'][_0x5bec('0x37')]));_0x2987ca['attributes']=_0x2987ca[_0x5bec('0x36')][_0x5bec('0x38')]?_0x2987ca[_0x5bec('0x36')]:_0x59b5b6[_0x5bec('0x31')];if(!_0x3f224c[_0x5bec('0x32')][_0x5bec('0x39')]('nolimit')){_0x2987ca[_0x5bec('0x1d')]=qs[_0x5bec('0x1d')](_0x3f224c[_0x5bec('0x32')]['limit']);_0x2987ca[_0x5bec('0x3a')]=qs[_0x5bec('0x3a')](_0x3f224c['query'][_0x5bec('0x3a')]);}_0x2987ca['order']=qs[_0x5bec('0x3b')](_0x3f224c[_0x5bec('0x32')][_0x5bec('0x3b')]);_0x2987ca['where']=qs[_0x5bec('0x34')](_[_0x5bec('0x3c')](_0x3f224c[_0x5bec('0x32')],_0x59b5b6[_0x5bec('0x34')]),_0xafbd94);if(_0x3f224c[_0x5bec('0x32')][_0x5bec('0x3d')]){_0x2987ca[_0x5bec('0x3e')]=_['merge'](_0x2987ca[_0x5bec('0x3e')],{'$or':_[_0x5bec('0x2d')](_0xafbd94,function(_0x323812){if(_0x323812[_0x5bec('0x30')]!=='VIRTUAL'){var _0x27863b={};_0x27863b[_0x323812[_0x5bec('0x2a')]]={'$like':'%'+_0x3f224c[_0x5bec('0x32')]['filter']+'%'};return _0x27863b;}})});}_0x2987ca=_['merge']({},_0x2987ca,_0x3f224c[_0x5bec('0x3f')]);var _0x153d02={'where':_0x2987ca[_0x5bec('0x3e')]};return db[_0x5bec('0x2e')][_0x5bec('0x1f')](_0x153d02)['then'](function(_0x4fee8a){_0x45863b[_0x5bec('0x1f')]=_0x4fee8a;if(_0x3f224c['query'][_0x5bec('0x40')]){_0x2987ca[_0x5bec('0x41')]=[{'all':!![]}];}return db[_0x5bec('0x2e')]['findAll'](_0x2987ca);})[_0x5bec('0x25')](function(_0x26a4a5){_0x45863b['rows']=_0x26a4a5;return _0x45863b;})[_0x5bec('0x25')](respondWithFilteredResult(_0x5d6621,_0x2987ca))[_0x5bec('0x42')](handleError(_0x5d6621,null));};exports[_0x5bec('0x43')]=function(_0x2b51f7,_0x3b5631){var _0x2724cf={'raw':!![],'where':{'id':_0x2b51f7['params']['id']}},_0x3a795c={};_0x3a795c['model']=_[_0x5bec('0x33')](db['Tag']['rawAttributes']);_0x3a795c[_0x5bec('0x32')]=_['keys'](_0x2b51f7['query']);_0x3a795c['filters']=_[_0x5bec('0x35')](_0x3a795c[_0x5bec('0x31')],_0x3a795c[_0x5bec('0x32')]);_0x2724cf[_0x5bec('0x36')]=_['intersection'](_0x3a795c[_0x5bec('0x31')],qs[_0x5bec('0x37')](_0x2b51f7[_0x5bec('0x32')][_0x5bec('0x37')]));_0x2724cf['attributes']=_0x2724cf[_0x5bec('0x36')][_0x5bec('0x38')]?_0x2724cf[_0x5bec('0x36')]:_0x3a795c['model'];if(_0x2b51f7[_0x5bec('0x32')]['includeAll']){_0x2724cf[_0x5bec('0x41')]=[{'all':!![]}];}_0x2724cf=_[_0x5bec('0x44')]({},_0x2724cf,_0x2b51f7[_0x5bec('0x3f')]);return db[_0x5bec('0x2e')]['find'](_0x2724cf)[_0x5bec('0x25')](handleEntityNotFound(_0x3b5631,null))[_0x5bec('0x25')](respondWithResult(_0x3b5631,null))[_0x5bec('0x42')](handleError(_0x3b5631,null));};exports[_0x5bec('0x45')]=function(_0x35b250,_0x123758){return db[_0x5bec('0x2e')]['create'](_0x35b250[_0x5bec('0x46')],{})[_0x5bec('0x25')](function(_0x5775ca){var _0x273e09=_0x35b250[_0x5bec('0x47')][_0x5bec('0x27')]({'plain':!![]});if(!_0x273e09)throw new Error(_0x5bec('0x48'));if(_0x273e09[_0x5bec('0x49')]===_0x5bec('0x47')){var _0x3545a5=_0x5775ca['get']({'plain':!![]});var _0x101dcb='Tags';return db[_0x5bec('0x4a')][_0x5bec('0x4b')]({'where':{'name':_0x101dcb,'userProfileId':_0x273e09[_0x5bec('0x4c')]},'raw':!![]})[_0x5bec('0x25')](function(_0x158e8e){if(_0x158e8e&&_0x158e8e[_0x5bec('0x4d')]===0x0){return db[_0x5bec('0x29')][_0x5bec('0x45')]({'name':_0x3545a5[_0x5bec('0x2a')],'resourceId':_0x3545a5['id'],'type':_0x158e8e[_0x5bec('0x2a')],'sectionId':_0x158e8e['id']},{})['then'](function(){return _0x5775ca;});}else{return _0x5775ca;}})[_0x5bec('0x42')](function(_0x51af88){logger['error'](_0x5bec('0x4e'),_0x51af88);throw _0x51af88;});}return _0x5775ca;})['then'](respondWithResult(_0x123758,0xc9))['catch'](handleError(_0x123758,null));};exports[_0x5bec('0x24')]=function(_0x2114e5,_0x416058){if(_0x2114e5['body']['id']){delete _0x2114e5[_0x5bec('0x46')]['id'];}return db[_0x5bec('0x2e')][_0x5bec('0x4b')]({'where':{'id':_0x2114e5[_0x5bec('0x4f')]['id']}})['then'](handleEntityNotFound(_0x416058,null))[_0x5bec('0x25')](saveUpdates(_0x2114e5[_0x5bec('0x46')],null))[_0x5bec('0x25')](respondWithResult(_0x416058,null))[_0x5bec('0x42')](handleError(_0x416058,null));};exports[_0x5bec('0x26')]=function(_0x3ddf28,_0x33b924){return db['Tag']['find']({'where':{'id':_0x3ddf28[_0x5bec('0x4f')]['id']}})['then'](handleEntityNotFound(_0x33b924,null))[_0x5bec('0x25')](removeEntity(_0x33b924,null))[_0x5bec('0x42')](handleError(_0x33b924,null));};
\ No newline at end of file