Built motion from commit (unavailable).|2.5.9
[motion2.git] / server / api / tag / tag.controller.js
index 243fbc0..ee58da3 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 _0xbac8=['ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','Tags','UserProfileResource','stack','name','index','map','Tag','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','includeAll','include','catch','show','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x5ddf82,_0x1dd64b){var _0x3001f5=function(_0x44ac94){while(--_0x44ac94){_0x5ddf82['push'](_0x5ddf82['shift']());}};_0x3001f5(++_0x1dd64b);}(_0xbac8,0x18e));var _0x8bac=function(_0x2ee15b,_0x5a526a){_0x2ee15b=_0x2ee15b-0x0;var _0x38e14d=_0xbac8[_0x2ee15b];return _0x38e14d;};'use strict';var pdf=require(_0x8bac('0x0'));var emlformat=require(_0x8bac('0x1'));var rimraf=require(_0x8bac('0x2'));var zipdir=require(_0x8bac('0x3'));var jsonpatch=require(_0x8bac('0x4'));var rp=require(_0x8bac('0x5'));var moment=require(_0x8bac('0x6'));var BPromise=require(_0x8bac('0x7'));var Mustache=require(_0x8bac('0x8'));var util=require(_0x8bac('0x9'));var path=require(_0x8bac('0xa'));var sox=require('sox');var csv=require(_0x8bac('0xb'));var ejs=require(_0x8bac('0xc'));var fs=require('fs');var _=require(_0x8bac('0xd'));var squel=require(_0x8bac('0xe'));var crypto=require('crypto');var jsforce=require(_0x8bac('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8bac('0xb'));var querystring=require(_0x8bac('0x10'));var Papa=require(_0x8bac('0x11'));var Redis=require('ioredis');var authService=require(_0x8bac('0x12'));var qs=require(_0x8bac('0x13'));var as=require(_0x8bac('0x14'));var hardwareService=require(_0x8bac('0x15'));var logger=require(_0x8bac('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x8bac('0x17'));var licenseUtil=require(_0x8bac('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x60a86c,_0x487d8a){_0x487d8a=_0x487d8a||0xcc;return function(_0xdc0a1d){if(_0xdc0a1d){return _0x60a86c[_0x8bac('0x19')](_0x487d8a);}return _0x60a86c['status'](_0x487d8a)[_0x8bac('0x1a')]();};}function respondWithResult(_0x432949,_0x359de3){_0x359de3=_0x359de3||0xc8;return function(_0xdca01f){if(_0xdca01f){return _0x432949[_0x8bac('0x1b')](_0x359de3)['json'](_0xdca01f);}};}function respondWithFilteredResult(_0x27f301,_0x92839b){return function(_0x297731){if(_0x297731){var _0x3c5ba2=_0x297731[_0x8bac('0x1c')],_0x1cb8b6=_0x92839b[_0x8bac('0x1d')],_0x46056f=_0x92839b[_0x8bac('0x1d')]+_0x92839b[_0x8bac('0x1e')],_0x2d2ed7;if(_0x46056f>=_0x3c5ba2){_0x46056f=_0x3c5ba2;_0x2d2ed7=0xc8;}else{_0x2d2ed7=0xce;}_0x27f301[_0x8bac('0x1b')](_0x2d2ed7);return _0x27f301[_0x8bac('0x1f')](_0x8bac('0x20'),_0x1cb8b6+'-'+_0x46056f+'/'+_0x3c5ba2)[_0x8bac('0x21')](_0x297731);}return null;};}function patchUpdates(_0x41f894){return function(_0x1bcb47){try{jsonpatch['apply'](_0x1bcb47,_0x41f894,!![]);}catch(_0x4c8d81){return BPromise[_0x8bac('0x22')](_0x4c8d81);}return _0x1bcb47[_0x8bac('0x23')]();};}function saveUpdates(_0x2fabe2,_0x315db7){return function(_0x1c2cdd){if(_0x1c2cdd){return _0x1c2cdd[_0x8bac('0x24')](_0x2fabe2)[_0x8bac('0x25')](function(_0x4d152f){return _0x4d152f;});}return null;};}function removeEntity(_0x8811da,_0x349fe4){return function(_0x16faca){if(_0x16faca){return _0x16faca[_0x8bac('0x26')]()[_0x8bac('0x25')](function(){var _0x5c1f37=_0x16faca[_0x8bac('0x27')]({'plain':!![]});var _0x5c7379=_0x8bac('0x28');return db[_0x8bac('0x29')]['destroy']({'where':{'type':_0x5c7379,'resourceId':_0x5c1f37['id']}})[_0x8bac('0x25')](function(){return _0x16faca;});})[_0x8bac('0x25')](function(){_0x8811da[_0x8bac('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30ffe5,_0x1c7831){return function(_0x34827a){if(!_0x34827a){_0x30ffe5[_0x8bac('0x19')](0x194);}return _0x34827a;};}function handleError(_0x564ec6,_0x10cdac){_0x10cdac=_0x10cdac||0x1f4;return function(_0x329759){logger['error'](_0x329759[_0x8bac('0x2a')]);if(_0x329759[_0x8bac('0x2b')]){delete _0x329759['name'];}_0x564ec6[_0x8bac('0x1b')](_0x10cdac)['send'](_0x329759);};}exports[_0x8bac('0x2c')]=function(_0x10f5b8,_0x345a3a){var _0x5aa2e3={},_0x3af0c5={},_0x56b834={'count':0x0,'rows':[]};var _0x3df127=_[_0x8bac('0x2d')](db[_0x8bac('0x2e')]['rawAttributes'],function(_0x4d78d0){return{'name':_0x4d78d0['fieldName'],'type':_0x4d78d0['type']['key']};});_0x3af0c5[_0x8bac('0x2f')]=_[_0x8bac('0x2d')](_0x3df127,_0x8bac('0x2b'));_0x3af0c5[_0x8bac('0x30')]=_[_0x8bac('0x31')](_0x10f5b8[_0x8bac('0x30')]);_0x3af0c5[_0x8bac('0x32')]=_['intersection'](_0x3af0c5[_0x8bac('0x2f')],_0x3af0c5[_0x8bac('0x30')]);_0x5aa2e3[_0x8bac('0x33')]=_[_0x8bac('0x34')](_0x3af0c5['model'],qs[_0x8bac('0x35')](_0x10f5b8[_0x8bac('0x30')][_0x8bac('0x35')]));_0x5aa2e3['attributes']=_0x5aa2e3['attributes'][_0x8bac('0x36')]?_0x5aa2e3[_0x8bac('0x33')]:_0x3af0c5[_0x8bac('0x2f')];if(!_0x10f5b8[_0x8bac('0x30')][_0x8bac('0x37')](_0x8bac('0x38'))){_0x5aa2e3['limit']=qs[_0x8bac('0x1e')](_0x10f5b8[_0x8bac('0x30')]['limit']);_0x5aa2e3['offset']=qs[_0x8bac('0x1d')](_0x10f5b8[_0x8bac('0x30')][_0x8bac('0x1d')]);}_0x5aa2e3['order']=qs[_0x8bac('0x39')](_0x10f5b8['query'][_0x8bac('0x39')]);_0x5aa2e3['where']=qs[_0x8bac('0x32')](_[_0x8bac('0x3a')](_0x10f5b8['query'],_0x3af0c5[_0x8bac('0x32')]),_0x3df127);if(_0x10f5b8['query'][_0x8bac('0x3b')]){_0x5aa2e3['where']=_[_0x8bac('0x3c')](_0x5aa2e3[_0x8bac('0x3d')],{'$or':_[_0x8bac('0x2d')](_0x3df127,function(_0x5a54c8){if(_0x5a54c8[_0x8bac('0x3e')]!==_0x8bac('0x3f')){var _0x218493={};_0x218493[_0x5a54c8['name']]={'$like':'%'+_0x10f5b8[_0x8bac('0x30')][_0x8bac('0x3b')]+'%'};return _0x218493;}})});}_0x5aa2e3=_[_0x8bac('0x3c')]({},_0x5aa2e3,_0x10f5b8['options']);var _0x515418={'where':_0x5aa2e3[_0x8bac('0x3d')]};return db[_0x8bac('0x2e')][_0x8bac('0x1c')](_0x515418)[_0x8bac('0x25')](function(_0x3808f9){_0x56b834[_0x8bac('0x1c')]=_0x3808f9;if(_0x10f5b8[_0x8bac('0x30')][_0x8bac('0x40')]){_0x5aa2e3[_0x8bac('0x41')]=[{'all':!![]}];}return db[_0x8bac('0x2e')]['findAll'](_0x5aa2e3);})['then'](function(_0x302880){_0x56b834['rows']=_0x302880;return _0x56b834;})[_0x8bac('0x25')](respondWithFilteredResult(_0x345a3a,_0x5aa2e3))[_0x8bac('0x42')](handleError(_0x345a3a,null));};exports[_0x8bac('0x43')]=function(_0x475938,_0x126fde){var _0x378c58={'raw':!![],'where':{'id':_0x475938[_0x8bac('0x44')]['id']}},_0x1b0dc2={};_0x1b0dc2['model']=_[_0x8bac('0x31')](db[_0x8bac('0x2e')][_0x8bac('0x45')]);_0x1b0dc2[_0x8bac('0x30')]=_[_0x8bac('0x31')](_0x475938[_0x8bac('0x30')]);_0x1b0dc2[_0x8bac('0x32')]=_[_0x8bac('0x34')](_0x1b0dc2[_0x8bac('0x2f')],_0x1b0dc2[_0x8bac('0x30')]);_0x378c58[_0x8bac('0x33')]=_[_0x8bac('0x34')](_0x1b0dc2[_0x8bac('0x2f')],qs[_0x8bac('0x35')](_0x475938[_0x8bac('0x30')]['fields']));_0x378c58[_0x8bac('0x33')]=_0x378c58[_0x8bac('0x33')][_0x8bac('0x36')]?_0x378c58[_0x8bac('0x33')]:_0x1b0dc2[_0x8bac('0x2f')];if(_0x475938['query']['includeAll']){_0x378c58['include']=[{'all':!![]}];}_0x378c58=_[_0x8bac('0x3c')]({},_0x378c58,_0x475938[_0x8bac('0x46')]);return db[_0x8bac('0x2e')][_0x8bac('0x47')](_0x378c58)[_0x8bac('0x25')](handleEntityNotFound(_0x126fde,null))[_0x8bac('0x25')](respondWithResult(_0x126fde,null))[_0x8bac('0x42')](handleError(_0x126fde,null));};exports['create']=function(_0x2eced8,_0x474c71){return db['Tag'][_0x8bac('0x48')](_0x2eced8[_0x8bac('0x49')],{})[_0x8bac('0x25')](function(_0x15fe61){var _0x5efee1=_0x2eced8[_0x8bac('0x4a')][_0x8bac('0x27')]({'plain':!![]});if(!_0x5efee1)throw new Error(_0x8bac('0x4b'));if(_0x5efee1[_0x8bac('0x4c')]===_0x8bac('0x4a')){var _0x5a219f=_0x15fe61[_0x8bac('0x27')]({'plain':!![]});var _0x3de846=_0x8bac('0x28');return db[_0x8bac('0x4d')][_0x8bac('0x47')]({'where':{'name':_0x3de846,'userProfileId':_0x5efee1[_0x8bac('0x4e')]},'raw':!![]})[_0x8bac('0x25')](function(_0xceb2e3){if(_0xceb2e3&&_0xceb2e3[_0x8bac('0x4f')]===0x0){return db[_0x8bac('0x29')]['create']({'name':_0x5a219f[_0x8bac('0x2b')],'resourceId':_0x5a219f['id'],'type':_0xceb2e3['name'],'sectionId':_0xceb2e3['id']},{})[_0x8bac('0x25')](function(){return _0x15fe61;});}else{return _0x15fe61;}})[_0x8bac('0x42')](function(_0x56310c){logger[_0x8bac('0x50')](_0x8bac('0x51'),_0x56310c);throw _0x56310c;});}return _0x15fe61;})['then'](respondWithResult(_0x474c71,0xc9))[_0x8bac('0x42')](handleError(_0x474c71,null));};exports[_0x8bac('0x24')]=function(_0x32473,_0x499047){if(_0x32473[_0x8bac('0x49')]['id']){delete _0x32473['body']['id'];}return db['Tag'][_0x8bac('0x47')]({'where':{'id':_0x32473['params']['id']}})['then'](handleEntityNotFound(_0x499047,null))[_0x8bac('0x25')](saveUpdates(_0x32473[_0x8bac('0x49')],null))[_0x8bac('0x25')](respondWithResult(_0x499047,null))['catch'](handleError(_0x499047,null));};exports[_0x8bac('0x26')]=function(_0x3868a0,_0x420a76){return db[_0x8bac('0x2e')][_0x8bac('0x47')]({'where':{'id':_0x3868a0['params']['id']}})[_0x8bac('0x25')](handleEntityNotFound(_0x420a76,null))[_0x8bac('0x25')](removeEntity(_0x420a76,null))[_0x8bac('0x42')](handleError(_0x420a76,null));};
\ No newline at end of file