Built motion from commit 953226e6.|2.6.32
[motion2.git] / server / api / intFreshdeskConfiguration / intFreshdeskConfiguration.controller.js
index afe3174..99eceb8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9f29=['update','then','destroy','sendStatus','error','stack','name','FreshdeskConfiguration','rawAttributes','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','catch','show','params','options','find','create','body','getFields','findOne','pick','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','Content-Range','save'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0x9f29,0x155));var _0x99f2=function(_0x3019d4,_0x2a8b22){_0x3019d4=_0x3019d4-0x0;var _0x2351af=_0x9f29[_0x3019d4];return _0x2351af;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99f2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x99f2('0x1'));var rp=require(_0x99f2('0x2'));var moment=require(_0x99f2('0x3'));var BPromise=require(_0x99f2('0x4'));var Mustache=require('mustache');var util=require(_0x99f2('0x5'));var path=require(_0x99f2('0x6'));var sox=require(_0x99f2('0x7'));var csv=require(_0x99f2('0x8'));var ejs=require(_0x99f2('0x9'));var fs=require('fs');var fs_extra=require(_0x99f2('0xa'));var _=require(_0x99f2('0xb'));var squel=require(_0x99f2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99f2('0xd'));var toCsv=require(_0x99f2('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x99f2('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x99f2('0xf'));var logger=require(_0x99f2('0x10'))(_0x99f2('0x11'));var utils=require(_0x99f2('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x99f2('0x13'));var db=require(_0x99f2('0x14'))['db'];function respondWithStatusCode(_0x4435f9,_0x3f0444){_0x3f0444=_0x3f0444||0xcc;return function(_0x24f103){if(_0x24f103){return _0x4435f9['sendStatus'](_0x3f0444);}return _0x4435f9[_0x99f2('0x15')](_0x3f0444)[_0x99f2('0x16')]();};}function respondWithResult(_0x3a6d64,_0x4c131a){_0x4c131a=_0x4c131a||0xc8;return function(_0x5be7a2){if(_0x5be7a2){return _0x3a6d64[_0x99f2('0x15')](_0x4c131a)['json'](_0x5be7a2);}};}function respondWithFilteredResult(_0x4ac3a2,_0x474d39){return function(_0x3dfb0b){if(_0x3dfb0b){var _0x1866b3=typeof _0x474d39[_0x99f2('0x17')]===_0x99f2('0x18')&&typeof _0x474d39['limit']===_0x99f2('0x18');var _0x421766=_0x3dfb0b[_0x99f2('0x19')];var _0x1e5ff1=_0x1866b3?0x0:_0x474d39[_0x99f2('0x17')];var _0x347d8d=_0x1866b3?_0x3dfb0b[_0x99f2('0x19')]:_0x474d39[_0x99f2('0x17')]+_0x474d39[_0x99f2('0x1a')];var _0x484f1b;if(_0x347d8d>=_0x421766){_0x347d8d=_0x421766;_0x484f1b=0xc8;}else{_0x484f1b=0xce;}_0x4ac3a2[_0x99f2('0x15')](_0x484f1b);return _0x4ac3a2['set'](_0x99f2('0x1b'),_0x1e5ff1+'-'+_0x347d8d+'/'+_0x421766)['json'](_0x3dfb0b);}return null;};}function patchUpdates(_0x57974f){return function(_0x3af7a3){try{jsonpatch['apply'](_0x3af7a3,_0x57974f,!![]);}catch(_0xd8d553){return BPromise['reject'](_0xd8d553);}return _0x3af7a3[_0x99f2('0x1c')]();};}function saveUpdates(_0x154440,_0x1dd40b){return function(_0x2c957a){if(_0x2c957a){return _0x2c957a[_0x99f2('0x1d')](_0x154440)[_0x99f2('0x1e')](function(_0x4d1635){return _0x4d1635;});}return null;};}function removeEntity(_0x2f56e4,_0x1787d0){return function(_0x4f611a){if(_0x4f611a){return _0x4f611a[_0x99f2('0x1f')]()['then'](function(){_0x2f56e4['status'](0xcc)[_0x99f2('0x16')]();});}};}function handleEntityNotFound(_0x4e1c64,_0x4a2f30){return function(_0x472c21){if(!_0x472c21){_0x4e1c64[_0x99f2('0x20')](0x194);}return _0x472c21;};}function handleError(_0x14802d,_0x227152){_0x227152=_0x227152||0x1f4;return function(_0x1ca39b){logger[_0x99f2('0x21')](_0x1ca39b[_0x99f2('0x22')]);if(_0x1ca39b[_0x99f2('0x23')]){delete _0x1ca39b[_0x99f2('0x23')];}_0x14802d['status'](_0x227152)['send'](_0x1ca39b);};}exports['index']=function(_0x20a3db,_0x1ebaaf){var _0x4e0432={},_0x25702c={},_0x5d79a1={'count':0x0,'rows':[]};var _0x148dcc=_['map'](db[_0x99f2('0x24')][_0x99f2('0x25')],function(_0x490705){return{'name':_0x490705['fieldName'],'type':_0x490705[_0x99f2('0x26')]['key']};});_0x25702c[_0x99f2('0x27')]=_[_0x99f2('0x28')](_0x148dcc,_0x99f2('0x23'));_0x25702c['query']=_[_0x99f2('0x29')](_0x20a3db[_0x99f2('0x2a')]);_0x25702c[_0x99f2('0x2b')]=_[_0x99f2('0x2c')](_0x25702c[_0x99f2('0x27')],_0x25702c[_0x99f2('0x2a')]);_0x4e0432[_0x99f2('0x2d')]=_[_0x99f2('0x2c')](_0x25702c['model'],qs[_0x99f2('0x2e')](_0x20a3db[_0x99f2('0x2a')][_0x99f2('0x2e')]));_0x4e0432[_0x99f2('0x2d')]=_0x4e0432[_0x99f2('0x2d')][_0x99f2('0x2f')]?_0x4e0432[_0x99f2('0x2d')]:_0x25702c[_0x99f2('0x27')];if(!_0x20a3db[_0x99f2('0x2a')][_0x99f2('0x30')](_0x99f2('0x31'))){_0x4e0432[_0x99f2('0x1a')]=qs[_0x99f2('0x1a')](_0x20a3db[_0x99f2('0x2a')]['limit']);_0x4e0432['offset']=qs[_0x99f2('0x17')](_0x20a3db[_0x99f2('0x2a')][_0x99f2('0x17')]);}_0x4e0432[_0x99f2('0x32')]=qs[_0x99f2('0x33')](_0x20a3db[_0x99f2('0x2a')][_0x99f2('0x33')]);_0x4e0432[_0x99f2('0x34')]=qs['filters'](_['pick'](_0x20a3db[_0x99f2('0x2a')],_0x25702c['filters']),_0x148dcc);if(_0x20a3db[_0x99f2('0x2a')][_0x99f2('0x35')]){_0x4e0432[_0x99f2('0x34')]=_[_0x99f2('0x36')](_0x4e0432[_0x99f2('0x34')],{'$or':_[_0x99f2('0x28')](_0x148dcc,function(_0x3a098c){if(_0x3a098c['type']!==_0x99f2('0x37')){var _0x220e9d={};_0x220e9d[_0x3a098c[_0x99f2('0x23')]]={'$like':'%'+_0x20a3db[_0x99f2('0x2a')][_0x99f2('0x35')]+'%'};return _0x220e9d;}})});}_0x4e0432=_['merge']({},_0x4e0432,_0x20a3db['options']);var _0x1ada3b={'where':_0x4e0432['where']};return db[_0x99f2('0x24')][_0x99f2('0x19')](_0x1ada3b)[_0x99f2('0x1e')](function(_0x5d091e){_0x5d79a1[_0x99f2('0x19')]=_0x5d091e;if(_0x20a3db[_0x99f2('0x2a')][_0x99f2('0x38')]){_0x4e0432[_0x99f2('0x39')]=[{'all':!![]}];}return db[_0x99f2('0x24')]['findAll'](_0x4e0432);})['then'](function(_0x31c410){_0x5d79a1['rows']=_0x31c410;return _0x5d79a1;})[_0x99f2('0x1e')](respondWithFilteredResult(_0x1ebaaf,_0x4e0432))[_0x99f2('0x3a')](handleError(_0x1ebaaf,null));};exports[_0x99f2('0x3b')]=function(_0x516192,_0x47535a){var _0x19e4df={'raw':![],'where':{'id':_0x516192[_0x99f2('0x3c')]['id']}},_0x3aba47={};_0x3aba47[_0x99f2('0x27')]=_[_0x99f2('0x29')](db[_0x99f2('0x24')]['rawAttributes']);_0x3aba47[_0x99f2('0x2a')]=_['keys'](_0x516192[_0x99f2('0x2a')]);_0x3aba47[_0x99f2('0x2b')]=_[_0x99f2('0x2c')](_0x3aba47[_0x99f2('0x27')],_0x3aba47[_0x99f2('0x2a')]);_0x19e4df[_0x99f2('0x2d')]=_[_0x99f2('0x2c')](_0x3aba47['model'],qs[_0x99f2('0x2e')](_0x516192[_0x99f2('0x2a')][_0x99f2('0x2e')]));_0x19e4df[_0x99f2('0x2d')]=_0x19e4df[_0x99f2('0x2d')][_0x99f2('0x2f')]?_0x19e4df['attributes']:_0x3aba47[_0x99f2('0x27')];if(_0x516192[_0x99f2('0x2a')]['includeAll']){_0x19e4df['include']=[{'all':!![]}];}_0x19e4df=_[_0x99f2('0x36')]({},_0x19e4df,_0x516192[_0x99f2('0x3d')]);return db[_0x99f2('0x24')][_0x99f2('0x3e')](_0x19e4df)[_0x99f2('0x1e')](handleEntityNotFound(_0x47535a,null))['then'](respondWithResult(_0x47535a,null))[_0x99f2('0x3a')](handleError(_0x47535a,null));};exports[_0x99f2('0x3f')]=function(_0x43f3a1,_0x3e90d3){return db[_0x99f2('0x24')][_0x99f2('0x3f')](_0x43f3a1['body'],{})[_0x99f2('0x1e')](respondWithResult(_0x3e90d3,0xc9))[_0x99f2('0x3a')](handleError(_0x3e90d3,null));};exports[_0x99f2('0x1d')]=function(_0x51b8e0,_0x2fde95){if(_0x51b8e0[_0x99f2('0x40')]['id']){delete _0x51b8e0[_0x99f2('0x40')]['id'];}return db[_0x99f2('0x24')][_0x99f2('0x3e')]({'where':{'id':_0x51b8e0[_0x99f2('0x3c')]['id']}})[_0x99f2('0x1e')](handleEntityNotFound(_0x2fde95,null))[_0x99f2('0x1e')](saveUpdates(_0x51b8e0[_0x99f2('0x40')],null))[_0x99f2('0x1e')](respondWithResult(_0x2fde95,null))[_0x99f2('0x3a')](handleError(_0x2fde95,null));};exports[_0x99f2('0x1f')]=function(_0x2b12e5,_0x108ac3){return db[_0x99f2('0x24')][_0x99f2('0x3e')]({'where':{'id':_0x2b12e5[_0x99f2('0x3c')]['id']}})[_0x99f2('0x1e')](handleEntityNotFound(_0x108ac3,null))['then'](removeEntity(_0x108ac3,null))['catch'](handleError(_0x108ac3,null));};exports[_0x99f2('0x41')]=function(_0x3bdac3,_0x43fd26,_0x32d02e){var _0x7206bf={};var _0x1172fd={};var _0x140c97;var _0x311412;return db[_0x99f2('0x24')][_0x99f2('0x42')]({'where':{'id':_0x3bdac3[_0x99f2('0x3c')]['id']}})[_0x99f2('0x1e')](handleEntityNotFound(_0x43fd26,null))[_0x99f2('0x1e')](function(_0x4df7df){if(_0x4df7df){_0x140c97=_0x4df7df;_0x1172fd[_0x99f2('0x27')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x1172fd[_0x99f2('0x2a')]=_[_0x99f2('0x29')](_0x3bdac3[_0x99f2('0x2a')]);_0x1172fd[_0x99f2('0x2b')]=_[_0x99f2('0x2c')](_0x1172fd[_0x99f2('0x27')],_0x1172fd[_0x99f2('0x2a')]);_0x7206bf[_0x99f2('0x2d')]=_[_0x99f2('0x2c')](_0x1172fd[_0x99f2('0x27')],qs[_0x99f2('0x2e')](_0x3bdac3[_0x99f2('0x2a')][_0x99f2('0x2e')]));_0x7206bf[_0x99f2('0x2d')]=_0x7206bf[_0x99f2('0x2d')]['length']?_0x7206bf[_0x99f2('0x2d')]:_0x1172fd[_0x99f2('0x27')];_0x7206bf['order']=qs[_0x99f2('0x33')](_0x3bdac3['query']['sort']);_0x7206bf[_0x99f2('0x34')]=qs[_0x99f2('0x2b')](_[_0x99f2('0x43')](_0x3bdac3[_0x99f2('0x2a')],_0x1172fd[_0x99f2('0x2b')]));if(_0x3bdac3[_0x99f2('0x2a')][_0x99f2('0x35')]){_0x7206bf['where']=_[_0x99f2('0x36')](_0x7206bf[_0x99f2('0x34')],{'$or':_['map'](_0x7206bf[_0x99f2('0x2d')],function(_0x245c4d){var _0x543112={};_0x543112[_0x245c4d]={'$like':'%'+_0x3bdac3[_0x99f2('0x2a')][_0x99f2('0x35')]+'%'};return _0x543112;})});}_0x7206bf=_[_0x99f2('0x36')]({},_0x7206bf,_0x3bdac3[_0x99f2('0x3d')]);return _0x140c97['getFields'](_0x7206bf);}})[_0x99f2('0x1e')](function(_0x5d3a72){if(_0x5d3a72){_0x311412=_0x5d3a72[_0x99f2('0x2f')];if(!_0x3bdac3[_0x99f2('0x2a')][_0x99f2('0x30')](_0x99f2('0x31'))){_0x7206bf[_0x99f2('0x1a')]=qs[_0x99f2('0x1a')](_0x3bdac3[_0x99f2('0x2a')][_0x99f2('0x1a')]);_0x7206bf['offset']=qs[_0x99f2('0x17')](_0x3bdac3['query'][_0x99f2('0x17')]);}return _0x140c97['getFields'](_0x7206bf);}})[_0x99f2('0x1e')](function(_0x27adc8){if(_0x27adc8){return _0x27adc8?{'count':_0x311412,'rows':_0x27adc8}:null;}})[_0x99f2('0x1e')](respondWithResult(_0x43fd26,null))[_0x99f2('0x3a')](handleError(_0x43fd26,null));};exports[_0x99f2('0x44')]=function(_0x72e7a8,_0x169303,_0x7568d4){var _0xe58073={};var _0x373c35={};var _0x58c1f2;var _0x594b69;return db[_0x99f2('0x24')][_0x99f2('0x42')]({'where':{'id':_0x72e7a8[_0x99f2('0x3c')]['id']}})['then'](handleEntityNotFound(_0x169303,null))[_0x99f2('0x1e')](function(_0x97974f){if(_0x97974f){_0x58c1f2=_0x97974f;_0x373c35[_0x99f2('0x27')]=_['keys'](db[_0x99f2('0x45')][_0x99f2('0x25')]);_0x373c35[_0x99f2('0x2a')]=_[_0x99f2('0x29')](_0x72e7a8[_0x99f2('0x2a')]);_0x373c35[_0x99f2('0x2b')]=_[_0x99f2('0x2c')](_0x373c35['model'],_0x373c35[_0x99f2('0x2a')]);_0xe58073[_0x99f2('0x2d')]=_[_0x99f2('0x2c')](_0x373c35[_0x99f2('0x27')],qs[_0x99f2('0x2e')](_0x72e7a8['query'][_0x99f2('0x2e')]));_0xe58073[_0x99f2('0x2d')]=_0xe58073[_0x99f2('0x2d')]['length']?_0xe58073[_0x99f2('0x2d')]:_0x373c35[_0x99f2('0x27')];_0xe58073['order']=qs[_0x99f2('0x33')](_0x72e7a8[_0x99f2('0x2a')][_0x99f2('0x33')]);_0xe58073[_0x99f2('0x34')]=qs[_0x99f2('0x2b')](_['pick'](_0x72e7a8[_0x99f2('0x2a')],_0x373c35[_0x99f2('0x2b')]));if(_0x72e7a8[_0x99f2('0x2a')][_0x99f2('0x35')]){_0xe58073[_0x99f2('0x34')]=_[_0x99f2('0x36')](_0xe58073['where'],{'$or':_[_0x99f2('0x28')](_0xe58073['attributes'],function(_0x36dd39){var _0x3ac6f7={};_0x3ac6f7[_0x36dd39]={'$like':'%'+_0x72e7a8[_0x99f2('0x2a')][_0x99f2('0x35')]+'%'};return _0x3ac6f7;})});}_0xe58073=_[_0x99f2('0x36')]({},_0xe58073,_0x72e7a8[_0x99f2('0x3d')]);return _0x58c1f2[_0x99f2('0x44')](_0xe58073);}})[_0x99f2('0x1e')](function(_0x534e98){if(_0x534e98){_0x594b69=_0x534e98[_0x99f2('0x2f')];if(!_0x72e7a8['query'][_0x99f2('0x30')](_0x99f2('0x31'))){_0xe58073['limit']=qs[_0x99f2('0x1a')](_0x72e7a8[_0x99f2('0x2a')]['limit']);_0xe58073[_0x99f2('0x17')]=qs[_0x99f2('0x17')](_0x72e7a8['query'][_0x99f2('0x17')]);}return _0x58c1f2[_0x99f2('0x44')](_0xe58073);}})[_0x99f2('0x1e')](function(_0xfc6272){if(_0xfc6272){return _0xfc6272?{'count':_0x594b69,'rows':_0xfc6272}:null;}})[_0x99f2('0x1e')](respondWithResult(_0x169303,null))[_0x99f2('0x3a')](handleError(_0x169303,null));};exports[_0x99f2('0x46')]=function(_0x226f0d,_0x18e21c,_0x5ec981){var _0x567787={};var _0x1cbc05={};var _0x39d872;var _0x280195;return db[_0x99f2('0x24')]['findOne']({'where':{'id':_0x226f0d[_0x99f2('0x3c')]['id']}})['then'](handleEntityNotFound(_0x18e21c,null))[_0x99f2('0x1e')](function(_0x3d5816){if(_0x3d5816){_0x39d872=_0x3d5816;_0x1cbc05[_0x99f2('0x27')]=_[_0x99f2('0x29')](db[_0x99f2('0x45')][_0x99f2('0x25')]);_0x1cbc05[_0x99f2('0x2a')]=_[_0x99f2('0x29')](_0x226f0d[_0x99f2('0x2a')]);_0x1cbc05['filters']=_[_0x99f2('0x2c')](_0x1cbc05['model'],_0x1cbc05['query']);_0x567787['attributes']=_[_0x99f2('0x2c')](_0x1cbc05[_0x99f2('0x27')],qs['fields'](_0x226f0d[_0x99f2('0x2a')][_0x99f2('0x2e')]));_0x567787[_0x99f2('0x2d')]=_0x567787['attributes']['length']?_0x567787['attributes']:_0x1cbc05[_0x99f2('0x27')];_0x567787['order']=qs[_0x99f2('0x33')](_0x226f0d[_0x99f2('0x2a')][_0x99f2('0x33')]);_0x567787[_0x99f2('0x34')]=qs[_0x99f2('0x2b')](_['pick'](_0x226f0d[_0x99f2('0x2a')],_0x1cbc05[_0x99f2('0x2b')]));if(_0x226f0d['query'][_0x99f2('0x35')]){_0x567787['where']=_['merge'](_0x567787[_0x99f2('0x34')],{'$or':_[_0x99f2('0x28')](_0x567787[_0x99f2('0x2d')],function(_0x195656){var _0x3dca6f={};_0x3dca6f[_0x195656]={'$like':'%'+_0x226f0d[_0x99f2('0x2a')]['filter']+'%'};return _0x3dca6f;})});}_0x567787=_[_0x99f2('0x36')]({},_0x567787,_0x226f0d['options']);return _0x39d872['getDescriptions'](_0x567787);}})[_0x99f2('0x1e')](function(_0x1b9fdc){if(_0x1b9fdc){_0x280195=_0x1b9fdc[_0x99f2('0x2f')];if(!_0x226f0d[_0x99f2('0x2a')]['hasOwnProperty'](_0x99f2('0x31'))){_0x567787['limit']=qs[_0x99f2('0x1a')](_0x226f0d[_0x99f2('0x2a')][_0x99f2('0x1a')]);_0x567787[_0x99f2('0x17')]=qs[_0x99f2('0x17')](_0x226f0d['query']['offset']);}return _0x39d872[_0x99f2('0x46')](_0x567787);}})['then'](function(_0x502e4c){if(_0x502e4c){return _0x502e4c?{'count':_0x280195,'rows':_0x502e4c}:null;}})[_0x99f2('0x1e')](respondWithResult(_0x18e21c,null))[_0x99f2('0x3a')](handleError(_0x18e21c,null));};exports[_0x99f2('0x47')]=function(_0x2e4782,_0x1e1893,_0x1c311f){var _0x389d2d={};var _0x47a268={};var _0x30d4b8;var _0x5f3426;return db['FreshdeskConfiguration'][_0x99f2('0x42')]({'where':{'id':_0x2e4782[_0x99f2('0x3c')]['id']}})[_0x99f2('0x1e')](handleEntityNotFound(_0x1e1893,null))[_0x99f2('0x1e')](function(_0x1417f1){if(_0x1417f1){_0x30d4b8=_0x1417f1;_0x47a268[_0x99f2('0x27')]=_[_0x99f2('0x29')](db[_0x99f2('0x48')][_0x99f2('0x25')]);_0x47a268[_0x99f2('0x2a')]=_[_0x99f2('0x29')](_0x2e4782[_0x99f2('0x2a')]);_0x47a268[_0x99f2('0x2b')]=_[_0x99f2('0x2c')](_0x47a268[_0x99f2('0x27')],_0x47a268['query']);_0x389d2d[_0x99f2('0x2d')]=_['intersection'](_0x47a268[_0x99f2('0x27')],qs[_0x99f2('0x2e')](_0x2e4782[_0x99f2('0x2a')]['fields']));_0x389d2d['attributes']=_0x389d2d[_0x99f2('0x2d')][_0x99f2('0x2f')]?_0x389d2d[_0x99f2('0x2d')]:_0x47a268[_0x99f2('0x27')];_0x389d2d[_0x99f2('0x32')]=qs[_0x99f2('0x33')](_0x2e4782[_0x99f2('0x2a')][_0x99f2('0x33')]);_0x389d2d[_0x99f2('0x34')]=qs[_0x99f2('0x2b')](_['pick'](_0x2e4782[_0x99f2('0x2a')],_0x47a268[_0x99f2('0x2b')]));if(_0x2e4782[_0x99f2('0x2a')][_0x99f2('0x35')]){_0x389d2d[_0x99f2('0x34')]=_[_0x99f2('0x36')](_0x389d2d[_0x99f2('0x34')],{'$or':_[_0x99f2('0x28')](_0x389d2d[_0x99f2('0x2d')],function(_0x152f81){var _0x5060e7={};_0x5060e7[_0x152f81]={'$like':'%'+_0x2e4782[_0x99f2('0x2a')][_0x99f2('0x35')]+'%'};return _0x5060e7;})});}_0x389d2d=_[_0x99f2('0x36')]({},_0x389d2d,_0x2e4782['options']);return _0x30d4b8[_0x99f2('0x47')](_0x389d2d);}})[_0x99f2('0x1e')](function(_0x2abd81){if(_0x2abd81){_0x5f3426=_0x2abd81[_0x99f2('0x2f')];if(!_0x2e4782[_0x99f2('0x2a')][_0x99f2('0x30')](_0x99f2('0x31'))){_0x389d2d[_0x99f2('0x1a')]=qs[_0x99f2('0x1a')](_0x2e4782['query']['limit']);_0x389d2d[_0x99f2('0x17')]=qs['offset'](_0x2e4782[_0x99f2('0x2a')][_0x99f2('0x17')]);}return _0x30d4b8[_0x99f2('0x47')](_0x389d2d);}})[_0x99f2('0x1e')](function(_0x7326fc){if(_0x7326fc){return _0x7326fc?{'count':_0x5f3426,'rows':_0x7326fc}:null;}})[_0x99f2('0x1e')](respondWithResult(_0x1e1893,null))[_0x99f2('0x3a')](handleError(_0x1e1893,null));};exports['setTags']=function(_0x4bfb90,_0x158918,_0xbfb6b4){if(_0x4bfb90[_0x99f2('0x40')]['id']){delete _0x4bfb90[_0x99f2('0x40')]['id'];}return db['FreshdeskConfiguration'][_0x99f2('0x42')]({'where':{'id':_0x4bfb90['params']['id']}})[_0x99f2('0x1e')](handleEntityNotFound(_0x158918,null))[_0x99f2('0x1e')](function(_0x4aefca){if(_0x4aefca){return _0x4aefca[_0x99f2('0x49')](_0x4bfb90[_0x99f2('0x40')]['ids']||[]);}return null;})[_0x99f2('0x1e')](respondWithResult(_0x158918,null))[_0x99f2('0x3a')](handleError(_0x158918,null));};
\ No newline at end of file
+var _0x5a64=['Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','getFields','findOne','FreshdeskField','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','count','set'];(function(_0xdd79be,_0x3bd452){var _0x24a6a5=function(_0x423f5c){while(--_0x423f5c){_0xdd79be['push'](_0xdd79be['shift']());}};_0x24a6a5(++_0x3bd452);}(_0x5a64,0x8a));var _0x45a6=function(_0x575410,_0x316dc8){_0x575410=_0x575410-0x0;var _0x1aa3ae=_0x5a64[_0x575410];return _0x1aa3ae;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x45a6('0x0'));var jsonpatch=require(_0x45a6('0x1'));var rp=require(_0x45a6('0x2'));var moment=require('moment');var BPromise=require(_0x45a6('0x3'));var Mustache=require(_0x45a6('0x4'));var util=require(_0x45a6('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x45a6('0x6'));var ejs=require(_0x45a6('0x7'));var fs=require('fs');var fs_extra=require(_0x45a6('0x8'));var _=require(_0x45a6('0x9'));var squel=require(_0x45a6('0xa'));var crypto=require('crypto');var jsforce=require(_0x45a6('0xb'));var deskjs=require(_0x45a6('0xc'));var toCsv=require(_0x45a6('0x6'));var querystring=require(_0x45a6('0xd'));var Papa=require(_0x45a6('0xe'));var Redis=require(_0x45a6('0xf'));var authService=require(_0x45a6('0x10'));var qs=require(_0x45a6('0x11'));var as=require(_0x45a6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45a6('0x13'))(_0x45a6('0x14'));var utils=require(_0x45a6('0x15'));var config=require(_0x45a6('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2173d3,_0xbf5a36){_0xbf5a36=_0xbf5a36||0xcc;return function(_0x1ea2b3){if(_0x1ea2b3){return _0x2173d3[_0x45a6('0x17')](_0xbf5a36);}return _0x2173d3[_0x45a6('0x18')](_0xbf5a36)[_0x45a6('0x19')]();};}function respondWithResult(_0xd9700e,_0x283ef2){_0x283ef2=_0x283ef2||0xc8;return function(_0x40149f){if(_0x40149f){return _0xd9700e[_0x45a6('0x18')](_0x283ef2)[_0x45a6('0x1a')](_0x40149f);}};}function respondWithFilteredResult(_0x19c992,_0x53821b){return function(_0x3e70c4){if(_0x3e70c4){var _0x458eb1=typeof _0x53821b['offset']===_0x45a6('0x1b')&&typeof _0x53821b[_0x45a6('0x1c')]===_0x45a6('0x1b');var _0x51a04c=_0x3e70c4['count'];var _0x4b6eab=_0x458eb1?0x0:_0x53821b[_0x45a6('0x1d')];var _0x15c69d=_0x458eb1?_0x3e70c4[_0x45a6('0x1e')]:_0x53821b[_0x45a6('0x1d')]+_0x53821b[_0x45a6('0x1c')];var _0x321f94;if(_0x15c69d>=_0x51a04c){_0x15c69d=_0x51a04c;_0x321f94=0xc8;}else{_0x321f94=0xce;}_0x19c992['status'](_0x321f94);return _0x19c992[_0x45a6('0x1f')](_0x45a6('0x20'),_0x4b6eab+'-'+_0x15c69d+'/'+_0x51a04c)[_0x45a6('0x1a')](_0x3e70c4);}return null;};}function patchUpdates(_0x2888dd){return function(_0x137cf4){try{jsonpatch[_0x45a6('0x21')](_0x137cf4,_0x2888dd,!![]);}catch(_0x36a5c4){return BPromise['reject'](_0x36a5c4);}return _0x137cf4[_0x45a6('0x22')]();};}function saveUpdates(_0xe9ffc3,_0x171c3a){return function(_0xe05b13){if(_0xe05b13){return _0xe05b13[_0x45a6('0x23')](_0xe9ffc3)['then'](function(_0x4bf4b1){return _0x4bf4b1;});}return null;};}function removeEntity(_0x8f5ac4,_0x27a360){return function(_0x7283b0){if(_0x7283b0){return _0x7283b0[_0x45a6('0x24')]()[_0x45a6('0x25')](function(){_0x8f5ac4[_0x45a6('0x18')](0xcc)[_0x45a6('0x19')]();});}};}function handleEntityNotFound(_0x44ead2,_0x5d1107){return function(_0x4c33ca){if(!_0x4c33ca){_0x44ead2[_0x45a6('0x17')](0x194);}return _0x4c33ca;};}function handleError(_0x22b15f,_0x3430b4){_0x3430b4=_0x3430b4||0x1f4;return function(_0x260a03){logger[_0x45a6('0x26')](_0x260a03[_0x45a6('0x27')]);if(_0x260a03[_0x45a6('0x28')]){delete _0x260a03[_0x45a6('0x28')];}_0x22b15f[_0x45a6('0x18')](_0x3430b4)[_0x45a6('0x29')](_0x260a03);};}exports[_0x45a6('0x2a')]=function(_0x5c3f6e,_0xcd6524){var _0xe66b5e={},_0xd88283={},_0x12cd4e={'count':0x0,'rows':[]};var _0x38730e=_[_0x45a6('0x2b')](db[_0x45a6('0x2c')][_0x45a6('0x2d')],function(_0x166e4a){return{'name':_0x166e4a[_0x45a6('0x2e')],'type':_0x166e4a[_0x45a6('0x2f')][_0x45a6('0x30')]};});_0xd88283[_0x45a6('0x31')]=_[_0x45a6('0x2b')](_0x38730e,_0x45a6('0x28'));_0xd88283[_0x45a6('0x32')]=_[_0x45a6('0x33')](_0x5c3f6e[_0x45a6('0x32')]);_0xd88283['filters']=_['intersection'](_0xd88283['model'],_0xd88283[_0x45a6('0x32')]);_0xe66b5e[_0x45a6('0x34')]=_[_0x45a6('0x35')](_0xd88283[_0x45a6('0x31')],qs[_0x45a6('0x36')](_0x5c3f6e[_0x45a6('0x32')][_0x45a6('0x36')]));_0xe66b5e['attributes']=_0xe66b5e[_0x45a6('0x34')]['length']?_0xe66b5e[_0x45a6('0x34')]:_0xd88283['model'];if(!_0x5c3f6e['query']['hasOwnProperty'](_0x45a6('0x37'))){_0xe66b5e[_0x45a6('0x1c')]=qs[_0x45a6('0x1c')](_0x5c3f6e[_0x45a6('0x32')][_0x45a6('0x1c')]);_0xe66b5e[_0x45a6('0x1d')]=qs['offset'](_0x5c3f6e['query'][_0x45a6('0x1d')]);}_0xe66b5e[_0x45a6('0x38')]=qs['sort'](_0x5c3f6e['query'][_0x45a6('0x39')]);_0xe66b5e['where']=qs[_0x45a6('0x3a')](_[_0x45a6('0x3b')](_0x5c3f6e[_0x45a6('0x32')],_0xd88283['filters']),_0x38730e);if(_0x5c3f6e[_0x45a6('0x32')][_0x45a6('0x3c')]){_0xe66b5e[_0x45a6('0x3d')]=_['merge'](_0xe66b5e['where'],{'$or':_[_0x45a6('0x2b')](_0x38730e,function(_0xb4dcf0){if(_0xb4dcf0[_0x45a6('0x2f')]!==_0x45a6('0x3e')){var _0x3f2a85={};_0x3f2a85[_0xb4dcf0[_0x45a6('0x28')]]={'$like':'%'+_0x5c3f6e['query'][_0x45a6('0x3c')]+'%'};return _0x3f2a85;}})});}_0xe66b5e=_[_0x45a6('0x3f')]({},_0xe66b5e,_0x5c3f6e[_0x45a6('0x40')]);var _0x57a29f={'where':_0xe66b5e['where']};return db[_0x45a6('0x2c')][_0x45a6('0x1e')](_0x57a29f)[_0x45a6('0x25')](function(_0x1798e1){_0x12cd4e[_0x45a6('0x1e')]=_0x1798e1;if(_0x5c3f6e[_0x45a6('0x32')][_0x45a6('0x41')]){_0xe66b5e[_0x45a6('0x42')]=[{'all':!![]}];}return db[_0x45a6('0x2c')][_0x45a6('0x43')](_0xe66b5e);})[_0x45a6('0x25')](function(_0x111de5){_0x12cd4e[_0x45a6('0x44')]=_0x111de5;return _0x12cd4e;})[_0x45a6('0x25')](respondWithFilteredResult(_0xcd6524,_0xe66b5e))['catch'](handleError(_0xcd6524,null));};exports[_0x45a6('0x45')]=function(_0x5794e3,_0x3612a3){var _0x45f7f1={'raw':![],'where':{'id':_0x5794e3[_0x45a6('0x46')]['id']}},_0x442615={};_0x442615[_0x45a6('0x31')]=_[_0x45a6('0x33')](db[_0x45a6('0x2c')][_0x45a6('0x2d')]);_0x442615['query']=_[_0x45a6('0x33')](_0x5794e3['query']);_0x442615[_0x45a6('0x3a')]=_[_0x45a6('0x35')](_0x442615[_0x45a6('0x31')],_0x442615[_0x45a6('0x32')]);_0x45f7f1[_0x45a6('0x34')]=_[_0x45a6('0x35')](_0x442615[_0x45a6('0x31')],qs['fields'](_0x5794e3['query'][_0x45a6('0x36')]));_0x45f7f1[_0x45a6('0x34')]=_0x45f7f1[_0x45a6('0x34')][_0x45a6('0x47')]?_0x45f7f1['attributes']:_0x442615['model'];if(_0x5794e3[_0x45a6('0x32')][_0x45a6('0x41')]){_0x45f7f1['include']=[{'all':!![]}];}_0x45f7f1=_[_0x45a6('0x3f')]({},_0x45f7f1,_0x5794e3['options']);return db[_0x45a6('0x2c')][_0x45a6('0x48')](_0x45f7f1)[_0x45a6('0x25')](handleEntityNotFound(_0x3612a3,null))[_0x45a6('0x25')](respondWithResult(_0x3612a3,null))[_0x45a6('0x49')](handleError(_0x3612a3,null));};exports[_0x45a6('0x4a')]=function(_0x4760b6,_0x1b3de0){return db[_0x45a6('0x2c')][_0x45a6('0x4a')](_0x4760b6[_0x45a6('0x4b')],{})['then'](respondWithResult(_0x1b3de0,0xc9))[_0x45a6('0x49')](handleError(_0x1b3de0,null));};exports[_0x45a6('0x23')]=function(_0x4fac9c,_0xf54ddd){if(_0x4fac9c[_0x45a6('0x4b')]['id']){delete _0x4fac9c[_0x45a6('0x4b')]['id'];}return db['FreshdeskConfiguration'][_0x45a6('0x48')]({'where':{'id':_0x4fac9c[_0x45a6('0x46')]['id']}})['then'](handleEntityNotFound(_0xf54ddd,null))['then'](saveUpdates(_0x4fac9c[_0x45a6('0x4b')],null))[_0x45a6('0x25')](respondWithResult(_0xf54ddd,null))[_0x45a6('0x49')](handleError(_0xf54ddd,null));};exports['destroy']=function(_0x568ca6,_0x328e42){return db['FreshdeskConfiguration'][_0x45a6('0x48')]({'where':{'id':_0x568ca6[_0x45a6('0x46')]['id']}})['then'](handleEntityNotFound(_0x328e42,null))['then'](removeEntity(_0x328e42,null))[_0x45a6('0x49')](handleError(_0x328e42,null));};exports[_0x45a6('0x4c')]=function(_0x119241,_0x52488b,_0x2b08a6){var _0x43c02a={};var _0x47c0f4={};var _0x47408a;var _0x5b5528;return db[_0x45a6('0x2c')][_0x45a6('0x4d')]({'where':{'id':_0x119241[_0x45a6('0x46')]['id']}})[_0x45a6('0x25')](handleEntityNotFound(_0x52488b,null))[_0x45a6('0x25')](function(_0x268345){if(_0x268345){_0x47408a=_0x268345;_0x47c0f4['model']=_[_0x45a6('0x33')](db[_0x45a6('0x4e')][_0x45a6('0x2d')]);_0x47c0f4[_0x45a6('0x32')]=_[_0x45a6('0x33')](_0x119241[_0x45a6('0x32')]);_0x47c0f4['filters']=_['intersection'](_0x47c0f4[_0x45a6('0x31')],_0x47c0f4[_0x45a6('0x32')]);_0x43c02a[_0x45a6('0x34')]=_[_0x45a6('0x35')](_0x47c0f4['model'],qs[_0x45a6('0x36')](_0x119241[_0x45a6('0x32')][_0x45a6('0x36')]));_0x43c02a[_0x45a6('0x34')]=_0x43c02a[_0x45a6('0x34')][_0x45a6('0x47')]?_0x43c02a[_0x45a6('0x34')]:_0x47c0f4[_0x45a6('0x31')];_0x43c02a[_0x45a6('0x38')]=qs[_0x45a6('0x39')](_0x119241[_0x45a6('0x32')][_0x45a6('0x39')]);_0x43c02a['where']=qs['filters'](_[_0x45a6('0x3b')](_0x119241[_0x45a6('0x32')],_0x47c0f4[_0x45a6('0x3a')]));if(_0x119241[_0x45a6('0x32')][_0x45a6('0x3c')]){_0x43c02a[_0x45a6('0x3d')]=_[_0x45a6('0x3f')](_0x43c02a[_0x45a6('0x3d')],{'$or':_[_0x45a6('0x2b')](_0x43c02a[_0x45a6('0x34')],function(_0x218465){var _0x35cb91={};_0x35cb91[_0x218465]={'$like':'%'+_0x119241[_0x45a6('0x32')][_0x45a6('0x3c')]+'%'};return _0x35cb91;})});}_0x43c02a=_['merge']({},_0x43c02a,_0x119241[_0x45a6('0x40')]);return _0x47408a[_0x45a6('0x4c')](_0x43c02a);}})[_0x45a6('0x25')](function(_0x5ddb58){if(_0x5ddb58){_0x5b5528=_0x5ddb58[_0x45a6('0x47')];if(!_0x119241[_0x45a6('0x32')]['hasOwnProperty'](_0x45a6('0x37'))){_0x43c02a['limit']=qs[_0x45a6('0x1c')](_0x119241[_0x45a6('0x32')][_0x45a6('0x1c')]);_0x43c02a[_0x45a6('0x1d')]=qs[_0x45a6('0x1d')](_0x119241[_0x45a6('0x32')][_0x45a6('0x1d')]);}return _0x47408a[_0x45a6('0x4c')](_0x43c02a);}})[_0x45a6('0x25')](function(_0x4707d2){if(_0x4707d2){return _0x4707d2?{'count':_0x5b5528,'rows':_0x4707d2}:null;}})[_0x45a6('0x25')](respondWithResult(_0x52488b,null))[_0x45a6('0x49')](handleError(_0x52488b,null));};exports[_0x45a6('0x4f')]=function(_0x316abe,_0x41f93d,_0x950c35){var _0x58ee73={};var _0x28543b={};var _0x463e36;var _0x3ba1db;return db['FreshdeskConfiguration'][_0x45a6('0x4d')]({'where':{'id':_0x316abe['params']['id']}})[_0x45a6('0x25')](handleEntityNotFound(_0x41f93d,null))[_0x45a6('0x25')](function(_0x851e7a){if(_0x851e7a){_0x463e36=_0x851e7a;_0x28543b[_0x45a6('0x31')]=_[_0x45a6('0x33')](db[_0x45a6('0x4e')][_0x45a6('0x2d')]);_0x28543b['query']=_['keys'](_0x316abe[_0x45a6('0x32')]);_0x28543b['filters']=_[_0x45a6('0x35')](_0x28543b[_0x45a6('0x31')],_0x28543b[_0x45a6('0x32')]);_0x58ee73[_0x45a6('0x34')]=_['intersection'](_0x28543b[_0x45a6('0x31')],qs[_0x45a6('0x36')](_0x316abe[_0x45a6('0x32')][_0x45a6('0x36')]));_0x58ee73['attributes']=_0x58ee73[_0x45a6('0x34')][_0x45a6('0x47')]?_0x58ee73[_0x45a6('0x34')]:_0x28543b[_0x45a6('0x31')];_0x58ee73[_0x45a6('0x38')]=qs[_0x45a6('0x39')](_0x316abe[_0x45a6('0x32')][_0x45a6('0x39')]);_0x58ee73[_0x45a6('0x3d')]=qs[_0x45a6('0x3a')](_[_0x45a6('0x3b')](_0x316abe['query'],_0x28543b[_0x45a6('0x3a')]));if(_0x316abe[_0x45a6('0x32')][_0x45a6('0x3c')]){_0x58ee73[_0x45a6('0x3d')]=_['merge'](_0x58ee73['where'],{'$or':_[_0x45a6('0x2b')](_0x58ee73[_0x45a6('0x34')],function(_0x496645){var _0x331ef8={};_0x331ef8[_0x496645]={'$like':'%'+_0x316abe['query'][_0x45a6('0x3c')]+'%'};return _0x331ef8;})});}_0x58ee73=_['merge']({},_0x58ee73,_0x316abe[_0x45a6('0x40')]);return _0x463e36['getSubjects'](_0x58ee73);}})[_0x45a6('0x25')](function(_0x1da1ed){if(_0x1da1ed){_0x3ba1db=_0x1da1ed[_0x45a6('0x47')];if(!_0x316abe['query'][_0x45a6('0x50')](_0x45a6('0x37'))){_0x58ee73[_0x45a6('0x1c')]=qs['limit'](_0x316abe[_0x45a6('0x32')][_0x45a6('0x1c')]);_0x58ee73[_0x45a6('0x1d')]=qs[_0x45a6('0x1d')](_0x316abe[_0x45a6('0x32')][_0x45a6('0x1d')]);}return _0x463e36[_0x45a6('0x4f')](_0x58ee73);}})[_0x45a6('0x25')](function(_0x3850ea){if(_0x3850ea){return _0x3850ea?{'count':_0x3ba1db,'rows':_0x3850ea}:null;}})[_0x45a6('0x25')](respondWithResult(_0x41f93d,null))[_0x45a6('0x49')](handleError(_0x41f93d,null));};exports[_0x45a6('0x51')]=function(_0x46e20c,_0x27a334,_0x43b4fa){var _0x19854a={};var _0x4f925d={};var _0x1ca689;var _0x54b736;return db[_0x45a6('0x2c')][_0x45a6('0x4d')]({'where':{'id':_0x46e20c[_0x45a6('0x46')]['id']}})['then'](handleEntityNotFound(_0x27a334,null))[_0x45a6('0x25')](function(_0x149b71){if(_0x149b71){_0x1ca689=_0x149b71;_0x4f925d[_0x45a6('0x31')]=_[_0x45a6('0x33')](db[_0x45a6('0x4e')][_0x45a6('0x2d')]);_0x4f925d[_0x45a6('0x32')]=_[_0x45a6('0x33')](_0x46e20c['query']);_0x4f925d['filters']=_['intersection'](_0x4f925d[_0x45a6('0x31')],_0x4f925d[_0x45a6('0x32')]);_0x19854a[_0x45a6('0x34')]=_[_0x45a6('0x35')](_0x4f925d[_0x45a6('0x31')],qs[_0x45a6('0x36')](_0x46e20c['query']['fields']));_0x19854a[_0x45a6('0x34')]=_0x19854a[_0x45a6('0x34')][_0x45a6('0x47')]?_0x19854a['attributes']:_0x4f925d[_0x45a6('0x31')];_0x19854a[_0x45a6('0x38')]=qs['sort'](_0x46e20c['query'][_0x45a6('0x39')]);_0x19854a['where']=qs[_0x45a6('0x3a')](_[_0x45a6('0x3b')](_0x46e20c[_0x45a6('0x32')],_0x4f925d['filters']));if(_0x46e20c[_0x45a6('0x32')][_0x45a6('0x3c')]){_0x19854a[_0x45a6('0x3d')]=_[_0x45a6('0x3f')](_0x19854a[_0x45a6('0x3d')],{'$or':_['map'](_0x19854a['attributes'],function(_0x88eebc){var _0xc45062={};_0xc45062[_0x88eebc]={'$like':'%'+_0x46e20c[_0x45a6('0x32')][_0x45a6('0x3c')]+'%'};return _0xc45062;})});}_0x19854a=_[_0x45a6('0x3f')]({},_0x19854a,_0x46e20c[_0x45a6('0x40')]);return _0x1ca689[_0x45a6('0x51')](_0x19854a);}})[_0x45a6('0x25')](function(_0x4c3c3e){if(_0x4c3c3e){_0x54b736=_0x4c3c3e[_0x45a6('0x47')];if(!_0x46e20c[_0x45a6('0x32')]['hasOwnProperty'](_0x45a6('0x37'))){_0x19854a[_0x45a6('0x1c')]=qs[_0x45a6('0x1c')](_0x46e20c[_0x45a6('0x32')]['limit']);_0x19854a[_0x45a6('0x1d')]=qs['offset'](_0x46e20c[_0x45a6('0x32')][_0x45a6('0x1d')]);}return _0x1ca689[_0x45a6('0x51')](_0x19854a);}})[_0x45a6('0x25')](function(_0x4efe86){if(_0x4efe86){return _0x4efe86?{'count':_0x54b736,'rows':_0x4efe86}:null;}})['then'](respondWithResult(_0x27a334,null))[_0x45a6('0x49')](handleError(_0x27a334,null));};exports[_0x45a6('0x52')]=function(_0x44a3e8,_0x249d4c,_0x2f9245){var _0x4eaa92={};var _0x5da9a0={};var _0xdbbd3f;var _0x1f13b8;return db[_0x45a6('0x2c')][_0x45a6('0x4d')]({'where':{'id':_0x44a3e8[_0x45a6('0x46')]['id']}})[_0x45a6('0x25')](handleEntityNotFound(_0x249d4c,null))['then'](function(_0x123c63){if(_0x123c63){_0xdbbd3f=_0x123c63;_0x5da9a0[_0x45a6('0x31')]=_[_0x45a6('0x33')](db[_0x45a6('0x53')][_0x45a6('0x2d')]);_0x5da9a0[_0x45a6('0x32')]=_[_0x45a6('0x33')](_0x44a3e8[_0x45a6('0x32')]);_0x5da9a0[_0x45a6('0x3a')]=_[_0x45a6('0x35')](_0x5da9a0[_0x45a6('0x31')],_0x5da9a0[_0x45a6('0x32')]);_0x4eaa92[_0x45a6('0x34')]=_['intersection'](_0x5da9a0[_0x45a6('0x31')],qs['fields'](_0x44a3e8[_0x45a6('0x32')][_0x45a6('0x36')]));_0x4eaa92[_0x45a6('0x34')]=_0x4eaa92['attributes'][_0x45a6('0x47')]?_0x4eaa92[_0x45a6('0x34')]:_0x5da9a0[_0x45a6('0x31')];_0x4eaa92[_0x45a6('0x38')]=qs[_0x45a6('0x39')](_0x44a3e8[_0x45a6('0x32')][_0x45a6('0x39')]);_0x4eaa92[_0x45a6('0x3d')]=qs[_0x45a6('0x3a')](_['pick'](_0x44a3e8[_0x45a6('0x32')],_0x5da9a0['filters']));if(_0x44a3e8[_0x45a6('0x32')][_0x45a6('0x3c')]){_0x4eaa92[_0x45a6('0x3d')]=_[_0x45a6('0x3f')](_0x4eaa92[_0x45a6('0x3d')],{'$or':_[_0x45a6('0x2b')](_0x4eaa92['attributes'],function(_0x690813){var _0x243548={};_0x243548[_0x690813]={'$like':'%'+_0x44a3e8['query'][_0x45a6('0x3c')]+'%'};return _0x243548;})});}_0x4eaa92=_[_0x45a6('0x3f')]({},_0x4eaa92,_0x44a3e8['options']);return _0xdbbd3f[_0x45a6('0x52')](_0x4eaa92);}})[_0x45a6('0x25')](function(_0x1c66f2){if(_0x1c66f2){_0x1f13b8=_0x1c66f2[_0x45a6('0x47')];if(!_0x44a3e8[_0x45a6('0x32')]['hasOwnProperty']('nolimit')){_0x4eaa92[_0x45a6('0x1c')]=qs[_0x45a6('0x1c')](_0x44a3e8['query']['limit']);_0x4eaa92[_0x45a6('0x1d')]=qs[_0x45a6('0x1d')](_0x44a3e8['query'][_0x45a6('0x1d')]);}return _0xdbbd3f['getTags'](_0x4eaa92);}})[_0x45a6('0x25')](function(_0x26642b){if(_0x26642b){return _0x26642b?{'count':_0x1f13b8,'rows':_0x26642b}:null;}})[_0x45a6('0x25')](respondWithResult(_0x249d4c,null))[_0x45a6('0x49')](handleError(_0x249d4c,null));};exports[_0x45a6('0x54')]=function(_0x1e4028,_0x22a1dc,_0x37649e){if(_0x1e4028[_0x45a6('0x4b')]['id']){delete _0x1e4028[_0x45a6('0x4b')]['id'];}return db[_0x45a6('0x2c')][_0x45a6('0x4d')]({'where':{'id':_0x1e4028[_0x45a6('0x46')]['id']}})['then'](handleEntityNotFound(_0x22a1dc,null))[_0x45a6('0x25')](function(_0x1f70ca){if(_0x1f70ca){return _0x1f70ca[_0x45a6('0x54')](_0x1e4028['body']['ids']||[]);}return null;})[_0x45a6('0x25')](respondWithResult(_0x22a1dc,null))[_0x45a6('0x49')](handleError(_0x22a1dc,null));};
\ No newline at end of file