Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / api / tag / tag.controller.js
index 652bfed..5a1bd1a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4f11=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','render','merge','agent','interaction','account','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','Tag','includeAll','include','findAll','rows','catch','show','keys','find','create'];(function(_0x41544a,_0x344217){var _0x9b2c99=function(_0x384a01){while(--_0x384a01){_0x41544a['push'](_0x41544a['shift']());}};_0x9b2c99(++_0x344217);}(_0x4f11,0xb7));var _0x14f1=function(_0x45b701,_0x5a4703){_0x45b701=_0x45b701-0x0;var _0x246885=_0x4f11[_0x45b701];return _0x246885;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x14f1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14f1('0x1'));var rp=require(_0x14f1('0x2'));var moment=require(_0x14f1('0x3'));var BPromise=require(_0x14f1('0x4'));var Mustache=require(_0x14f1('0x5'));var util=require('util');var path=require(_0x14f1('0x6'));var sox=require(_0x14f1('0x7'));var csv=require(_0x14f1('0x8'));var ejs=require(_0x14f1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14f1('0xa'));var squel=require(_0x14f1('0xb'));var crypto=require(_0x14f1('0xc'));var jsforce=require(_0x14f1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x14f1('0xe'));var authService=require(_0x14f1('0xf'));var qs=require(_0x14f1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x14f1('0x11'))(_0x14f1('0x12'));var utils=require(_0x14f1('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x14f1('0x14'))['db'];function respondWithStatusCode(_0xbe9c10,_0x18f822){_0x18f822=_0x18f822||0xcc;return function(_0x500a25){if(_0x500a25){return _0xbe9c10[_0x14f1('0x15')](_0x18f822);}return _0xbe9c10[_0x14f1('0x16')](_0x18f822)[_0x14f1('0x17')]();};}function respondWithResult(_0x5dec3f,_0x14c8da){_0x14c8da=_0x14c8da||0xc8;return function(_0x50c055){if(_0x50c055){return _0x5dec3f['status'](_0x14c8da)[_0x14f1('0x18')](_0x50c055);}};}function respondWithFilteredResult(_0xffaf71,_0x556b71){return function(_0x2e8de7){if(_0x2e8de7){var _0x5337ea=typeof _0x556b71[_0x14f1('0x19')]===_0x14f1('0x1a')&&typeof _0x556b71['limit']==='undefined';var _0x42fc8d=_0x2e8de7['count'];var _0x411a22=_0x5337ea?0x0:_0x556b71[_0x14f1('0x19')];var _0x4362ef=_0x5337ea?_0x2e8de7[_0x14f1('0x1b')]:_0x556b71['offset']+_0x556b71[_0x14f1('0x1c')];var _0x1dda97;if(_0x4362ef>=_0x42fc8d){_0x4362ef=_0x42fc8d;_0x1dda97=0xc8;}else{_0x1dda97=0xce;}_0xffaf71['status'](_0x1dda97);return _0xffaf71[_0x14f1('0x1d')](_0x14f1('0x1e'),_0x411a22+'-'+_0x4362ef+'/'+_0x42fc8d)[_0x14f1('0x18')](_0x2e8de7);}return null;};}function patchUpdates(_0x535ce4){return function(_0xa4b8fe){try{jsonpatch['apply'](_0xa4b8fe,_0x535ce4,!![]);}catch(_0x19ff16){return BPromise['reject'](_0x19ff16);}return _0xa4b8fe[_0x14f1('0x1f')]();};}function saveUpdates(_0x2966f1,_0x2d0c24){return function(_0x2aa64f){if(_0x2aa64f){return _0x2aa64f[_0x14f1('0x20')](_0x2966f1)[_0x14f1('0x21')](function(_0x346cdd){return _0x346cdd;});}return null;};}function removeEntity(_0x5b6fe2,_0x30b7e2){return function(_0x219f97){if(_0x219f97){return _0x219f97[_0x14f1('0x22')]()[_0x14f1('0x21')](function(){var _0x1a3b85=_0x219f97[_0x14f1('0x23')]({'plain':!![]});var _0x30dee7=_0x14f1('0x24');return db[_0x14f1('0x25')][_0x14f1('0x22')]({'where':{'type':_0x30dee7,'resourceId':_0x1a3b85['id']}})[_0x14f1('0x21')](function(){return _0x219f97;});})[_0x14f1('0x21')](function(){_0x5b6fe2[_0x14f1('0x16')](0xcc)[_0x14f1('0x17')]();});}};}function handleEntityNotFound(_0x3fdf81,_0xf5b4d){return function(_0x313ce0){if(!_0x313ce0){_0x3fdf81[_0x14f1('0x15')](0x194);}return _0x313ce0;};}function handleError(_0x294e27,_0x5cda1a){_0x5cda1a=_0x5cda1a||0x1f4;return function(_0x10d040){logger[_0x14f1('0x26')](_0x10d040[_0x14f1('0x27')]);if(_0x10d040[_0x14f1('0x28')]){delete _0x10d040[_0x14f1('0x28')];}_0x294e27[_0x14f1('0x16')](_0x5cda1a)['send'](_0x10d040);};}function getMustacheRender(_0x190828,_0x31b483){return Mustache[_0x14f1('0x29')](_0x190828,_[_0x14f1('0x2a')](_0x31b483['body'],{'contact':_0x31b483['contact'],'message':_0x31b483['message'],'agent':_0x31b483[_0x14f1('0x2b')],'interaction':_0x31b483[_0x14f1('0x2c')],'account':_0x31b483[_0x14f1('0x2d')]}))||'';}exports[_0x14f1('0x2e')]=function(_0x49eb7e,_0xced84){var _0xb20b33={},_0x331df9={},_0x3f90b8={'count':0x0,'rows':[]};var _0x3e21ef=_[_0x14f1('0x2f')](db['Tag'][_0x14f1('0x30')],function(_0x5ed809){return{'name':_0x5ed809[_0x14f1('0x31')],'type':_0x5ed809[_0x14f1('0x32')][_0x14f1('0x33')]};});_0x331df9[_0x14f1('0x34')]=_['map'](_0x3e21ef,_0x14f1('0x28'));_0x331df9[_0x14f1('0x35')]=_['keys'](_0x49eb7e['query']);_0x331df9[_0x14f1('0x36')]=_[_0x14f1('0x37')](_0x331df9[_0x14f1('0x34')],_0x331df9[_0x14f1('0x35')]);_0xb20b33['attributes']=_['intersection'](_0x331df9['model'],qs['fields'](_0x49eb7e[_0x14f1('0x35')][_0x14f1('0x38')]));_0xb20b33[_0x14f1('0x39')]=_0xb20b33[_0x14f1('0x39')][_0x14f1('0x3a')]?_0xb20b33[_0x14f1('0x39')]:_0x331df9[_0x14f1('0x34')];if(!_0x49eb7e[_0x14f1('0x35')][_0x14f1('0x3b')](_0x14f1('0x3c'))){_0xb20b33[_0x14f1('0x1c')]=qs[_0x14f1('0x1c')](_0x49eb7e[_0x14f1('0x35')][_0x14f1('0x1c')]);_0xb20b33[_0x14f1('0x19')]=qs['offset'](_0x49eb7e[_0x14f1('0x35')]['offset']);}_0xb20b33[_0x14f1('0x3d')]=qs[_0x14f1('0x3e')](_0x49eb7e[_0x14f1('0x35')][_0x14f1('0x3e')]);_0xb20b33[_0x14f1('0x3f')]=qs['filters'](_[_0x14f1('0x40')](_0x49eb7e[_0x14f1('0x35')],_0x331df9['filters']),_0x3e21ef);if(_0x49eb7e[_0x14f1('0x35')][_0x14f1('0x41')]){_0xb20b33[_0x14f1('0x3f')]=_[_0x14f1('0x2a')](_0xb20b33['where'],{'$or':_[_0x14f1('0x2f')](_0x3e21ef,function(_0x2e8627){if(_0x2e8627[_0x14f1('0x32')]!==_0x14f1('0x42')){var _0x3eef27={};_0x3eef27[_0x2e8627[_0x14f1('0x28')]]={'$like':'%'+_0x49eb7e[_0x14f1('0x35')][_0x14f1('0x41')]+'%'};return _0x3eef27;}})});}_0xb20b33=_['merge']({},_0xb20b33,_0x49eb7e[_0x14f1('0x43')]);var _0x31aa5f={'where':_0xb20b33['where']};return db[_0x14f1('0x44')][_0x14f1('0x1b')](_0x31aa5f)['then'](function(_0x1a5db3){_0x3f90b8[_0x14f1('0x1b')]=_0x1a5db3;if(_0x49eb7e[_0x14f1('0x35')][_0x14f1('0x45')]){_0xb20b33[_0x14f1('0x46')]=[{'all':!![]}];}return db[_0x14f1('0x44')][_0x14f1('0x47')](_0xb20b33);})[_0x14f1('0x21')](function(_0x10c8f7){_0x3f90b8[_0x14f1('0x48')]=_0x10c8f7;return _0x3f90b8;})['then'](respondWithFilteredResult(_0xced84,_0xb20b33))[_0x14f1('0x49')](handleError(_0xced84,null));};exports[_0x14f1('0x4a')]=function(_0x507eed,_0x5c04ee){var _0x291b14={'raw':!![],'where':{'id':_0x507eed['params']['id']}},_0x1f7979={};_0x1f7979[_0x14f1('0x34')]=_[_0x14f1('0x4b')](db[_0x14f1('0x44')]['rawAttributes']);_0x1f7979[_0x14f1('0x35')]=_['keys'](_0x507eed[_0x14f1('0x35')]);_0x1f7979[_0x14f1('0x36')]=_['intersection'](_0x1f7979[_0x14f1('0x34')],_0x1f7979['query']);_0x291b14[_0x14f1('0x39')]=_[_0x14f1('0x37')](_0x1f7979['model'],qs['fields'](_0x507eed[_0x14f1('0x35')][_0x14f1('0x38')]));_0x291b14[_0x14f1('0x39')]=_0x291b14[_0x14f1('0x39')][_0x14f1('0x3a')]?_0x291b14[_0x14f1('0x39')]:_0x1f7979['model'];if(_0x507eed[_0x14f1('0x35')][_0x14f1('0x45')]){_0x291b14['include']=[{'all':!![]}];}_0x291b14=_[_0x14f1('0x2a')]({},_0x291b14,_0x507eed[_0x14f1('0x43')]);return db['Tag'][_0x14f1('0x4c')](_0x291b14)[_0x14f1('0x21')](handleEntityNotFound(_0x5c04ee,null))['then'](respondWithResult(_0x5c04ee,null))['catch'](handleError(_0x5c04ee,null));};exports[_0x14f1('0x4d')]=function(_0x4458cb,_0x5bf05b){return db['Tag']['create'](_0x4458cb[_0x14f1('0x4e')],{})[_0x14f1('0x21')](function(_0x57852d){var _0x3601f1=_0x4458cb[_0x14f1('0x4f')][_0x14f1('0x23')]({'plain':!![]});if(!_0x3601f1)throw new Error(_0x14f1('0x50'));if(_0x3601f1[_0x14f1('0x51')]===_0x14f1('0x4f')){var _0x5c310b=_0x57852d[_0x14f1('0x23')]({'plain':!![]});var _0xe65327=_0x14f1('0x24');return db[_0x14f1('0x52')][_0x14f1('0x4c')]({'where':{'name':_0xe65327,'userProfileId':_0x3601f1[_0x14f1('0x53')]},'raw':!![]})[_0x14f1('0x21')](function(_0x5c07c8){if(_0x5c07c8&&_0x5c07c8[_0x14f1('0x54')]===0x0){return db[_0x14f1('0x25')][_0x14f1('0x4d')]({'name':_0x5c310b['name'],'resourceId':_0x5c310b['id'],'type':_0x5c07c8['name'],'sectionId':_0x5c07c8['id']},{})[_0x14f1('0x21')](function(){return _0x57852d;});}else{return _0x57852d;}})[_0x14f1('0x49')](function(_0x237615){logger[_0x14f1('0x26')](_0x14f1('0x55'),_0x237615);throw _0x237615;});}return _0x57852d;})['then'](respondWithResult(_0x5bf05b,0xc9))[_0x14f1('0x49')](handleError(_0x5bf05b,null));};exports[_0x14f1('0x20')]=function(_0xb7a639,_0x11f845){if(_0xb7a639[_0x14f1('0x4e')]['id']){delete _0xb7a639[_0x14f1('0x4e')]['id'];}return db[_0x14f1('0x44')][_0x14f1('0x4c')]({'where':{'id':_0xb7a639[_0x14f1('0x56')]['id']}})['then'](handleEntityNotFound(_0x11f845,null))['then'](saveUpdates(_0xb7a639['body'],null))[_0x14f1('0x21')](respondWithResult(_0x11f845,null))[_0x14f1('0x49')](handleError(_0x11f845,null));};exports[_0x14f1('0x22')]=function(_0xf4a92d,_0x5b6d81){return db[_0x14f1('0x44')][_0x14f1('0x4c')]({'where':{'id':_0xf4a92d[_0x14f1('0x56')]['id']}})[_0x14f1('0x21')](handleEntityNotFound(_0x5b6d81,null))[_0x14f1('0x21')](removeEntity(_0x5b6d81,null))['catch'](handleError(_0x5b6d81,null));};
\ No newline at end of file
+var _0xd844=['create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','Tags','UserProfileResource','stack','name','send','render','merge','body','contact','agent','account','index','map','Tag','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','length'];(function(_0x325e76,_0x2d509c){var _0x1548e9=function(_0x15b53c){while(--_0x15b53c){_0x325e76['push'](_0x325e76['shift']());}};_0x1548e9(++_0x2d509c);}(_0xd844,0x1c6));var _0x4d84=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd844[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x4d84('0x0'));var rimraf=require(_0x4d84('0x1'));var zipdir=require(_0x4d84('0x2'));var jsonpatch=require(_0x4d84('0x3'));var rp=require('request-promise');var moment=require(_0x4d84('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4d84('0x5'));var util=require(_0x4d84('0x6'));var path=require(_0x4d84('0x7'));var sox=require(_0x4d84('0x8'));var csv=require(_0x4d84('0x9'));var ejs=require(_0x4d84('0xa'));var fs=require('fs');var fs_extra=require(_0x4d84('0xb'));var _=require('lodash');var squel=require(_0x4d84('0xc'));var crypto=require(_0x4d84('0xd'));var jsforce=require(_0x4d84('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4d84('0xf'));var Papa=require(_0x4d84('0x10'));var Redis=require(_0x4d84('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4d84('0x12'));var as=require(_0x4d84('0x13'));var hardwareService=require(_0x4d84('0x14'));var logger=require(_0x4d84('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4d84('0x16'));var licenseUtil=require(_0x4d84('0x17'));var db=require(_0x4d84('0x18'))['db'];function respondWithStatusCode(_0xd96f41,_0x2cf0c8){_0x2cf0c8=_0x2cf0c8||0xcc;return function(_0x2b4a56){if(_0x2b4a56){return _0xd96f41[_0x4d84('0x19')](_0x2cf0c8);}return _0xd96f41[_0x4d84('0x1a')](_0x2cf0c8)[_0x4d84('0x1b')]();};}function respondWithResult(_0x4a4a55,_0x108406){_0x108406=_0x108406||0xc8;return function(_0x5b5c36){if(_0x5b5c36){return _0x4a4a55['status'](_0x108406)[_0x4d84('0x1c')](_0x5b5c36);}};}function respondWithFilteredResult(_0x2f6806,_0x260252){return function(_0x3bdb9c){if(_0x3bdb9c){var _0x338e6a=typeof _0x260252['offset']===_0x4d84('0x1d')&&typeof _0x260252[_0x4d84('0x1e')]===_0x4d84('0x1d');var _0x3d7d9f=_0x3bdb9c['count'];var _0x1fe67a=_0x338e6a?0x0:_0x260252[_0x4d84('0x1f')];var _0x45cabe=_0x338e6a?_0x3bdb9c[_0x4d84('0x20')]:_0x260252['offset']+_0x260252[_0x4d84('0x1e')];var _0x5b5b7c;if(_0x45cabe>=_0x3d7d9f){_0x45cabe=_0x3d7d9f;_0x5b5b7c=0xc8;}else{_0x5b5b7c=0xce;}_0x2f6806[_0x4d84('0x1a')](_0x5b5b7c);return _0x2f6806['set'](_0x4d84('0x21'),_0x1fe67a+'-'+_0x45cabe+'/'+_0x3d7d9f)[_0x4d84('0x1c')](_0x3bdb9c);}return null;};}function patchUpdates(_0x38da55){return function(_0x5645a0){try{jsonpatch[_0x4d84('0x22')](_0x5645a0,_0x38da55,!![]);}catch(_0x4e2bcb){return BPromise[_0x4d84('0x23')](_0x4e2bcb);}return _0x5645a0[_0x4d84('0x24')]();};}function saveUpdates(_0x422699,_0x51dbef){return function(_0x28617e){if(_0x28617e){return _0x28617e[_0x4d84('0x25')](_0x422699)[_0x4d84('0x26')](function(_0x282aa0){return _0x282aa0;});}return null;};}function removeEntity(_0x41e80e,_0x19e344){return function(_0x50c6d8){if(_0x50c6d8){return _0x50c6d8[_0x4d84('0x27')]()[_0x4d84('0x26')](function(){var _0x3d090c=_0x50c6d8['get']({'plain':!![]});var _0x4472a8=_0x4d84('0x28');return db[_0x4d84('0x29')][_0x4d84('0x27')]({'where':{'type':_0x4472a8,'resourceId':_0x3d090c['id']}})[_0x4d84('0x26')](function(){return _0x50c6d8;});})['then'](function(){_0x41e80e[_0x4d84('0x1a')](0xcc)[_0x4d84('0x1b')]();});}};}function handleEntityNotFound(_0x17910b,_0x4b3bd2){return function(_0x326552){if(!_0x326552){_0x17910b['sendStatus'](0x194);}return _0x326552;};}function handleError(_0xded821,_0x359b01){_0x359b01=_0x359b01||0x1f4;return function(_0x594f3b){logger['error'](_0x594f3b[_0x4d84('0x2a')]);if(_0x594f3b[_0x4d84('0x2b')]){delete _0x594f3b[_0x4d84('0x2b')];}_0xded821['status'](_0x359b01)[_0x4d84('0x2c')](_0x594f3b);};}function getMustacheRender(_0x27e241,_0x1f88a9){return Mustache[_0x4d84('0x2d')](_0x27e241,_[_0x4d84('0x2e')](_0x1f88a9[_0x4d84('0x2f')],{'contact':_0x1f88a9[_0x4d84('0x30')],'message':_0x1f88a9['message'],'agent':_0x1f88a9[_0x4d84('0x31')],'interaction':_0x1f88a9['interaction'],'account':_0x1f88a9[_0x4d84('0x32')]}))||'';}exports[_0x4d84('0x33')]=function(_0x3877da,_0x5166b3){var _0x387f3f={},_0x14331a={},_0x422821={'count':0x0,'rows':[]};var _0x59172f=_[_0x4d84('0x34')](db[_0x4d84('0x35')][_0x4d84('0x36')],function(_0x3f40ef){return{'name':_0x3f40ef[_0x4d84('0x37')],'type':_0x3f40ef[_0x4d84('0x38')]['key']};});_0x14331a[_0x4d84('0x39')]=_[_0x4d84('0x34')](_0x59172f,_0x4d84('0x2b'));_0x14331a[_0x4d84('0x3a')]=_['keys'](_0x3877da['query']);_0x14331a['filters']=_[_0x4d84('0x3b')](_0x14331a['model'],_0x14331a[_0x4d84('0x3a')]);_0x387f3f['attributes']=_[_0x4d84('0x3b')](_0x14331a[_0x4d84('0x39')],qs[_0x4d84('0x3c')](_0x3877da[_0x4d84('0x3a')][_0x4d84('0x3c')]));_0x387f3f['attributes']=_0x387f3f[_0x4d84('0x3d')]['length']?_0x387f3f[_0x4d84('0x3d')]:_0x14331a[_0x4d84('0x39')];if(!_0x3877da[_0x4d84('0x3a')][_0x4d84('0x3e')](_0x4d84('0x3f'))){_0x387f3f['limit']=qs['limit'](_0x3877da['query']['limit']);_0x387f3f[_0x4d84('0x1f')]=qs[_0x4d84('0x1f')](_0x3877da['query']['offset']);}_0x387f3f['order']=qs[_0x4d84('0x40')](_0x3877da['query'][_0x4d84('0x40')]);_0x387f3f[_0x4d84('0x41')]=qs[_0x4d84('0x42')](_[_0x4d84('0x43')](_0x3877da[_0x4d84('0x3a')],_0x14331a[_0x4d84('0x42')]),_0x59172f);if(_0x3877da['query']['filter']){_0x387f3f['where']=_[_0x4d84('0x2e')](_0x387f3f[_0x4d84('0x41')],{'$or':_['map'](_0x59172f,function(_0x5134c9){if(_0x5134c9['type']!==_0x4d84('0x44')){var _0x27125a={};_0x27125a[_0x5134c9['name']]={'$like':'%'+_0x3877da[_0x4d84('0x3a')][_0x4d84('0x45')]+'%'};return _0x27125a;}})});}_0x387f3f=_[_0x4d84('0x2e')]({},_0x387f3f,_0x3877da[_0x4d84('0x46')]);var _0xee0cae={'where':_0x387f3f['where']};return db[_0x4d84('0x35')][_0x4d84('0x20')](_0xee0cae)[_0x4d84('0x26')](function(_0xf6db26){_0x422821['count']=_0xf6db26;if(_0x3877da[_0x4d84('0x3a')][_0x4d84('0x47')]){_0x387f3f[_0x4d84('0x48')]=[{'all':!![]}];}return db[_0x4d84('0x35')][_0x4d84('0x49')](_0x387f3f);})[_0x4d84('0x26')](function(_0x202e5c){_0x422821[_0x4d84('0x4a')]=_0x202e5c;return _0x422821;})[_0x4d84('0x26')](respondWithFilteredResult(_0x5166b3,_0x387f3f))[_0x4d84('0x4b')](handleError(_0x5166b3,null));};exports[_0x4d84('0x4c')]=function(_0x226147,_0x567433){var _0x4f48b8={'raw':!![],'where':{'id':_0x226147[_0x4d84('0x4d')]['id']}},_0x21114d={};_0x21114d[_0x4d84('0x39')]=_[_0x4d84('0x4e')](db[_0x4d84('0x35')]['rawAttributes']);_0x21114d[_0x4d84('0x3a')]=_[_0x4d84('0x4e')](_0x226147[_0x4d84('0x3a')]);_0x21114d[_0x4d84('0x42')]=_[_0x4d84('0x3b')](_0x21114d[_0x4d84('0x39')],_0x21114d[_0x4d84('0x3a')]);_0x4f48b8[_0x4d84('0x3d')]=_[_0x4d84('0x3b')](_0x21114d[_0x4d84('0x39')],qs[_0x4d84('0x3c')](_0x226147[_0x4d84('0x3a')][_0x4d84('0x3c')]));_0x4f48b8[_0x4d84('0x3d')]=_0x4f48b8[_0x4d84('0x3d')][_0x4d84('0x4f')]?_0x4f48b8[_0x4d84('0x3d')]:_0x21114d[_0x4d84('0x39')];if(_0x226147[_0x4d84('0x3a')][_0x4d84('0x47')]){_0x4f48b8[_0x4d84('0x48')]=[{'all':!![]}];}_0x4f48b8=_['merge']({},_0x4f48b8,_0x226147['options']);return db[_0x4d84('0x35')]['find'](_0x4f48b8)[_0x4d84('0x26')](handleEntityNotFound(_0x567433,null))[_0x4d84('0x26')](respondWithResult(_0x567433,null))[_0x4d84('0x4b')](handleError(_0x567433,null));};exports['create']=function(_0x5ddbea,_0x34da50){return db[_0x4d84('0x35')][_0x4d84('0x50')](_0x5ddbea[_0x4d84('0x2f')],{})['then'](function(_0x6bd329){var _0x22b20e=_0x5ddbea['user']['get']({'plain':!![]});if(!_0x22b20e)throw new Error(_0x4d84('0x51'));if(_0x22b20e[_0x4d84('0x52')]==='user'){var _0x2a598a=_0x6bd329[_0x4d84('0x53')]({'plain':!![]});var _0x58be4b='Tags';return db[_0x4d84('0x54')][_0x4d84('0x55')]({'where':{'name':_0x58be4b,'userProfileId':_0x22b20e[_0x4d84('0x56')]},'raw':!![]})['then'](function(_0x5f26ee){if(_0x5f26ee&&_0x5f26ee['autoAssociation']===0x0){return db['UserProfileResource'][_0x4d84('0x50')]({'name':_0x2a598a[_0x4d84('0x2b')],'resourceId':_0x2a598a['id'],'type':_0x5f26ee[_0x4d84('0x2b')],'sectionId':_0x5f26ee['id']},{})[_0x4d84('0x26')](function(){return _0x6bd329;});}else{return _0x6bd329;}})['catch'](function(_0x3d66d0){logger[_0x4d84('0x57')](_0x4d84('0x58'),_0x3d66d0);throw _0x3d66d0;});}return _0x6bd329;})[_0x4d84('0x26')](respondWithResult(_0x34da50,0xc9))[_0x4d84('0x4b')](handleError(_0x34da50,null));};exports[_0x4d84('0x25')]=function(_0x4127ac,_0x58397c){if(_0x4127ac[_0x4d84('0x2f')]['id']){delete _0x4127ac['body']['id'];}return db[_0x4d84('0x35')][_0x4d84('0x55')]({'where':{'id':_0x4127ac['params']['id']}})[_0x4d84('0x26')](handleEntityNotFound(_0x58397c,null))[_0x4d84('0x26')](saveUpdates(_0x4127ac['body'],null))[_0x4d84('0x26')](respondWithResult(_0x58397c,null))['catch'](handleError(_0x58397c,null));};exports[_0x4d84('0x27')]=function(_0x32a679,_0x23ca29){return db['Tag'][_0x4d84('0x55')]({'where':{'id':_0x32a679[_0x4d84('0x4d')]['id']}})['then'](handleEntityNotFound(_0x23ca29,null))[_0x4d84('0x26')](removeEntity(_0x23ca29,null))['catch'](handleError(_0x23ca29,null));};
\ No newline at end of file