Built motion from commit b5413ace.|2.6.9
[motion2.git] / server / api / intFreshdeskConfiguration / intFreshdeskConfiguration.controller.js
index 2035015..362b6cf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4b1a=['../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','reject','save','update','then','destroy','error','name','FreshdeskConfiguration','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','length','find','create','body','params','findOne','FreshdeskField','offset','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5a58ad,_0x4eda9f){var _0x5e7811=function(_0x32fae9){while(--_0x32fae9){_0x5a58ad['push'](_0x5a58ad['shift']());}};_0x5e7811(++_0x4eda9f);}(_0x4b1a,0x183));var _0xa4b1=function(_0x285e60,_0x2fa315){_0x285e60=_0x285e60-0x0;var _0x5a3fc4=_0x4b1a[_0x285e60];return _0x5a3fc4;};'use strict';var emlformat=require(_0xa4b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa4b1('0x1'));var jsonpatch=require(_0xa4b1('0x2'));var rp=require(_0xa4b1('0x3'));var moment=require(_0xa4b1('0x4'));var BPromise=require(_0xa4b1('0x5'));var Mustache=require(_0xa4b1('0x6'));var util=require(_0xa4b1('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa4b1('0x8'));var ejs=require(_0xa4b1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa4b1('0xa'));var squel=require(_0xa4b1('0xb'));var crypto=require('crypto');var jsforce=require(_0xa4b1('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa4b1('0xd'));var Papa=require(_0xa4b1('0xe'));var Redis=require(_0xa4b1('0xf'));var authService=require(_0xa4b1('0x10'));var qs=require(_0xa4b1('0x11'));var as=require(_0xa4b1('0x12'));var hardwareService=require(_0xa4b1('0x13'));var logger=require(_0xa4b1('0x14'))(_0xa4b1('0x15'));var utils=require(_0xa4b1('0x16'));var config=require(_0xa4b1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa4b1('0x18'))['db'];function respondWithStatusCode(_0x3a539f,_0x232ac6){_0x232ac6=_0x232ac6||0xcc;return function(_0x3baf99){if(_0x3baf99){return _0x3a539f[_0xa4b1('0x19')](_0x232ac6);}return _0x3a539f[_0xa4b1('0x1a')](_0x232ac6)[_0xa4b1('0x1b')]();};}function respondWithResult(_0x4978cb,_0x31f95a){_0x31f95a=_0x31f95a||0xc8;return function(_0x502f63){if(_0x502f63){return _0x4978cb[_0xa4b1('0x1a')](_0x31f95a)[_0xa4b1('0x1c')](_0x502f63);}};}function respondWithFilteredResult(_0x567bfe,_0x2fb36a){return function(_0xa9ab14){if(_0xa9ab14){var _0x2e72a2=typeof _0x2fb36a['offset']===_0xa4b1('0x1d')&&typeof _0x2fb36a[_0xa4b1('0x1e')]===_0xa4b1('0x1d');var _0xba5601=_0xa9ab14[_0xa4b1('0x1f')];var _0x127b4e=_0x2e72a2?0x0:_0x2fb36a['offset'];var _0x514e39=_0x2e72a2?_0xa9ab14['count']:_0x2fb36a['offset']+_0x2fb36a[_0xa4b1('0x1e')];var _0x3c5d5e;if(_0x514e39>=_0xba5601){_0x514e39=_0xba5601;_0x3c5d5e=0xc8;}else{_0x3c5d5e=0xce;}_0x567bfe[_0xa4b1('0x1a')](_0x3c5d5e);return _0x567bfe[_0xa4b1('0x20')]('Content-Range',_0x127b4e+'-'+_0x514e39+'/'+_0xba5601)[_0xa4b1('0x1c')](_0xa9ab14);}return null;};}function patchUpdates(_0x271ef1){return function(_0x5d5bbe){try{jsonpatch['apply'](_0x5d5bbe,_0x271ef1,!![]);}catch(_0x145c08){return BPromise[_0xa4b1('0x21')](_0x145c08);}return _0x5d5bbe[_0xa4b1('0x22')]();};}function saveUpdates(_0x47bd81,_0x177d2c){return function(_0x4f2c9c){if(_0x4f2c9c){return _0x4f2c9c[_0xa4b1('0x23')](_0x47bd81)[_0xa4b1('0x24')](function(_0x56d17c){return _0x56d17c;});}return null;};}function removeEntity(_0x24b0f3,_0x45e5a1){return function(_0x366dba){if(_0x366dba){return _0x366dba[_0xa4b1('0x25')]()[_0xa4b1('0x24')](function(){_0x24b0f3['status'](0xcc)[_0xa4b1('0x1b')]();});}};}function handleEntityNotFound(_0xd4986f,_0x3ed7fe){return function(_0x24c877){if(!_0x24c877){_0xd4986f[_0xa4b1('0x19')](0x194);}return _0x24c877;};}function handleError(_0xafda14,_0x2120ae){_0x2120ae=_0x2120ae||0x1f4;return function(_0x4031ec){logger[_0xa4b1('0x26')](_0x4031ec['stack']);if(_0x4031ec[_0xa4b1('0x27')]){delete _0x4031ec[_0xa4b1('0x27')];}_0xafda14['status'](_0x2120ae)['send'](_0x4031ec);};}exports['index']=function(_0x45778d,_0x2160be){var _0x2ac1d1={},_0x44cd03={},_0x2306d4={'count':0x0,'rows':[]};var _0x326daf=_['map'](db[_0xa4b1('0x28')]['rawAttributes'],function(_0x287422){return{'name':_0x287422[_0xa4b1('0x29')],'type':_0x287422[_0xa4b1('0x2a')][_0xa4b1('0x2b')]};});_0x44cd03[_0xa4b1('0x2c')]=_[_0xa4b1('0x2d')](_0x326daf,_0xa4b1('0x27'));_0x44cd03[_0xa4b1('0x2e')]=_[_0xa4b1('0x2f')](_0x45778d[_0xa4b1('0x2e')]);_0x44cd03[_0xa4b1('0x30')]=_['intersection'](_0x44cd03[_0xa4b1('0x2c')],_0x44cd03['query']);_0x2ac1d1[_0xa4b1('0x31')]=_[_0xa4b1('0x32')](_0x44cd03['model'],qs[_0xa4b1('0x33')](_0x45778d[_0xa4b1('0x2e')][_0xa4b1('0x33')]));_0x2ac1d1[_0xa4b1('0x31')]=_0x2ac1d1[_0xa4b1('0x31')]['length']?_0x2ac1d1[_0xa4b1('0x31')]:_0x44cd03['model'];if(!_0x45778d[_0xa4b1('0x2e')][_0xa4b1('0x34')](_0xa4b1('0x35'))){_0x2ac1d1[_0xa4b1('0x1e')]=qs['limit'](_0x45778d['query']['limit']);_0x2ac1d1['offset']=qs['offset'](_0x45778d[_0xa4b1('0x2e')]['offset']);}_0x2ac1d1[_0xa4b1('0x36')]=qs['sort'](_0x45778d[_0xa4b1('0x2e')][_0xa4b1('0x37')]);_0x2ac1d1['where']=qs[_0xa4b1('0x30')](_[_0xa4b1('0x38')](_0x45778d[_0xa4b1('0x2e')],_0x44cd03[_0xa4b1('0x30')]),_0x326daf);if(_0x45778d[_0xa4b1('0x2e')][_0xa4b1('0x39')]){_0x2ac1d1[_0xa4b1('0x3a')]=_[_0xa4b1('0x3b')](_0x2ac1d1[_0xa4b1('0x3a')],{'$or':_['map'](_0x326daf,function(_0x39ecd7){if(_0x39ecd7[_0xa4b1('0x2a')]!==_0xa4b1('0x3c')){var _0x2c5201={};_0x2c5201[_0x39ecd7[_0xa4b1('0x27')]]={'$like':'%'+_0x45778d['query']['filter']+'%'};return _0x2c5201;}})});}_0x2ac1d1=_[_0xa4b1('0x3b')]({},_0x2ac1d1,_0x45778d[_0xa4b1('0x3d')]);var _0x20f625={'where':_0x2ac1d1[_0xa4b1('0x3a')]};return db[_0xa4b1('0x28')][_0xa4b1('0x1f')](_0x20f625)[_0xa4b1('0x24')](function(_0x9468a){_0x2306d4[_0xa4b1('0x1f')]=_0x9468a;if(_0x45778d[_0xa4b1('0x2e')][_0xa4b1('0x3e')]){_0x2ac1d1[_0xa4b1('0x3f')]=[{'all':!![]}];}return db[_0xa4b1('0x28')][_0xa4b1('0x40')](_0x2ac1d1);})['then'](function(_0xfe28a4){_0x2306d4[_0xa4b1('0x41')]=_0xfe28a4;return _0x2306d4;})[_0xa4b1('0x24')](respondWithFilteredResult(_0x2160be,_0x2ac1d1))[_0xa4b1('0x42')](handleError(_0x2160be,null));};exports['show']=function(_0x5de72,_0x167d68){var _0x1a3c66={'raw':![],'where':{'id':_0x5de72['params']['id']}},_0xb5082a={};_0xb5082a[_0xa4b1('0x2c')]=_[_0xa4b1('0x2f')](db[_0xa4b1('0x28')][_0xa4b1('0x43')]);_0xb5082a[_0xa4b1('0x2e')]=_[_0xa4b1('0x2f')](_0x5de72[_0xa4b1('0x2e')]);_0xb5082a[_0xa4b1('0x30')]=_[_0xa4b1('0x32')](_0xb5082a[_0xa4b1('0x2c')],_0xb5082a[_0xa4b1('0x2e')]);_0x1a3c66[_0xa4b1('0x31')]=_[_0xa4b1('0x32')](_0xb5082a[_0xa4b1('0x2c')],qs[_0xa4b1('0x33')](_0x5de72['query'][_0xa4b1('0x33')]));_0x1a3c66['attributes']=_0x1a3c66[_0xa4b1('0x31')][_0xa4b1('0x44')]?_0x1a3c66[_0xa4b1('0x31')]:_0xb5082a[_0xa4b1('0x2c')];if(_0x5de72[_0xa4b1('0x2e')]['includeAll']){_0x1a3c66['include']=[{'all':!![]}];}_0x1a3c66=_['merge']({},_0x1a3c66,_0x5de72[_0xa4b1('0x3d')]);return db[_0xa4b1('0x28')][_0xa4b1('0x45')](_0x1a3c66)[_0xa4b1('0x24')](handleEntityNotFound(_0x167d68,null))[_0xa4b1('0x24')](respondWithResult(_0x167d68,null))['catch'](handleError(_0x167d68,null));};exports['create']=function(_0x118f44,_0x55244e){return db[_0xa4b1('0x28')][_0xa4b1('0x46')](_0x118f44['body'],{})[_0xa4b1('0x24')](respondWithResult(_0x55244e,0xc9))['catch'](handleError(_0x55244e,null));};exports[_0xa4b1('0x23')]=function(_0x145b2a,_0x5da8b7){if(_0x145b2a[_0xa4b1('0x47')]['id']){delete _0x145b2a['body']['id'];}return db[_0xa4b1('0x28')]['find']({'where':{'id':_0x145b2a[_0xa4b1('0x48')]['id']}})['then'](handleEntityNotFound(_0x5da8b7,null))[_0xa4b1('0x24')](saveUpdates(_0x145b2a[_0xa4b1('0x47')],null))[_0xa4b1('0x24')](respondWithResult(_0x5da8b7,null))['catch'](handleError(_0x5da8b7,null));};exports['destroy']=function(_0x3e7e57,_0x3b5848){return db[_0xa4b1('0x28')][_0xa4b1('0x45')]({'where':{'id':_0x3e7e57[_0xa4b1('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b5848,null))[_0xa4b1('0x24')](removeEntity(_0x3b5848,null))[_0xa4b1('0x42')](handleError(_0x3b5848,null));};exports['getFields']=function(_0x3e0b83,_0x58054a,_0x403c52){var _0x1b078d={};var _0x20b47e={};var _0x24bb67;var _0x3f1ab4;return db[_0xa4b1('0x28')][_0xa4b1('0x49')]({'where':{'id':_0x3e0b83[_0xa4b1('0x48')]['id']}})['then'](handleEntityNotFound(_0x58054a,null))[_0xa4b1('0x24')](function(_0x3e483a){if(_0x3e483a){_0x24bb67=_0x3e483a;_0x20b47e[_0xa4b1('0x2c')]=_[_0xa4b1('0x2f')](db[_0xa4b1('0x4a')]['rawAttributes']);_0x20b47e[_0xa4b1('0x2e')]=_[_0xa4b1('0x2f')](_0x3e0b83[_0xa4b1('0x2e')]);_0x20b47e[_0xa4b1('0x30')]=_['intersection'](_0x20b47e[_0xa4b1('0x2c')],_0x20b47e[_0xa4b1('0x2e')]);_0x1b078d['attributes']=_[_0xa4b1('0x32')](_0x20b47e[_0xa4b1('0x2c')],qs['fields'](_0x3e0b83['query']['fields']));_0x1b078d[_0xa4b1('0x31')]=_0x1b078d[_0xa4b1('0x31')][_0xa4b1('0x44')]?_0x1b078d[_0xa4b1('0x31')]:_0x20b47e['model'];_0x1b078d[_0xa4b1('0x36')]=qs[_0xa4b1('0x37')](_0x3e0b83[_0xa4b1('0x2e')][_0xa4b1('0x37')]);_0x1b078d[_0xa4b1('0x3a')]=qs[_0xa4b1('0x30')](_[_0xa4b1('0x38')](_0x3e0b83[_0xa4b1('0x2e')],_0x20b47e['filters']));if(_0x3e0b83[_0xa4b1('0x2e')][_0xa4b1('0x39')]){_0x1b078d[_0xa4b1('0x3a')]=_[_0xa4b1('0x3b')](_0x1b078d[_0xa4b1('0x3a')],{'$or':_[_0xa4b1('0x2d')](_0x1b078d[_0xa4b1('0x31')],function(_0x44dae5){var _0xaed262={};_0xaed262[_0x44dae5]={'$like':'%'+_0x3e0b83['query'][_0xa4b1('0x39')]+'%'};return _0xaed262;})});}_0x1b078d=_['merge']({},_0x1b078d,_0x3e0b83[_0xa4b1('0x3d')]);return _0x24bb67['getFields'](_0x1b078d);}})['then'](function(_0x6f2862){if(_0x6f2862){_0x3f1ab4=_0x6f2862['length'];if(!_0x3e0b83[_0xa4b1('0x2e')][_0xa4b1('0x34')]('nolimit')){_0x1b078d[_0xa4b1('0x1e')]=qs[_0xa4b1('0x1e')](_0x3e0b83[_0xa4b1('0x2e')][_0xa4b1('0x1e')]);_0x1b078d[_0xa4b1('0x4b')]=qs[_0xa4b1('0x4b')](_0x3e0b83[_0xa4b1('0x2e')]['offset']);}return _0x24bb67[_0xa4b1('0x4c')](_0x1b078d);}})[_0xa4b1('0x24')](function(_0x9d4a36){if(_0x9d4a36){return _0x9d4a36?{'count':_0x3f1ab4,'rows':_0x9d4a36}:null;}})[_0xa4b1('0x24')](respondWithResult(_0x58054a,null))[_0xa4b1('0x42')](handleError(_0x58054a,null));};exports[_0xa4b1('0x4d')]=function(_0x5515a6,_0x5a2417,_0x4772af){var _0x211822={};var _0x1a2ccf={};var _0x12f4ee;var _0x2f59d2;return db['FreshdeskConfiguration'][_0xa4b1('0x49')]({'where':{'id':_0x5515a6[_0xa4b1('0x48')]['id']}})[_0xa4b1('0x24')](handleEntityNotFound(_0x5a2417,null))[_0xa4b1('0x24')](function(_0x51b6a4){if(_0x51b6a4){_0x12f4ee=_0x51b6a4;_0x1a2ccf[_0xa4b1('0x2c')]=_[_0xa4b1('0x2f')](db['FreshdeskField'][_0xa4b1('0x43')]);_0x1a2ccf[_0xa4b1('0x2e')]=_[_0xa4b1('0x2f')](_0x5515a6[_0xa4b1('0x2e')]);_0x1a2ccf[_0xa4b1('0x30')]=_[_0xa4b1('0x32')](_0x1a2ccf[_0xa4b1('0x2c')],_0x1a2ccf[_0xa4b1('0x2e')]);_0x211822[_0xa4b1('0x31')]=_[_0xa4b1('0x32')](_0x1a2ccf[_0xa4b1('0x2c')],qs['fields'](_0x5515a6[_0xa4b1('0x2e')][_0xa4b1('0x33')]));_0x211822[_0xa4b1('0x31')]=_0x211822[_0xa4b1('0x31')][_0xa4b1('0x44')]?_0x211822['attributes']:_0x1a2ccf['model'];_0x211822[_0xa4b1('0x36')]=qs[_0xa4b1('0x37')](_0x5515a6[_0xa4b1('0x2e')][_0xa4b1('0x37')]);_0x211822['where']=qs[_0xa4b1('0x30')](_[_0xa4b1('0x38')](_0x5515a6[_0xa4b1('0x2e')],_0x1a2ccf[_0xa4b1('0x30')]));if(_0x5515a6[_0xa4b1('0x2e')]['filter']){_0x211822[_0xa4b1('0x3a')]=_[_0xa4b1('0x3b')](_0x211822[_0xa4b1('0x3a')],{'$or':_[_0xa4b1('0x2d')](_0x211822['attributes'],function(_0x27362a){var _0x385b60={};_0x385b60[_0x27362a]={'$like':'%'+_0x5515a6[_0xa4b1('0x2e')][_0xa4b1('0x39')]+'%'};return _0x385b60;})});}_0x211822=_[_0xa4b1('0x3b')]({},_0x211822,_0x5515a6[_0xa4b1('0x3d')]);return _0x12f4ee[_0xa4b1('0x4d')](_0x211822);}})[_0xa4b1('0x24')](function(_0x32e9f9){if(_0x32e9f9){_0x2f59d2=_0x32e9f9[_0xa4b1('0x44')];if(!_0x5515a6['query'][_0xa4b1('0x34')](_0xa4b1('0x35'))){_0x211822[_0xa4b1('0x1e')]=qs[_0xa4b1('0x1e')](_0x5515a6[_0xa4b1('0x2e')][_0xa4b1('0x1e')]);_0x211822['offset']=qs[_0xa4b1('0x4b')](_0x5515a6[_0xa4b1('0x2e')][_0xa4b1('0x4b')]);}return _0x12f4ee[_0xa4b1('0x4d')](_0x211822);}})['then'](function(_0x4319da){if(_0x4319da){return _0x4319da?{'count':_0x2f59d2,'rows':_0x4319da}:null;}})[_0xa4b1('0x24')](respondWithResult(_0x5a2417,null))['catch'](handleError(_0x5a2417,null));};exports[_0xa4b1('0x4e')]=function(_0x57c6ce,_0x368167,_0x435fbb){var _0x86a38c={};var _0x317143={};var _0x54ecae;var _0x42b4ea;return db['FreshdeskConfiguration'][_0xa4b1('0x49')]({'where':{'id':_0x57c6ce[_0xa4b1('0x48')]['id']}})['then'](handleEntityNotFound(_0x368167,null))['then'](function(_0x1b5c02){if(_0x1b5c02){_0x54ecae=_0x1b5c02;_0x317143['model']=_['keys'](db[_0xa4b1('0x4a')][_0xa4b1('0x43')]);_0x317143[_0xa4b1('0x2e')]=_['keys'](_0x57c6ce[_0xa4b1('0x2e')]);_0x317143[_0xa4b1('0x30')]=_['intersection'](_0x317143['model'],_0x317143[_0xa4b1('0x2e')]);_0x86a38c[_0xa4b1('0x31')]=_[_0xa4b1('0x32')](_0x317143[_0xa4b1('0x2c')],qs[_0xa4b1('0x33')](_0x57c6ce[_0xa4b1('0x2e')][_0xa4b1('0x33')]));_0x86a38c[_0xa4b1('0x31')]=_0x86a38c['attributes'][_0xa4b1('0x44')]?_0x86a38c[_0xa4b1('0x31')]:_0x317143[_0xa4b1('0x2c')];_0x86a38c['order']=qs[_0xa4b1('0x37')](_0x57c6ce[_0xa4b1('0x2e')][_0xa4b1('0x37')]);_0x86a38c[_0xa4b1('0x3a')]=qs['filters'](_[_0xa4b1('0x38')](_0x57c6ce[_0xa4b1('0x2e')],_0x317143[_0xa4b1('0x30')]));if(_0x57c6ce['query'][_0xa4b1('0x39')]){_0x86a38c[_0xa4b1('0x3a')]=_[_0xa4b1('0x3b')](_0x86a38c[_0xa4b1('0x3a')],{'$or':_['map'](_0x86a38c[_0xa4b1('0x31')],function(_0x5bca16){var _0x23136e={};_0x23136e[_0x5bca16]={'$like':'%'+_0x57c6ce[_0xa4b1('0x2e')][_0xa4b1('0x39')]+'%'};return _0x23136e;})});}_0x86a38c=_[_0xa4b1('0x3b')]({},_0x86a38c,_0x57c6ce[_0xa4b1('0x3d')]);return _0x54ecae[_0xa4b1('0x4e')](_0x86a38c);}})[_0xa4b1('0x24')](function(_0x6a50db){if(_0x6a50db){_0x42b4ea=_0x6a50db['length'];if(!_0x57c6ce['query'][_0xa4b1('0x34')](_0xa4b1('0x35'))){_0x86a38c[_0xa4b1('0x1e')]=qs[_0xa4b1('0x1e')](_0x57c6ce['query'][_0xa4b1('0x1e')]);_0x86a38c[_0xa4b1('0x4b')]=qs[_0xa4b1('0x4b')](_0x57c6ce[_0xa4b1('0x2e')]['offset']);}return _0x54ecae[_0xa4b1('0x4e')](_0x86a38c);}})[_0xa4b1('0x24')](function(_0xc5a262){if(_0xc5a262){return _0xc5a262?{'count':_0x42b4ea,'rows':_0xc5a262}:null;}})['then'](respondWithResult(_0x368167,null))[_0xa4b1('0x42')](handleError(_0x368167,null));};exports[_0xa4b1('0x4f')]=function(_0x4e7c84,_0x285f81,_0x297ad2){var _0x1fae37={};var _0xc1ceca={};var _0x263e3;var _0x3121e6;return db[_0xa4b1('0x28')][_0xa4b1('0x49')]({'where':{'id':_0x4e7c84['params']['id']}})[_0xa4b1('0x24')](handleEntityNotFound(_0x285f81,null))[_0xa4b1('0x24')](function(_0x59b607){if(_0x59b607){_0x263e3=_0x59b607;_0xc1ceca[_0xa4b1('0x2c')]=_[_0xa4b1('0x2f')](db[_0xa4b1('0x50')][_0xa4b1('0x43')]);_0xc1ceca[_0xa4b1('0x2e')]=_['keys'](_0x4e7c84[_0xa4b1('0x2e')]);_0xc1ceca[_0xa4b1('0x30')]=_['intersection'](_0xc1ceca[_0xa4b1('0x2c')],_0xc1ceca[_0xa4b1('0x2e')]);_0x1fae37[_0xa4b1('0x31')]=_['intersection'](_0xc1ceca[_0xa4b1('0x2c')],qs[_0xa4b1('0x33')](_0x4e7c84['query'][_0xa4b1('0x33')]));_0x1fae37[_0xa4b1('0x31')]=_0x1fae37[_0xa4b1('0x31')][_0xa4b1('0x44')]?_0x1fae37[_0xa4b1('0x31')]:_0xc1ceca['model'];_0x1fae37['order']=qs[_0xa4b1('0x37')](_0x4e7c84[_0xa4b1('0x2e')]['sort']);_0x1fae37[_0xa4b1('0x3a')]=qs[_0xa4b1('0x30')](_[_0xa4b1('0x38')](_0x4e7c84[_0xa4b1('0x2e')],_0xc1ceca['filters']));if(_0x4e7c84[_0xa4b1('0x2e')][_0xa4b1('0x39')]){_0x1fae37['where']=_[_0xa4b1('0x3b')](_0x1fae37[_0xa4b1('0x3a')],{'$or':_[_0xa4b1('0x2d')](_0x1fae37[_0xa4b1('0x31')],function(_0x45ac2d){var _0x2ff306={};_0x2ff306[_0x45ac2d]={'$like':'%'+_0x4e7c84[_0xa4b1('0x2e')][_0xa4b1('0x39')]+'%'};return _0x2ff306;})});}_0x1fae37=_['merge']({},_0x1fae37,_0x4e7c84[_0xa4b1('0x3d')]);return _0x263e3[_0xa4b1('0x4f')](_0x1fae37);}})[_0xa4b1('0x24')](function(_0x51d661){if(_0x51d661){_0x3121e6=_0x51d661[_0xa4b1('0x44')];if(!_0x4e7c84[_0xa4b1('0x2e')][_0xa4b1('0x34')]('nolimit')){_0x1fae37[_0xa4b1('0x1e')]=qs['limit'](_0x4e7c84[_0xa4b1('0x2e')][_0xa4b1('0x1e')]);_0x1fae37[_0xa4b1('0x4b')]=qs[_0xa4b1('0x4b')](_0x4e7c84[_0xa4b1('0x2e')][_0xa4b1('0x4b')]);}return _0x263e3[_0xa4b1('0x4f')](_0x1fae37);}})[_0xa4b1('0x24')](function(_0x5cd3f4){if(_0x5cd3f4){return _0x5cd3f4?{'count':_0x3121e6,'rows':_0x5cd3f4}:null;}})['then'](respondWithResult(_0x285f81,null))[_0xa4b1('0x42')](handleError(_0x285f81,null));};exports['setTags']=function(_0x3951c0,_0x21ef75,_0x358c8a){if(_0x3951c0[_0xa4b1('0x47')]['id']){delete _0x3951c0[_0xa4b1('0x47')]['id'];}return db[_0xa4b1('0x28')][_0xa4b1('0x49')]({'where':{'id':_0x3951c0['params']['id']}})[_0xa4b1('0x24')](handleEntityNotFound(_0x21ef75,null))[_0xa4b1('0x24')](function(_0x50c03b){if(_0x50c03b){return _0x50c03b[_0xa4b1('0x51')](_0x3951c0[_0xa4b1('0x47')]['ids']||[]);}return null;})[_0xa4b1('0x24')](respondWithResult(_0x21ef75,null))[_0xa4b1('0x42')](handleError(_0x21ef75,null));};
\ No newline at end of file
+var _0x80fb=['jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','index','map','FreshdeskConfiguration','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','name','merge','options','includeAll','include','catch','show','params','keys','rawAttributes','length','find','create','body','findOne','pick','getFields','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','ejs','fs-extra','lodash','squel','crypto'];(function(_0x170f62,_0x176f4e){var _0x121afc=function(_0x3de408){while(--_0x3de408){_0x170f62['push'](_0x170f62['shift']());}};_0x121afc(++_0x176f4e);}(_0x80fb,0xf6));var _0xb80f=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x80fb[_0x174ef5];return _0x1cc379;};'use strict';var emlformat=require(_0xb80f('0x0'));var rimraf=require(_0xb80f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb80f('0x2'));var rp=require(_0xb80f('0x3'));var moment=require(_0xb80f('0x4'));var BPromise=require(_0xb80f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb80f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb80f('0x7'));var fs=require('fs');var fs_extra=require(_0xb80f('0x8'));var _=require(_0xb80f('0x9'));var squel=require(_0xb80f('0xa'));var crypto=require(_0xb80f('0xb'));var jsforce=require(_0xb80f('0xc'));var deskjs=require(_0xb80f('0xd'));var toCsv=require(_0xb80f('0xe'));var querystring=require(_0xb80f('0xf'));var Papa=require('papaparse');var Redis=require(_0xb80f('0x10'));var authService=require(_0xb80f('0x11'));var qs=require(_0xb80f('0x12'));var as=require(_0xb80f('0x13'));var hardwareService=require(_0xb80f('0x14'));var logger=require(_0xb80f('0x15'))(_0xb80f('0x16'));var utils=require(_0xb80f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb80f('0x18'))['db'];function respondWithStatusCode(_0x5ca851,_0x5c1429){_0x5c1429=_0x5c1429||0xcc;return function(_0x3332d4){if(_0x3332d4){return _0x5ca851[_0xb80f('0x19')](_0x5c1429);}return _0x5ca851[_0xb80f('0x1a')](_0x5c1429)['end']();};}function respondWithResult(_0x4b30dd,_0x38f551){_0x38f551=_0x38f551||0xc8;return function(_0x4f7015){if(_0x4f7015){return _0x4b30dd[_0xb80f('0x1a')](_0x38f551)['json'](_0x4f7015);}};}function respondWithFilteredResult(_0x4c1b3e,_0x4925ea){return function(_0x2a4850){if(_0x2a4850){var _0x2b5e48=typeof _0x4925ea['offset']===_0xb80f('0x1b')&&typeof _0x4925ea[_0xb80f('0x1c')]===_0xb80f('0x1b');var _0x1d350b=_0x2a4850[_0xb80f('0x1d')];var _0x3e7f9f=_0x2b5e48?0x0:_0x4925ea[_0xb80f('0x1e')];var _0x301b84=_0x2b5e48?_0x2a4850['count']:_0x4925ea['offset']+_0x4925ea[_0xb80f('0x1c')];var _0x3b017c;if(_0x301b84>=_0x1d350b){_0x301b84=_0x1d350b;_0x3b017c=0xc8;}else{_0x3b017c=0xce;}_0x4c1b3e[_0xb80f('0x1a')](_0x3b017c);return _0x4c1b3e[_0xb80f('0x1f')](_0xb80f('0x20'),_0x3e7f9f+'-'+_0x301b84+'/'+_0x1d350b)['json'](_0x2a4850);}return null;};}function patchUpdates(_0x1afb0b){return function(_0x389dc3){try{jsonpatch[_0xb80f('0x21')](_0x389dc3,_0x1afb0b,!![]);}catch(_0x268e02){return BPromise[_0xb80f('0x22')](_0x268e02);}return _0x389dc3[_0xb80f('0x23')]();};}function saveUpdates(_0x185b67,_0x3a6683){return function(_0x114a95){if(_0x114a95){return _0x114a95[_0xb80f('0x24')](_0x185b67)[_0xb80f('0x25')](function(_0x414017){return _0x414017;});}return null;};}function removeEntity(_0x1bf50b,_0x393198){return function(_0x3d5ee0){if(_0x3d5ee0){return _0x3d5ee0[_0xb80f('0x26')]()[_0xb80f('0x25')](function(){_0x1bf50b['status'](0xcc)[_0xb80f('0x27')]();});}};}function handleEntityNotFound(_0x2acf2e,_0x84db64){return function(_0x46c5af){if(!_0x46c5af){_0x2acf2e[_0xb80f('0x19')](0x194);}return _0x46c5af;};}function handleError(_0x172a30,_0x11e2ef){_0x11e2ef=_0x11e2ef||0x1f4;return function(_0xd516cb){logger[_0xb80f('0x28')](_0xd516cb[_0xb80f('0x29')]);if(_0xd516cb['name']){delete _0xd516cb['name'];}_0x172a30[_0xb80f('0x1a')](_0x11e2ef)[_0xb80f('0x2a')](_0xd516cb);};}exports[_0xb80f('0x2b')]=function(_0x1a2934,_0x32fb7a){var _0x34509a={},_0x2828c3={},_0x3291a4={'count':0x0,'rows':[]};var _0x1efb59=_[_0xb80f('0x2c')](db[_0xb80f('0x2d')]['rawAttributes'],function(_0x43fa2a){return{'name':_0x43fa2a[_0xb80f('0x2e')],'type':_0x43fa2a[_0xb80f('0x2f')][_0xb80f('0x30')]};});_0x2828c3[_0xb80f('0x31')]=_[_0xb80f('0x2c')](_0x1efb59,'name');_0x2828c3[_0xb80f('0x32')]=_['keys'](_0x1a2934[_0xb80f('0x32')]);_0x2828c3[_0xb80f('0x33')]=_[_0xb80f('0x34')](_0x2828c3[_0xb80f('0x31')],_0x2828c3['query']);_0x34509a[_0xb80f('0x35')]=_[_0xb80f('0x34')](_0x2828c3['model'],qs[_0xb80f('0x36')](_0x1a2934[_0xb80f('0x32')]['fields']));_0x34509a[_0xb80f('0x35')]=_0x34509a[_0xb80f('0x35')]['length']?_0x34509a[_0xb80f('0x35')]:_0x2828c3['model'];if(!_0x1a2934['query'][_0xb80f('0x37')](_0xb80f('0x38'))){_0x34509a[_0xb80f('0x1c')]=qs[_0xb80f('0x1c')](_0x1a2934[_0xb80f('0x32')][_0xb80f('0x1c')]);_0x34509a[_0xb80f('0x1e')]=qs[_0xb80f('0x1e')](_0x1a2934[_0xb80f('0x32')][_0xb80f('0x1e')]);}_0x34509a[_0xb80f('0x39')]=qs[_0xb80f('0x3a')](_0x1a2934['query'][_0xb80f('0x3a')]);_0x34509a[_0xb80f('0x3b')]=qs['filters'](_['pick'](_0x1a2934[_0xb80f('0x32')],_0x2828c3[_0xb80f('0x33')]),_0x1efb59);if(_0x1a2934[_0xb80f('0x32')][_0xb80f('0x3c')]){_0x34509a[_0xb80f('0x3b')]=_['merge'](_0x34509a['where'],{'$or':_[_0xb80f('0x2c')](_0x1efb59,function(_0x3cc693){if(_0x3cc693[_0xb80f('0x2f')]!==_0xb80f('0x3d')){var _0x283ae6={};_0x283ae6[_0x3cc693[_0xb80f('0x3e')]]={'$like':'%'+_0x1a2934[_0xb80f('0x32')][_0xb80f('0x3c')]+'%'};return _0x283ae6;}})});}_0x34509a=_[_0xb80f('0x3f')]({},_0x34509a,_0x1a2934[_0xb80f('0x40')]);var _0x18889e={'where':_0x34509a[_0xb80f('0x3b')]};return db[_0xb80f('0x2d')][_0xb80f('0x1d')](_0x18889e)[_0xb80f('0x25')](function(_0x43dc0d){_0x3291a4[_0xb80f('0x1d')]=_0x43dc0d;if(_0x1a2934[_0xb80f('0x32')][_0xb80f('0x41')]){_0x34509a[_0xb80f('0x42')]=[{'all':!![]}];}return db[_0xb80f('0x2d')]['findAll'](_0x34509a);})[_0xb80f('0x25')](function(_0x5d5ed6){_0x3291a4['rows']=_0x5d5ed6;return _0x3291a4;})[_0xb80f('0x25')](respondWithFilteredResult(_0x32fb7a,_0x34509a))[_0xb80f('0x43')](handleError(_0x32fb7a,null));};exports[_0xb80f('0x44')]=function(_0x43f8ec,_0x3637b5){var _0x27e613={'raw':![],'where':{'id':_0x43f8ec[_0xb80f('0x45')]['id']}},_0x3fa47d={};_0x3fa47d[_0xb80f('0x31')]=_[_0xb80f('0x46')](db['FreshdeskConfiguration'][_0xb80f('0x47')]);_0x3fa47d['query']=_[_0xb80f('0x46')](_0x43f8ec[_0xb80f('0x32')]);_0x3fa47d[_0xb80f('0x33')]=_[_0xb80f('0x34')](_0x3fa47d[_0xb80f('0x31')],_0x3fa47d[_0xb80f('0x32')]);_0x27e613[_0xb80f('0x35')]=_['intersection'](_0x3fa47d[_0xb80f('0x31')],qs[_0xb80f('0x36')](_0x43f8ec['query'][_0xb80f('0x36')]));_0x27e613[_0xb80f('0x35')]=_0x27e613[_0xb80f('0x35')][_0xb80f('0x48')]?_0x27e613['attributes']:_0x3fa47d[_0xb80f('0x31')];if(_0x43f8ec['query'][_0xb80f('0x41')]){_0x27e613['include']=[{'all':!![]}];}_0x27e613=_[_0xb80f('0x3f')]({},_0x27e613,_0x43f8ec[_0xb80f('0x40')]);return db[_0xb80f('0x2d')][_0xb80f('0x49')](_0x27e613)[_0xb80f('0x25')](handleEntityNotFound(_0x3637b5,null))[_0xb80f('0x25')](respondWithResult(_0x3637b5,null))['catch'](handleError(_0x3637b5,null));};exports[_0xb80f('0x4a')]=function(_0x9fbfc3,_0x724613){return db[_0xb80f('0x2d')]['create'](_0x9fbfc3[_0xb80f('0x4b')],{})[_0xb80f('0x25')](respondWithResult(_0x724613,0xc9))[_0xb80f('0x43')](handleError(_0x724613,null));};exports[_0xb80f('0x24')]=function(_0x468e8b,_0x277879){if(_0x468e8b[_0xb80f('0x4b')]['id']){delete _0x468e8b[_0xb80f('0x4b')]['id'];}return db[_0xb80f('0x2d')]['find']({'where':{'id':_0x468e8b[_0xb80f('0x45')]['id']}})[_0xb80f('0x25')](handleEntityNotFound(_0x277879,null))[_0xb80f('0x25')](saveUpdates(_0x468e8b[_0xb80f('0x4b')],null))[_0xb80f('0x25')](respondWithResult(_0x277879,null))[_0xb80f('0x43')](handleError(_0x277879,null));};exports[_0xb80f('0x26')]=function(_0x4c876a,_0x536506){return db[_0xb80f('0x2d')]['find']({'where':{'id':_0x4c876a['params']['id']}})[_0xb80f('0x25')](handleEntityNotFound(_0x536506,null))[_0xb80f('0x25')](removeEntity(_0x536506,null))[_0xb80f('0x43')](handleError(_0x536506,null));};exports['getFields']=function(_0x28bdf1,_0x1eb871,_0x191992){var _0x175499={};var _0x4b5013={};var _0x79bac5;var _0x6a15b7;return db['FreshdeskConfiguration'][_0xb80f('0x4c')]({'where':{'id':_0x28bdf1[_0xb80f('0x45')]['id']}})['then'](handleEntityNotFound(_0x1eb871,null))['then'](function(_0x26fd7c){if(_0x26fd7c){_0x79bac5=_0x26fd7c;_0x4b5013[_0xb80f('0x31')]=_[_0xb80f('0x46')](db['FreshdeskField'][_0xb80f('0x47')]);_0x4b5013[_0xb80f('0x32')]=_[_0xb80f('0x46')](_0x28bdf1[_0xb80f('0x32')]);_0x4b5013[_0xb80f('0x33')]=_['intersection'](_0x4b5013[_0xb80f('0x31')],_0x4b5013[_0xb80f('0x32')]);_0x175499[_0xb80f('0x35')]=_[_0xb80f('0x34')](_0x4b5013[_0xb80f('0x31')],qs[_0xb80f('0x36')](_0x28bdf1[_0xb80f('0x32')][_0xb80f('0x36')]));_0x175499[_0xb80f('0x35')]=_0x175499[_0xb80f('0x35')][_0xb80f('0x48')]?_0x175499[_0xb80f('0x35')]:_0x4b5013[_0xb80f('0x31')];_0x175499['order']=qs[_0xb80f('0x3a')](_0x28bdf1[_0xb80f('0x32')]['sort']);_0x175499[_0xb80f('0x3b')]=qs['filters'](_[_0xb80f('0x4d')](_0x28bdf1['query'],_0x4b5013[_0xb80f('0x33')]));if(_0x28bdf1[_0xb80f('0x32')]['filter']){_0x175499[_0xb80f('0x3b')]=_[_0xb80f('0x3f')](_0x175499['where'],{'$or':_['map'](_0x175499['attributes'],function(_0x1cd6d7){var _0x1d7694={};_0x1d7694[_0x1cd6d7]={'$like':'%'+_0x28bdf1[_0xb80f('0x32')][_0xb80f('0x3c')]+'%'};return _0x1d7694;})});}_0x175499=_['merge']({},_0x175499,_0x28bdf1[_0xb80f('0x40')]);return _0x79bac5[_0xb80f('0x4e')](_0x175499);}})[_0xb80f('0x25')](function(_0x1733e7){if(_0x1733e7){_0x6a15b7=_0x1733e7[_0xb80f('0x48')];if(!_0x28bdf1['query'][_0xb80f('0x37')](_0xb80f('0x38'))){_0x175499['limit']=qs['limit'](_0x28bdf1[_0xb80f('0x32')]['limit']);_0x175499[_0xb80f('0x1e')]=qs['offset'](_0x28bdf1[_0xb80f('0x32')]['offset']);}return _0x79bac5[_0xb80f('0x4e')](_0x175499);}})[_0xb80f('0x25')](function(_0xe377f9){if(_0xe377f9){return _0xe377f9?{'count':_0x6a15b7,'rows':_0xe377f9}:null;}})[_0xb80f('0x25')](respondWithResult(_0x1eb871,null))[_0xb80f('0x43')](handleError(_0x1eb871,null));};exports[_0xb80f('0x4f')]=function(_0x498ce8,_0x138d8f,_0x53f7b8){var _0x501732={};var _0x3be555={};var _0x54aa3d;var _0x21c18;return db['FreshdeskConfiguration'][_0xb80f('0x4c')]({'where':{'id':_0x498ce8['params']['id']}})[_0xb80f('0x25')](handleEntityNotFound(_0x138d8f,null))[_0xb80f('0x25')](function(_0x31bc64){if(_0x31bc64){_0x54aa3d=_0x31bc64;_0x3be555[_0xb80f('0x31')]=_[_0xb80f('0x46')](db[_0xb80f('0x50')][_0xb80f('0x47')]);_0x3be555[_0xb80f('0x32')]=_['keys'](_0x498ce8[_0xb80f('0x32')]);_0x3be555[_0xb80f('0x33')]=_['intersection'](_0x3be555[_0xb80f('0x31')],_0x3be555[_0xb80f('0x32')]);_0x501732['attributes']=_[_0xb80f('0x34')](_0x3be555[_0xb80f('0x31')],qs[_0xb80f('0x36')](_0x498ce8[_0xb80f('0x32')]['fields']));_0x501732[_0xb80f('0x35')]=_0x501732['attributes'][_0xb80f('0x48')]?_0x501732[_0xb80f('0x35')]:_0x3be555['model'];_0x501732['order']=qs[_0xb80f('0x3a')](_0x498ce8[_0xb80f('0x32')][_0xb80f('0x3a')]);_0x501732[_0xb80f('0x3b')]=qs[_0xb80f('0x33')](_['pick'](_0x498ce8[_0xb80f('0x32')],_0x3be555[_0xb80f('0x33')]));if(_0x498ce8[_0xb80f('0x32')]['filter']){_0x501732[_0xb80f('0x3b')]=_[_0xb80f('0x3f')](_0x501732['where'],{'$or':_[_0xb80f('0x2c')](_0x501732[_0xb80f('0x35')],function(_0xabf14b){var _0x222d29={};_0x222d29[_0xabf14b]={'$like':'%'+_0x498ce8[_0xb80f('0x32')][_0xb80f('0x3c')]+'%'};return _0x222d29;})});}_0x501732=_[_0xb80f('0x3f')]({},_0x501732,_0x498ce8[_0xb80f('0x40')]);return _0x54aa3d[_0xb80f('0x4f')](_0x501732);}})[_0xb80f('0x25')](function(_0x4e031b){if(_0x4e031b){_0x21c18=_0x4e031b['length'];if(!_0x498ce8[_0xb80f('0x32')][_0xb80f('0x37')](_0xb80f('0x38'))){_0x501732[_0xb80f('0x1c')]=qs[_0xb80f('0x1c')](_0x498ce8['query'][_0xb80f('0x1c')]);_0x501732[_0xb80f('0x1e')]=qs['offset'](_0x498ce8[_0xb80f('0x32')][_0xb80f('0x1e')]);}return _0x54aa3d[_0xb80f('0x4f')](_0x501732);}})['then'](function(_0xc4bb1e){if(_0xc4bb1e){return _0xc4bb1e?{'count':_0x21c18,'rows':_0xc4bb1e}:null;}})[_0xb80f('0x25')](respondWithResult(_0x138d8f,null))[_0xb80f('0x43')](handleError(_0x138d8f,null));};exports[_0xb80f('0x51')]=function(_0x20f8d2,_0x365a4c,_0x23ede5){var _0x4e37eb={};var _0xed4ea6={};var _0x13b73f;var _0x8a4ac1;return db[_0xb80f('0x2d')][_0xb80f('0x4c')]({'where':{'id':_0x20f8d2[_0xb80f('0x45')]['id']}})['then'](handleEntityNotFound(_0x365a4c,null))[_0xb80f('0x25')](function(_0x61ffdb){if(_0x61ffdb){_0x13b73f=_0x61ffdb;_0xed4ea6[_0xb80f('0x31')]=_[_0xb80f('0x46')](db[_0xb80f('0x50')][_0xb80f('0x47')]);_0xed4ea6['query']=_['keys'](_0x20f8d2[_0xb80f('0x32')]);_0xed4ea6['filters']=_['intersection'](_0xed4ea6[_0xb80f('0x31')],_0xed4ea6[_0xb80f('0x32')]);_0x4e37eb[_0xb80f('0x35')]=_[_0xb80f('0x34')](_0xed4ea6[_0xb80f('0x31')],qs[_0xb80f('0x36')](_0x20f8d2['query']['fields']));_0x4e37eb[_0xb80f('0x35')]=_0x4e37eb['attributes'][_0xb80f('0x48')]?_0x4e37eb[_0xb80f('0x35')]:_0xed4ea6[_0xb80f('0x31')];_0x4e37eb[_0xb80f('0x39')]=qs[_0xb80f('0x3a')](_0x20f8d2[_0xb80f('0x32')][_0xb80f('0x3a')]);_0x4e37eb[_0xb80f('0x3b')]=qs[_0xb80f('0x33')](_['pick'](_0x20f8d2['query'],_0xed4ea6[_0xb80f('0x33')]));if(_0x20f8d2[_0xb80f('0x32')][_0xb80f('0x3c')]){_0x4e37eb[_0xb80f('0x3b')]=_[_0xb80f('0x3f')](_0x4e37eb[_0xb80f('0x3b')],{'$or':_[_0xb80f('0x2c')](_0x4e37eb['attributes'],function(_0x2c4028){var _0x2a5d36={};_0x2a5d36[_0x2c4028]={'$like':'%'+_0x20f8d2['query'][_0xb80f('0x3c')]+'%'};return _0x2a5d36;})});}_0x4e37eb=_[_0xb80f('0x3f')]({},_0x4e37eb,_0x20f8d2[_0xb80f('0x40')]);return _0x13b73f[_0xb80f('0x51')](_0x4e37eb);}})[_0xb80f('0x25')](function(_0x3ee967){if(_0x3ee967){_0x8a4ac1=_0x3ee967['length'];if(!_0x20f8d2['query'][_0xb80f('0x37')]('nolimit')){_0x4e37eb[_0xb80f('0x1c')]=qs[_0xb80f('0x1c')](_0x20f8d2[_0xb80f('0x32')]['limit']);_0x4e37eb['offset']=qs[_0xb80f('0x1e')](_0x20f8d2[_0xb80f('0x32')][_0xb80f('0x1e')]);}return _0x13b73f['getDescriptions'](_0x4e37eb);}})[_0xb80f('0x25')](function(_0x22c5d8){if(_0x22c5d8){return _0x22c5d8?{'count':_0x8a4ac1,'rows':_0x22c5d8}:null;}})[_0xb80f('0x25')](respondWithResult(_0x365a4c,null))[_0xb80f('0x43')](handleError(_0x365a4c,null));};exports[_0xb80f('0x52')]=function(_0x454f48,_0x1a94e6,_0x7e0d2e){var _0x254979={};var _0x4a0fd0={};var _0x483c97;var _0x135082;return db[_0xb80f('0x2d')]['findOne']({'where':{'id':_0x454f48[_0xb80f('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a94e6,null))[_0xb80f('0x25')](function(_0x3ad9f2){if(_0x3ad9f2){_0x483c97=_0x3ad9f2;_0x4a0fd0[_0xb80f('0x31')]=_[_0xb80f('0x46')](db[_0xb80f('0x53')][_0xb80f('0x47')]);_0x4a0fd0[_0xb80f('0x32')]=_[_0xb80f('0x46')](_0x454f48[_0xb80f('0x32')]);_0x4a0fd0[_0xb80f('0x33')]=_[_0xb80f('0x34')](_0x4a0fd0[_0xb80f('0x31')],_0x4a0fd0['query']);_0x254979[_0xb80f('0x35')]=_['intersection'](_0x4a0fd0[_0xb80f('0x31')],qs['fields'](_0x454f48[_0xb80f('0x32')][_0xb80f('0x36')]));_0x254979[_0xb80f('0x35')]=_0x254979[_0xb80f('0x35')]['length']?_0x254979[_0xb80f('0x35')]:_0x4a0fd0['model'];_0x254979['order']=qs[_0xb80f('0x3a')](_0x454f48[_0xb80f('0x32')][_0xb80f('0x3a')]);_0x254979[_0xb80f('0x3b')]=qs[_0xb80f('0x33')](_[_0xb80f('0x4d')](_0x454f48[_0xb80f('0x32')],_0x4a0fd0[_0xb80f('0x33')]));if(_0x454f48[_0xb80f('0x32')][_0xb80f('0x3c')]){_0x254979['where']=_[_0xb80f('0x3f')](_0x254979[_0xb80f('0x3b')],{'$or':_['map'](_0x254979['attributes'],function(_0x253f71){var _0x227b98={};_0x227b98[_0x253f71]={'$like':'%'+_0x454f48['query']['filter']+'%'};return _0x227b98;})});}_0x254979=_[_0xb80f('0x3f')]({},_0x254979,_0x454f48[_0xb80f('0x40')]);return _0x483c97[_0xb80f('0x52')](_0x254979);}})['then'](function(_0x58b4e){if(_0x58b4e){_0x135082=_0x58b4e[_0xb80f('0x48')];if(!_0x454f48[_0xb80f('0x32')][_0xb80f('0x37')]('nolimit')){_0x254979[_0xb80f('0x1c')]=qs[_0xb80f('0x1c')](_0x454f48[_0xb80f('0x32')][_0xb80f('0x1c')]);_0x254979['offset']=qs['offset'](_0x454f48['query'][_0xb80f('0x1e')]);}return _0x483c97[_0xb80f('0x52')](_0x254979);}})[_0xb80f('0x25')](function(_0x44f82d){if(_0x44f82d){return _0x44f82d?{'count':_0x135082,'rows':_0x44f82d}:null;}})[_0xb80f('0x25')](respondWithResult(_0x1a94e6,null))['catch'](handleError(_0x1a94e6,null));};exports[_0xb80f('0x54')]=function(_0x15bfb5,_0x475084,_0x41e9b8){if(_0x15bfb5['body']['id']){delete _0x15bfb5['body']['id'];}return db[_0xb80f('0x2d')][_0xb80f('0x4c')]({'where':{'id':_0x15bfb5[_0xb80f('0x45')]['id']}})[_0xb80f('0x25')](handleEntityNotFound(_0x475084,null))[_0xb80f('0x25')](function(_0x3c618b){if(_0x3c618b){return _0x3c618b[_0xb80f('0x54')](_0x15bfb5[_0xb80f('0x4b')][_0xb80f('0x55')]||[]);}return null;})[_0xb80f('0x25')](respondWithResult(_0x475084,null))[_0xb80f('0x43')](handleError(_0x475084,null));};
\ No newline at end of file