Built motion from commit (unavailable).|2.5.15
[motion2.git] / server / api / intFreshdeskConfiguration / intFreshdeskConfiguration.controller.js
index 4f70273..1ea92e1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf112=['stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','FreshdeskConfiguration','count','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','options','find','create','body','findOne','FreshdeskField','sort','filters','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x532339,_0x23d0c3){var _0x4c6d6d=function(_0x1b5c22){while(--_0x1b5c22){_0x532339['push'](_0x532339['shift']());}};_0x4c6d6d(++_0x23d0c3);}(_0xf112,0x104));var _0x2f11=function(_0x2d36a6,_0x2f8cd0){_0x2d36a6=_0x2d36a6-0x0;var _0x59cec0=_0xf112[_0x2d36a6];return _0x59cec0;};'use strict';var pdf=require(_0x2f11('0x0'));var emlformat=require(_0x2f11('0x1'));var rimraf=require(_0x2f11('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2f11('0x3'));var rp=require(_0x2f11('0x4'));var moment=require(_0x2f11('0x5'));var BPromise=require(_0x2f11('0x6'));var Mustache=require(_0x2f11('0x7'));var util=require(_0x2f11('0x8'));var path=require(_0x2f11('0x9'));var sox=require(_0x2f11('0xa'));var csv=require(_0x2f11('0xb'));var ejs=require(_0x2f11('0xc'));var fs=require('fs');var _=require(_0x2f11('0xd'));var squel=require(_0x2f11('0xe'));var crypto=require('crypto');var jsforce=require(_0x2f11('0xf'));var deskjs=require(_0x2f11('0x10'));var toCsv=require(_0x2f11('0xb'));var querystring=require('querystring');var Papa=require(_0x2f11('0x11'));var Redis=require(_0x2f11('0x12'));var authService=require(_0x2f11('0x13'));var qs=require(_0x2f11('0x14'));var as=require(_0x2f11('0x15'));var hardwareService=require(_0x2f11('0x16'));var logger=require('../../config/logger')(_0x2f11('0x17'));var utils=require(_0x2f11('0x18'));var config=require(_0x2f11('0x19'));var licenseUtil=require(_0x2f11('0x1a'));var db=require(_0x2f11('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x2f11('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xd9d0bc,_0x55b549,_0x5e8dc4,_0x4eec96){return new BPromise(function(_0x575dbe,_0x51be78){var _0x588b66=_0x4eec96||client;return _0x588b66[_0x2f11('0x1d')](_0xd9d0bc,_0x5e8dc4)[_0x2f11('0x1e')](function(_0x4366fa){logger[_0x2f11('0x1f')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x55b549,'request\x20sent');logger['debug'](_0x2f11('0x20'),_0x55b549,_0x2f11('0x21'),JSON[_0x2f11('0x22')](_0x4366fa));if(_0x4366fa[_0x2f11('0x23')]){if(_0x4366fa[_0x2f11('0x23')]['code']===0x1f4){logger['error'](_0x2f11('0x24'),_0x55b549,_0x4366fa[_0x2f11('0x23')][_0x2f11('0x25')]);return _0x51be78(_0x4366fa[_0x2f11('0x23')][_0x2f11('0x25')]);}logger['error'](_0x2f11('0x24'),_0x55b549,_0x4366fa[_0x2f11('0x23')][_0x2f11('0x25')]);return _0x575dbe(_0x4366fa[_0x2f11('0x23')][_0x2f11('0x25')]);}else{logger['info'](_0x2f11('0x24'),_0x55b549,'request\x20sent');_0x575dbe(_0x4366fa[_0x2f11('0x26')][_0x2f11('0x25')]);}})['catch'](function(_0x5f2d7e){logger[_0x2f11('0x23')](_0x2f11('0x24'),_0x55b549,_0x5f2d7e);_0x51be78(_0x5f2d7e);});});}function respondWithStatusCode(_0x20241a,_0xb1c4a6){_0xb1c4a6=_0xb1c4a6||0xcc;return function(_0x485d0b){if(_0x485d0b){return _0x20241a[_0x2f11('0x27')](_0xb1c4a6);}return _0x20241a[_0x2f11('0x28')](_0xb1c4a6)[_0x2f11('0x29')]();};}function respondWithResult(_0x1250e4,_0x23ea68){_0x23ea68=_0x23ea68||0xc8;return function(_0x5748e1){if(_0x5748e1){return _0x1250e4['status'](_0x23ea68)[_0x2f11('0x2a')](_0x5748e1);}};}function respondWithFilteredResult(_0x4295c5,_0x4e4d7c){return function(_0x29fd78){if(_0x29fd78){var _0x3f0e7c=_0x29fd78['count'],_0x5b3b46=_0x4e4d7c['offset'],_0xeb51e6=_0x4e4d7c[_0x2f11('0x2b')]+_0x4e4d7c['limit'],_0x4cdea3;if(_0xeb51e6>=_0x3f0e7c){_0xeb51e6=_0x3f0e7c;_0x4cdea3=0xc8;}else{_0x4cdea3=0xce;}_0x4295c5[_0x2f11('0x28')](_0x4cdea3);return _0x4295c5[_0x2f11('0x2c')](_0x2f11('0x2d'),_0x5b3b46+'-'+_0xeb51e6+'/'+_0x3f0e7c)[_0x2f11('0x2a')](_0x29fd78);}return null;};}function patchUpdates(_0x58915f){return function(_0x4789f7){try{jsonpatch[_0x2f11('0x2e')](_0x4789f7,_0x58915f,!![]);}catch(_0x387b52){return BPromise[_0x2f11('0x2f')](_0x387b52);}return _0x4789f7[_0x2f11('0x30')]();};}function saveUpdates(_0x1fc51b,_0x5d0d3b){return function(_0x580b66){if(_0x580b66){return _0x580b66[_0x2f11('0x31')](_0x1fc51b)[_0x2f11('0x1e')](function(_0x44f6d8){return _0x44f6d8;});}return null;};}function removeEntity(_0x596596,_0x84978c){return function(_0x508f11){if(_0x508f11){return _0x508f11['destroy']()[_0x2f11('0x1e')](function(){_0x596596[_0x2f11('0x28')](0xcc)[_0x2f11('0x29')]();});}};}function handleEntityNotFound(_0x2129d7,_0x5a38b0){return function(_0x2385cd){if(!_0x2385cd){_0x2129d7['sendStatus'](0x194);}return _0x2385cd;};}function handleError(_0x1d4266,_0x369d2c){_0x369d2c=_0x369d2c||0x1f4;return function(_0x59824c){logger[_0x2f11('0x23')](_0x59824c[_0x2f11('0x32')]);if(_0x59824c[_0x2f11('0x33')]){delete _0x59824c[_0x2f11('0x33')];}_0x1d4266['status'](_0x369d2c)[_0x2f11('0x34')](_0x59824c);};}exports[_0x2f11('0x35')]=function(_0x1df4e0,_0x58fe7f){var _0x38aed3={},_0x350a2c={},_0x3f1124={'count':0x0,'rows':[]};var _0x595296=_[_0x2f11('0x36')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x29cd8a){return{'name':_0x29cd8a[_0x2f11('0x37')],'type':_0x29cd8a[_0x2f11('0x38')][_0x2f11('0x39')]};});_0x350a2c[_0x2f11('0x3a')]=_[_0x2f11('0x36')](_0x595296,'name');_0x350a2c[_0x2f11('0x3b')]=_[_0x2f11('0x3c')](_0x1df4e0['query']);_0x350a2c['filters']=_['intersection'](_0x350a2c[_0x2f11('0x3a')],_0x350a2c[_0x2f11('0x3b')]);_0x38aed3[_0x2f11('0x3d')]=_[_0x2f11('0x3e')](_0x350a2c[_0x2f11('0x3a')],qs['fields'](_0x1df4e0[_0x2f11('0x3b')][_0x2f11('0x3f')]));_0x38aed3[_0x2f11('0x3d')]=_0x38aed3[_0x2f11('0x3d')]['length']?_0x38aed3[_0x2f11('0x3d')]:_0x350a2c['model'];if(!_0x1df4e0[_0x2f11('0x3b')][_0x2f11('0x40')](_0x2f11('0x41'))){_0x38aed3[_0x2f11('0x42')]=qs['limit'](_0x1df4e0[_0x2f11('0x3b')][_0x2f11('0x42')]);_0x38aed3[_0x2f11('0x2b')]=qs[_0x2f11('0x2b')](_0x1df4e0[_0x2f11('0x3b')]['offset']);}_0x38aed3[_0x2f11('0x43')]=qs['sort'](_0x1df4e0[_0x2f11('0x3b')]['sort']);_0x38aed3[_0x2f11('0x44')]=qs['filters'](_[_0x2f11('0x45')](_0x1df4e0[_0x2f11('0x3b')],_0x350a2c['filters']),_0x595296);if(_0x1df4e0[_0x2f11('0x3b')][_0x2f11('0x46')]){_0x38aed3[_0x2f11('0x44')]=_[_0x2f11('0x47')](_0x38aed3[_0x2f11('0x44')],{'$or':_[_0x2f11('0x36')](_0x595296,function(_0xe4d6f3){if(_0xe4d6f3[_0x2f11('0x38')]!==_0x2f11('0x48')){var _0x3afdb5={};_0x3afdb5[_0xe4d6f3['name']]={'$like':'%'+_0x1df4e0[_0x2f11('0x3b')]['filter']+'%'};return _0x3afdb5;}})});}_0x38aed3=_[_0x2f11('0x47')]({},_0x38aed3,_0x1df4e0['options']);var _0x1961bb={'where':_0x38aed3[_0x2f11('0x44')]};return db[_0x2f11('0x49')][_0x2f11('0x4a')](_0x1961bb)[_0x2f11('0x1e')](function(_0x51897a){_0x3f1124['count']=_0x51897a;if(_0x1df4e0[_0x2f11('0x3b')][_0x2f11('0x4b')]){_0x38aed3['include']=[{'all':!![]}];}return db[_0x2f11('0x49')][_0x2f11('0x4c')](_0x38aed3);})[_0x2f11('0x1e')](function(_0x3a9cbc){_0x3f1124[_0x2f11('0x4d')]=_0x3a9cbc;return _0x3f1124;})[_0x2f11('0x1e')](respondWithFilteredResult(_0x58fe7f,_0x38aed3))[_0x2f11('0x4e')](handleError(_0x58fe7f,null));};exports[_0x2f11('0x4f')]=function(_0x18b78f,_0x36d517){var _0x39fbd3={'raw':![],'where':{'id':_0x18b78f[_0x2f11('0x50')]['id']}},_0x1de544={};_0x1de544[_0x2f11('0x3a')]=_[_0x2f11('0x3c')](db[_0x2f11('0x49')][_0x2f11('0x51')]);_0x1de544['query']=_[_0x2f11('0x3c')](_0x18b78f[_0x2f11('0x3b')]);_0x1de544['filters']=_[_0x2f11('0x3e')](_0x1de544['model'],_0x1de544[_0x2f11('0x3b')]);_0x39fbd3[_0x2f11('0x3d')]=_[_0x2f11('0x3e')](_0x1de544[_0x2f11('0x3a')],qs[_0x2f11('0x3f')](_0x18b78f[_0x2f11('0x3b')][_0x2f11('0x3f')]));_0x39fbd3[_0x2f11('0x3d')]=_0x39fbd3[_0x2f11('0x3d')][_0x2f11('0x52')]?_0x39fbd3[_0x2f11('0x3d')]:_0x1de544['model'];if(_0x18b78f[_0x2f11('0x3b')][_0x2f11('0x4b')]){_0x39fbd3[_0x2f11('0x53')]=[{'all':!![]}];}_0x39fbd3=_[_0x2f11('0x47')]({},_0x39fbd3,_0x18b78f[_0x2f11('0x54')]);return db[_0x2f11('0x49')][_0x2f11('0x55')](_0x39fbd3)[_0x2f11('0x1e')](handleEntityNotFound(_0x36d517,null))[_0x2f11('0x1e')](respondWithResult(_0x36d517,null))[_0x2f11('0x4e')](handleError(_0x36d517,null));};exports[_0x2f11('0x56')]=function(_0x4a2396,_0x2738f3){return db['FreshdeskConfiguration'][_0x2f11('0x56')](_0x4a2396[_0x2f11('0x57')],{})[_0x2f11('0x1e')](respondWithResult(_0x2738f3,0xc9))[_0x2f11('0x4e')](handleError(_0x2738f3,null));};exports[_0x2f11('0x31')]=function(_0x580c58,_0x5de747){if(_0x580c58[_0x2f11('0x57')]['id']){delete _0x580c58[_0x2f11('0x57')]['id'];}return db[_0x2f11('0x49')][_0x2f11('0x55')]({'where':{'id':_0x580c58['params']['id']}})['then'](handleEntityNotFound(_0x5de747,null))[_0x2f11('0x1e')](saveUpdates(_0x580c58['body'],null))[_0x2f11('0x1e')](respondWithResult(_0x5de747,null))[_0x2f11('0x4e')](handleError(_0x5de747,null));};exports['destroy']=function(_0x1b8303,_0x2d13d6){return db[_0x2f11('0x49')][_0x2f11('0x55')]({'where':{'id':_0x1b8303[_0x2f11('0x50')]['id']}})[_0x2f11('0x1e')](handleEntityNotFound(_0x2d13d6,null))[_0x2f11('0x1e')](removeEntity(_0x2d13d6,null))[_0x2f11('0x4e')](handleError(_0x2d13d6,null));};exports['getFields']=function(_0x504959,_0x4eac35,_0x1911de){var _0x37f463={};var _0x9b609b={};var _0x4b5049;var _0x337a7c;return db[_0x2f11('0x49')][_0x2f11('0x58')]({'where':{'id':_0x504959[_0x2f11('0x50')]['id']}})[_0x2f11('0x1e')](handleEntityNotFound(_0x4eac35,null))[_0x2f11('0x1e')](function(_0x487cbc){if(_0x487cbc){_0x4b5049=_0x487cbc;_0x9b609b[_0x2f11('0x3a')]=_[_0x2f11('0x3c')](db[_0x2f11('0x59')][_0x2f11('0x51')]);_0x9b609b[_0x2f11('0x3b')]=_[_0x2f11('0x3c')](_0x504959[_0x2f11('0x3b')]);_0x9b609b['filters']=_[_0x2f11('0x3e')](_0x9b609b['model'],_0x9b609b['query']);_0x37f463[_0x2f11('0x3d')]=_[_0x2f11('0x3e')](_0x9b609b['model'],qs[_0x2f11('0x3f')](_0x504959[_0x2f11('0x3b')]['fields']));_0x37f463[_0x2f11('0x3d')]=_0x37f463[_0x2f11('0x3d')][_0x2f11('0x52')]?_0x37f463[_0x2f11('0x3d')]:_0x9b609b[_0x2f11('0x3a')];_0x37f463['order']=qs['sort'](_0x504959['query'][_0x2f11('0x5a')]);_0x37f463[_0x2f11('0x44')]=qs[_0x2f11('0x5b')](_[_0x2f11('0x45')](_0x504959[_0x2f11('0x3b')],_0x9b609b[_0x2f11('0x5b')]));if(_0x504959[_0x2f11('0x3b')][_0x2f11('0x46')]){_0x37f463[_0x2f11('0x44')]=_[_0x2f11('0x47')](_0x37f463[_0x2f11('0x44')],{'$or':_[_0x2f11('0x36')](_0x37f463[_0x2f11('0x3d')],function(_0xd91a37){var _0x459e3c={};_0x459e3c[_0xd91a37]={'$like':'%'+_0x504959[_0x2f11('0x3b')][_0x2f11('0x46')]+'%'};return _0x459e3c;})});}_0x37f463=_[_0x2f11('0x47')]({},_0x37f463,_0x504959[_0x2f11('0x54')]);return _0x4b5049[_0x2f11('0x5c')](_0x37f463);}})[_0x2f11('0x1e')](function(_0x2ddfc2){if(_0x2ddfc2){_0x337a7c=_0x2ddfc2[_0x2f11('0x52')];if(!_0x504959[_0x2f11('0x3b')][_0x2f11('0x40')](_0x2f11('0x41'))){_0x37f463[_0x2f11('0x42')]=qs[_0x2f11('0x42')](_0x504959[_0x2f11('0x3b')]['limit']);_0x37f463['offset']=qs[_0x2f11('0x2b')](_0x504959['query'][_0x2f11('0x2b')]);}return _0x4b5049['getFields'](_0x37f463);}})[_0x2f11('0x1e')](function(_0x59a15a){if(_0x59a15a){return _0x59a15a?{'count':_0x337a7c,'rows':_0x59a15a}:null;}})[_0x2f11('0x1e')](respondWithResult(_0x4eac35,null))['catch'](handleError(_0x4eac35,null));};exports['getSubjects']=function(_0x3dd825,_0x3ba62d,_0x55899f){var _0x5ea6ba={};var _0x5d95cc={};var _0x48648e;var _0x5eebf1;return db[_0x2f11('0x49')][_0x2f11('0x58')]({'where':{'id':_0x3dd825[_0x2f11('0x50')]['id']}})[_0x2f11('0x1e')](handleEntityNotFound(_0x3ba62d,null))['then'](function(_0x21386c){if(_0x21386c){_0x48648e=_0x21386c;_0x5d95cc[_0x2f11('0x3a')]=_['keys'](db[_0x2f11('0x59')][_0x2f11('0x51')]);_0x5d95cc[_0x2f11('0x3b')]=_['keys'](_0x3dd825[_0x2f11('0x3b')]);_0x5d95cc[_0x2f11('0x5b')]=_['intersection'](_0x5d95cc['model'],_0x5d95cc[_0x2f11('0x3b')]);_0x5ea6ba[_0x2f11('0x3d')]=_[_0x2f11('0x3e')](_0x5d95cc[_0x2f11('0x3a')],qs['fields'](_0x3dd825['query']['fields']));_0x5ea6ba[_0x2f11('0x3d')]=_0x5ea6ba[_0x2f11('0x3d')]['length']?_0x5ea6ba[_0x2f11('0x3d')]:_0x5d95cc[_0x2f11('0x3a')];_0x5ea6ba['order']=qs[_0x2f11('0x5a')](_0x3dd825['query'][_0x2f11('0x5a')]);_0x5ea6ba[_0x2f11('0x44')]=qs[_0x2f11('0x5b')](_[_0x2f11('0x45')](_0x3dd825[_0x2f11('0x3b')],_0x5d95cc['filters']));if(_0x3dd825[_0x2f11('0x3b')]['filter']){_0x5ea6ba[_0x2f11('0x44')]=_[_0x2f11('0x47')](_0x5ea6ba[_0x2f11('0x44')],{'$or':_[_0x2f11('0x36')](_0x5ea6ba[_0x2f11('0x3d')],function(_0x596152){var _0x3f60a1={};_0x3f60a1[_0x596152]={'$like':'%'+_0x3dd825['query']['filter']+'%'};return _0x3f60a1;})});}_0x5ea6ba=_[_0x2f11('0x47')]({},_0x5ea6ba,_0x3dd825[_0x2f11('0x54')]);return _0x48648e[_0x2f11('0x5d')](_0x5ea6ba);}})[_0x2f11('0x1e')](function(_0x3f64c7){if(_0x3f64c7){_0x5eebf1=_0x3f64c7[_0x2f11('0x52')];if(!_0x3dd825[_0x2f11('0x3b')][_0x2f11('0x40')]('nolimit')){_0x5ea6ba[_0x2f11('0x42')]=qs[_0x2f11('0x42')](_0x3dd825[_0x2f11('0x3b')][_0x2f11('0x42')]);_0x5ea6ba['offset']=qs['offset'](_0x3dd825[_0x2f11('0x3b')][_0x2f11('0x2b')]);}return _0x48648e[_0x2f11('0x5d')](_0x5ea6ba);}})[_0x2f11('0x1e')](function(_0x423167){if(_0x423167){return _0x423167?{'count':_0x5eebf1,'rows':_0x423167}:null;}})[_0x2f11('0x1e')](respondWithResult(_0x3ba62d,null))[_0x2f11('0x4e')](handleError(_0x3ba62d,null));};exports['getDescriptions']=function(_0xa0cd17,_0x31bd68,_0x77a44f){var _0x3b6f07={};var _0x19d50a={};var _0x5b0a89;var _0x4a0397;return db[_0x2f11('0x49')][_0x2f11('0x58')]({'where':{'id':_0xa0cd17['params']['id']}})[_0x2f11('0x1e')](handleEntityNotFound(_0x31bd68,null))[_0x2f11('0x1e')](function(_0x5076e5){if(_0x5076e5){_0x5b0a89=_0x5076e5;_0x19d50a[_0x2f11('0x3a')]=_[_0x2f11('0x3c')](db[_0x2f11('0x59')][_0x2f11('0x51')]);_0x19d50a['query']=_[_0x2f11('0x3c')](_0xa0cd17['query']);_0x19d50a[_0x2f11('0x5b')]=_[_0x2f11('0x3e')](_0x19d50a['model'],_0x19d50a['query']);_0x3b6f07[_0x2f11('0x3d')]=_['intersection'](_0x19d50a[_0x2f11('0x3a')],qs[_0x2f11('0x3f')](_0xa0cd17[_0x2f11('0x3b')][_0x2f11('0x3f')]));_0x3b6f07[_0x2f11('0x3d')]=_0x3b6f07[_0x2f11('0x3d')][_0x2f11('0x52')]?_0x3b6f07[_0x2f11('0x3d')]:_0x19d50a[_0x2f11('0x3a')];_0x3b6f07[_0x2f11('0x43')]=qs[_0x2f11('0x5a')](_0xa0cd17[_0x2f11('0x3b')][_0x2f11('0x5a')]);_0x3b6f07[_0x2f11('0x44')]=qs['filters'](_[_0x2f11('0x45')](_0xa0cd17['query'],_0x19d50a['filters']));if(_0xa0cd17[_0x2f11('0x3b')][_0x2f11('0x46')]){_0x3b6f07[_0x2f11('0x44')]=_['merge'](_0x3b6f07[_0x2f11('0x44')],{'$or':_[_0x2f11('0x36')](_0x3b6f07[_0x2f11('0x3d')],function(_0x467b25){var _0x414e0c={};_0x414e0c[_0x467b25]={'$like':'%'+_0xa0cd17[_0x2f11('0x3b')][_0x2f11('0x46')]+'%'};return _0x414e0c;})});}_0x3b6f07=_[_0x2f11('0x47')]({},_0x3b6f07,_0xa0cd17[_0x2f11('0x54')]);return _0x5b0a89[_0x2f11('0x5e')](_0x3b6f07);}})[_0x2f11('0x1e')](function(_0x2fce1f){if(_0x2fce1f){_0x4a0397=_0x2fce1f[_0x2f11('0x52')];if(!_0xa0cd17[_0x2f11('0x3b')][_0x2f11('0x40')](_0x2f11('0x41'))){_0x3b6f07[_0x2f11('0x42')]=qs['limit'](_0xa0cd17[_0x2f11('0x3b')][_0x2f11('0x42')]);_0x3b6f07['offset']=qs[_0x2f11('0x2b')](_0xa0cd17['query'][_0x2f11('0x2b')]);}return _0x5b0a89['getDescriptions'](_0x3b6f07);}})[_0x2f11('0x1e')](function(_0x46c589){if(_0x46c589){return _0x46c589?{'count':_0x4a0397,'rows':_0x46c589}:null;}})['then'](respondWithResult(_0x31bd68,null))[_0x2f11('0x4e')](handleError(_0x31bd68,null));};exports[_0x2f11('0x5f')]=function(_0x5a5f20,_0x3070e6,_0x522b7c){var _0x237fd8={};var _0x1f6ffe={};var _0x56e152;var _0x5ee177;return db[_0x2f11('0x49')][_0x2f11('0x58')]({'where':{'id':_0x5a5f20[_0x2f11('0x50')]['id']}})[_0x2f11('0x1e')](handleEntityNotFound(_0x3070e6,null))[_0x2f11('0x1e')](function(_0x1cd1da){if(_0x1cd1da){_0x56e152=_0x1cd1da;_0x1f6ffe[_0x2f11('0x3a')]=_['keys'](db[_0x2f11('0x60')][_0x2f11('0x51')]);_0x1f6ffe[_0x2f11('0x3b')]=_['keys'](_0x5a5f20[_0x2f11('0x3b')]);_0x1f6ffe[_0x2f11('0x5b')]=_[_0x2f11('0x3e')](_0x1f6ffe['model'],_0x1f6ffe[_0x2f11('0x3b')]);_0x237fd8[_0x2f11('0x3d')]=_[_0x2f11('0x3e')](_0x1f6ffe['model'],qs[_0x2f11('0x3f')](_0x5a5f20[_0x2f11('0x3b')][_0x2f11('0x3f')]));_0x237fd8[_0x2f11('0x3d')]=_0x237fd8[_0x2f11('0x3d')][_0x2f11('0x52')]?_0x237fd8['attributes']:_0x1f6ffe[_0x2f11('0x3a')];_0x237fd8[_0x2f11('0x43')]=qs[_0x2f11('0x5a')](_0x5a5f20[_0x2f11('0x3b')]['sort']);_0x237fd8[_0x2f11('0x44')]=qs['filters'](_[_0x2f11('0x45')](_0x5a5f20[_0x2f11('0x3b')],_0x1f6ffe[_0x2f11('0x5b')]));if(_0x5a5f20['query']['filter']){_0x237fd8[_0x2f11('0x44')]=_[_0x2f11('0x47')](_0x237fd8[_0x2f11('0x44')],{'$or':_[_0x2f11('0x36')](_0x237fd8[_0x2f11('0x3d')],function(_0xeef2f7){var _0x357663={};_0x357663[_0xeef2f7]={'$like':'%'+_0x5a5f20[_0x2f11('0x3b')][_0x2f11('0x46')]+'%'};return _0x357663;})});}_0x237fd8=_[_0x2f11('0x47')]({},_0x237fd8,_0x5a5f20[_0x2f11('0x54')]);return _0x56e152[_0x2f11('0x5f')](_0x237fd8);}})[_0x2f11('0x1e')](function(_0x3d6258){if(_0x3d6258){_0x5ee177=_0x3d6258[_0x2f11('0x52')];if(!_0x5a5f20[_0x2f11('0x3b')][_0x2f11('0x40')](_0x2f11('0x41'))){_0x237fd8[_0x2f11('0x42')]=qs[_0x2f11('0x42')](_0x5a5f20[_0x2f11('0x3b')][_0x2f11('0x42')]);_0x237fd8['offset']=qs['offset'](_0x5a5f20[_0x2f11('0x3b')][_0x2f11('0x2b')]);}return _0x56e152[_0x2f11('0x5f')](_0x237fd8);}})[_0x2f11('0x1e')](function(_0x2df926){if(_0x2df926){return _0x2df926?{'count':_0x5ee177,'rows':_0x2df926}:null;}})[_0x2f11('0x1e')](respondWithResult(_0x3070e6,null))[_0x2f11('0x4e')](handleError(_0x3070e6,null));};exports[_0x2f11('0x61')]=function(_0x7cff20,_0x35cb6b,_0x3a26a0){if(_0x7cff20['body']['id']){delete _0x7cff20[_0x2f11('0x57')]['id'];}return db[_0x2f11('0x49')][_0x2f11('0x58')]({'where':{'id':_0x7cff20[_0x2f11('0x50')]['id']}})[_0x2f11('0x1e')](handleEntityNotFound(_0x35cb6b,null))[_0x2f11('0x1e')](function(_0xc8f67e){if(_0xc8f67e){return _0xc8f67e[_0x2f11('0x61')](_0x7cff20[_0x2f11('0x57')]['ids']||[]);}return null;})[_0x2f11('0x1e')](respondWithResult(_0x35cb6b,null))[_0x2f11('0x4e')](handleError(_0x35cb6b,null));};
\ No newline at end of file
+var _0x1a97=['FreshdeskConfiguration','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','where','merge','options','includeAll','include','findAll','show','find','create','body','params','getFields','FreshdeskField','filter','hasOwnProperty','getSubjects','getDescriptions','findOne','getTags','Tag','setTags','ids','html-pdf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','end','name','send','index','map'];(function(_0xdad237,_0x361a1d){var _0x15c575=function(_0x8db2f6){while(--_0x8db2f6){_0xdad237['push'](_0xdad237['shift']());}};_0x15c575(++_0x361a1d);}(_0x1a97,0x1de));var _0x71a9=function(_0x4191af,_0x5783da){_0x4191af=_0x4191af-0x0;var _0x27bebf=_0x1a97[_0x4191af];return _0x27bebf;};'use strict';var pdf=require(_0x71a9('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x71a9('0x1'));var rp=require(_0x71a9('0x2'));var moment=require(_0x71a9('0x3'));var BPromise=require(_0x71a9('0x4'));var Mustache=require('mustache');var util=require(_0x71a9('0x5'));var path=require(_0x71a9('0x6'));var sox=require('sox');var csv=require(_0x71a9('0x7'));var ejs=require(_0x71a9('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x71a9('0x9'));var crypto=require(_0x71a9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x71a9('0xb'));var toCsv=require(_0x71a9('0x7'));var querystring=require(_0x71a9('0xc'));var Papa=require('papaparse');var Redis=require(_0x71a9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x71a9('0xe'));var as=require(_0x71a9('0xf'));var hardwareService=require(_0x71a9('0x10'));var logger=require(_0x71a9('0x11'))('api');var utils=require(_0x71a9('0x12'));var config=require(_0x71a9('0x13'));var licenseUtil=require(_0x71a9('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0x71a9('0x15'));var client=jayson[_0x71a9('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e3093,_0x4f0a0b,_0x34adee,_0x5f3487){return new BPromise(function(_0x4c0d5c,_0x1e66b6){var _0x385a2b=_0x5f3487||client;return _0x385a2b[_0x71a9('0x17')](_0x1e3093,_0x34adee)[_0x71a9('0x18')](function(_0x4b206a){logger[_0x71a9('0x19')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4f0a0b,_0x71a9('0x1a'));logger[_0x71a9('0x1b')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4f0a0b,_0x71a9('0x1a'),JSON[_0x71a9('0x1c')](_0x4b206a));if(_0x4b206a[_0x71a9('0x1d')]){if(_0x4b206a[_0x71a9('0x1d')][_0x71a9('0x1e')]===0x1f4){logger[_0x71a9('0x1d')](_0x71a9('0x1f'),_0x4f0a0b,_0x4b206a[_0x71a9('0x1d')][_0x71a9('0x20')]);return _0x1e66b6(_0x4b206a['error'][_0x71a9('0x20')]);}logger[_0x71a9('0x1d')](_0x71a9('0x1f'),_0x4f0a0b,_0x4b206a[_0x71a9('0x1d')]['message']);return _0x4c0d5c(_0x4b206a['error'][_0x71a9('0x20')]);}else{logger[_0x71a9('0x19')](_0x71a9('0x1f'),_0x4f0a0b,'request\x20sent');_0x4c0d5c(_0x4b206a['result'][_0x71a9('0x20')]);}})[_0x71a9('0x21')](function(_0x3926d8){logger[_0x71a9('0x1d')](_0x71a9('0x1f'),_0x4f0a0b,_0x3926d8);_0x1e66b6(_0x3926d8);});});}function respondWithStatusCode(_0x53ff0f,_0x5e4535){_0x5e4535=_0x5e4535||0xcc;return function(_0x4fde4a){if(_0x4fde4a){return _0x53ff0f[_0x71a9('0x22')](_0x5e4535);}return _0x53ff0f[_0x71a9('0x23')](_0x5e4535)['end']();};}function respondWithResult(_0x503f44,_0x2d9f4a){_0x2d9f4a=_0x2d9f4a||0xc8;return function(_0x40feec){if(_0x40feec){return _0x503f44[_0x71a9('0x23')](_0x2d9f4a)[_0x71a9('0x24')](_0x40feec);}};}function respondWithFilteredResult(_0x21b410,_0x5498ab){return function(_0x1b35cc){if(_0x1b35cc){var _0x47e9b3=_0x1b35cc[_0x71a9('0x25')],_0x1866d4=_0x5498ab[_0x71a9('0x26')],_0x1cddae=_0x5498ab[_0x71a9('0x26')]+_0x5498ab[_0x71a9('0x27')],_0x57eb18;if(_0x1cddae>=_0x47e9b3){_0x1cddae=_0x47e9b3;_0x57eb18=0xc8;}else{_0x57eb18=0xce;}_0x21b410[_0x71a9('0x23')](_0x57eb18);return _0x21b410[_0x71a9('0x28')](_0x71a9('0x29'),_0x1866d4+'-'+_0x1cddae+'/'+_0x47e9b3)[_0x71a9('0x24')](_0x1b35cc);}return null;};}function patchUpdates(_0x14740b){return function(_0x4b3900){try{jsonpatch[_0x71a9('0x2a')](_0x4b3900,_0x14740b,!![]);}catch(_0x1cfe5d){return BPromise['reject'](_0x1cfe5d);}return _0x4b3900['save']();};}function saveUpdates(_0x5c7cc4,_0x457a40){return function(_0x298b77){if(_0x298b77){return _0x298b77[_0x71a9('0x2b')](_0x5c7cc4)[_0x71a9('0x18')](function(_0x19b340){return _0x19b340;});}return null;};}function removeEntity(_0xc3905f,_0x580fb1){return function(_0xa5edd9){if(_0xa5edd9){return _0xa5edd9[_0x71a9('0x2c')]()[_0x71a9('0x18')](function(){_0xc3905f[_0x71a9('0x23')](0xcc)[_0x71a9('0x2d')]();});}};}function handleEntityNotFound(_0x576134,_0x1ad4c9){return function(_0x4ba3bb){if(!_0x4ba3bb){_0x576134[_0x71a9('0x22')](0x194);}return _0x4ba3bb;};}function handleError(_0x277e3e,_0x269835){_0x269835=_0x269835||0x1f4;return function(_0x3ee117){logger[_0x71a9('0x1d')](_0x3ee117['stack']);if(_0x3ee117[_0x71a9('0x2e')]){delete _0x3ee117[_0x71a9('0x2e')];}_0x277e3e[_0x71a9('0x23')](_0x269835)[_0x71a9('0x2f')](_0x3ee117);};}exports[_0x71a9('0x30')]=function(_0x3cedc1,_0x3d9167){var _0x5b2faf={},_0x381ac8={},_0x1969cd={'count':0x0,'rows':[]};var _0x1ca172=_[_0x71a9('0x31')](db[_0x71a9('0x32')][_0x71a9('0x33')],function(_0x5d1466){return{'name':_0x5d1466['fieldName'],'type':_0x5d1466[_0x71a9('0x34')][_0x71a9('0x35')]};});_0x381ac8[_0x71a9('0x36')]=_['map'](_0x1ca172,_0x71a9('0x2e'));_0x381ac8[_0x71a9('0x37')]=_[_0x71a9('0x38')](_0x3cedc1['query']);_0x381ac8['filters']=_[_0x71a9('0x39')](_0x381ac8['model'],_0x381ac8['query']);_0x5b2faf[_0x71a9('0x3a')]=_['intersection'](_0x381ac8[_0x71a9('0x36')],qs[_0x71a9('0x3b')](_0x3cedc1[_0x71a9('0x37')][_0x71a9('0x3b')]));_0x5b2faf[_0x71a9('0x3a')]=_0x5b2faf['attributes'][_0x71a9('0x3c')]?_0x5b2faf['attributes']:_0x381ac8['model'];if(!_0x3cedc1[_0x71a9('0x37')]['hasOwnProperty'](_0x71a9('0x3d'))){_0x5b2faf[_0x71a9('0x27')]=qs[_0x71a9('0x27')](_0x3cedc1[_0x71a9('0x37')][_0x71a9('0x27')]);_0x5b2faf[_0x71a9('0x26')]=qs[_0x71a9('0x26')](_0x3cedc1[_0x71a9('0x37')]['offset']);}_0x5b2faf[_0x71a9('0x3e')]=qs[_0x71a9('0x3f')](_0x3cedc1[_0x71a9('0x37')]['sort']);_0x5b2faf['where']=qs[_0x71a9('0x40')](_[_0x71a9('0x41')](_0x3cedc1['query'],_0x381ac8['filters']),_0x1ca172);if(_0x3cedc1[_0x71a9('0x37')]['filter']){_0x5b2faf[_0x71a9('0x42')]=_[_0x71a9('0x43')](_0x5b2faf[_0x71a9('0x42')],{'$or':_['map'](_0x1ca172,function(_0xad8ba9){if(_0xad8ba9['type']!=='VIRTUAL'){var _0xdd4e47={};_0xdd4e47[_0xad8ba9[_0x71a9('0x2e')]]={'$like':'%'+_0x3cedc1['query']['filter']+'%'};return _0xdd4e47;}})});}_0x5b2faf=_[_0x71a9('0x43')]({},_0x5b2faf,_0x3cedc1[_0x71a9('0x44')]);var _0x2829b1={'where':_0x5b2faf[_0x71a9('0x42')]};return db[_0x71a9('0x32')][_0x71a9('0x25')](_0x2829b1)[_0x71a9('0x18')](function(_0x26b8a3){_0x1969cd[_0x71a9('0x25')]=_0x26b8a3;if(_0x3cedc1[_0x71a9('0x37')][_0x71a9('0x45')]){_0x5b2faf[_0x71a9('0x46')]=[{'all':!![]}];}return db[_0x71a9('0x32')][_0x71a9('0x47')](_0x5b2faf);})['then'](function(_0x2633b2){_0x1969cd['rows']=_0x2633b2;return _0x1969cd;})[_0x71a9('0x18')](respondWithFilteredResult(_0x3d9167,_0x5b2faf))[_0x71a9('0x21')](handleError(_0x3d9167,null));};exports[_0x71a9('0x48')]=function(_0x5a2815,_0x3141b8){var _0x14c78b={'raw':![],'where':{'id':_0x5a2815['params']['id']}},_0x21f292={};_0x21f292['model']=_['keys'](db['FreshdeskConfiguration'][_0x71a9('0x33')]);_0x21f292['query']=_[_0x71a9('0x38')](_0x5a2815['query']);_0x21f292[_0x71a9('0x40')]=_[_0x71a9('0x39')](_0x21f292[_0x71a9('0x36')],_0x21f292[_0x71a9('0x37')]);_0x14c78b[_0x71a9('0x3a')]=_[_0x71a9('0x39')](_0x21f292[_0x71a9('0x36')],qs['fields'](_0x5a2815['query']['fields']));_0x14c78b[_0x71a9('0x3a')]=_0x14c78b[_0x71a9('0x3a')][_0x71a9('0x3c')]?_0x14c78b[_0x71a9('0x3a')]:_0x21f292['model'];if(_0x5a2815[_0x71a9('0x37')][_0x71a9('0x45')]){_0x14c78b[_0x71a9('0x46')]=[{'all':!![]}];}_0x14c78b=_[_0x71a9('0x43')]({},_0x14c78b,_0x5a2815['options']);return db[_0x71a9('0x32')][_0x71a9('0x49')](_0x14c78b)[_0x71a9('0x18')](handleEntityNotFound(_0x3141b8,null))[_0x71a9('0x18')](respondWithResult(_0x3141b8,null))[_0x71a9('0x21')](handleError(_0x3141b8,null));};exports['create']=function(_0x31e395,_0x539b03){return db[_0x71a9('0x32')][_0x71a9('0x4a')](_0x31e395[_0x71a9('0x4b')],{})[_0x71a9('0x18')](respondWithResult(_0x539b03,0xc9))[_0x71a9('0x21')](handleError(_0x539b03,null));};exports[_0x71a9('0x2b')]=function(_0x4cd5f4,_0x26fbb9){if(_0x4cd5f4[_0x71a9('0x4b')]['id']){delete _0x4cd5f4['body']['id'];}return db[_0x71a9('0x32')]['find']({'where':{'id':_0x4cd5f4[_0x71a9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x26fbb9,null))[_0x71a9('0x18')](saveUpdates(_0x4cd5f4[_0x71a9('0x4b')],null))[_0x71a9('0x18')](respondWithResult(_0x26fbb9,null))['catch'](handleError(_0x26fbb9,null));};exports[_0x71a9('0x2c')]=function(_0x452199,_0x37f8e1){return db[_0x71a9('0x32')]['find']({'where':{'id':_0x452199['params']['id']}})['then'](handleEntityNotFound(_0x37f8e1,null))[_0x71a9('0x18')](removeEntity(_0x37f8e1,null))['catch'](handleError(_0x37f8e1,null));};exports[_0x71a9('0x4d')]=function(_0x257d99,_0x1a9ca0,_0x93821d){var _0x4a51b9={};var _0xf3db7d={};var _0x465dcf;var _0x5ed86a;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x257d99[_0x71a9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1a9ca0,null))[_0x71a9('0x18')](function(_0x46a7c3){if(_0x46a7c3){_0x465dcf=_0x46a7c3;_0xf3db7d['model']=_['keys'](db[_0x71a9('0x4e')][_0x71a9('0x33')]);_0xf3db7d['query']=_[_0x71a9('0x38')](_0x257d99[_0x71a9('0x37')]);_0xf3db7d[_0x71a9('0x40')]=_['intersection'](_0xf3db7d[_0x71a9('0x36')],_0xf3db7d[_0x71a9('0x37')]);_0x4a51b9[_0x71a9('0x3a')]=_['intersection'](_0xf3db7d[_0x71a9('0x36')],qs['fields'](_0x257d99[_0x71a9('0x37')][_0x71a9('0x3b')]));_0x4a51b9[_0x71a9('0x3a')]=_0x4a51b9[_0x71a9('0x3a')][_0x71a9('0x3c')]?_0x4a51b9[_0x71a9('0x3a')]:_0xf3db7d[_0x71a9('0x36')];_0x4a51b9[_0x71a9('0x3e')]=qs[_0x71a9('0x3f')](_0x257d99['query'][_0x71a9('0x3f')]);_0x4a51b9[_0x71a9('0x42')]=qs[_0x71a9('0x40')](_[_0x71a9('0x41')](_0x257d99['query'],_0xf3db7d[_0x71a9('0x40')]));if(_0x257d99['query'][_0x71a9('0x4f')]){_0x4a51b9[_0x71a9('0x42')]=_[_0x71a9('0x43')](_0x4a51b9[_0x71a9('0x42')],{'$or':_[_0x71a9('0x31')](_0x4a51b9[_0x71a9('0x3a')],function(_0x21a3db){var _0x90649={};_0x90649[_0x21a3db]={'$like':'%'+_0x257d99['query'][_0x71a9('0x4f')]+'%'};return _0x90649;})});}_0x4a51b9=_[_0x71a9('0x43')]({},_0x4a51b9,_0x257d99['options']);return _0x465dcf[_0x71a9('0x4d')](_0x4a51b9);}})['then'](function(_0x574d01){if(_0x574d01){_0x5ed86a=_0x574d01['length'];if(!_0x257d99[_0x71a9('0x37')][_0x71a9('0x50')](_0x71a9('0x3d'))){_0x4a51b9[_0x71a9('0x27')]=qs[_0x71a9('0x27')](_0x257d99['query']['limit']);_0x4a51b9['offset']=qs[_0x71a9('0x26')](_0x257d99[_0x71a9('0x37')][_0x71a9('0x26')]);}return _0x465dcf[_0x71a9('0x4d')](_0x4a51b9);}})[_0x71a9('0x18')](function(_0x1f0e8f){if(_0x1f0e8f){return _0x1f0e8f?{'count':_0x5ed86a,'rows':_0x1f0e8f}:null;}})['then'](respondWithResult(_0x1a9ca0,null))[_0x71a9('0x21')](handleError(_0x1a9ca0,null));};exports[_0x71a9('0x51')]=function(_0x3171e9,_0x387b5e,_0x1cf55c){var _0x760ef8={};var _0x2db74b={};var _0x2e265c;var _0x2da60e;return db[_0x71a9('0x32')]['findOne']({'where':{'id':_0x3171e9[_0x71a9('0x4c')]['id']}})[_0x71a9('0x18')](handleEntityNotFound(_0x387b5e,null))[_0x71a9('0x18')](function(_0x1edfdc){if(_0x1edfdc){_0x2e265c=_0x1edfdc;_0x2db74b[_0x71a9('0x36')]=_['keys'](db[_0x71a9('0x4e')][_0x71a9('0x33')]);_0x2db74b[_0x71a9('0x37')]=_[_0x71a9('0x38')](_0x3171e9['query']);_0x2db74b[_0x71a9('0x40')]=_[_0x71a9('0x39')](_0x2db74b['model'],_0x2db74b[_0x71a9('0x37')]);_0x760ef8[_0x71a9('0x3a')]=_[_0x71a9('0x39')](_0x2db74b[_0x71a9('0x36')],qs['fields'](_0x3171e9[_0x71a9('0x37')][_0x71a9('0x3b')]));_0x760ef8[_0x71a9('0x3a')]=_0x760ef8[_0x71a9('0x3a')][_0x71a9('0x3c')]?_0x760ef8['attributes']:_0x2db74b['model'];_0x760ef8[_0x71a9('0x3e')]=qs[_0x71a9('0x3f')](_0x3171e9[_0x71a9('0x37')][_0x71a9('0x3f')]);_0x760ef8['where']=qs[_0x71a9('0x40')](_[_0x71a9('0x41')](_0x3171e9[_0x71a9('0x37')],_0x2db74b['filters']));if(_0x3171e9[_0x71a9('0x37')][_0x71a9('0x4f')]){_0x760ef8['where']=_[_0x71a9('0x43')](_0x760ef8[_0x71a9('0x42')],{'$or':_[_0x71a9('0x31')](_0x760ef8[_0x71a9('0x3a')],function(_0x4fa2a1){var _0x4aa4bb={};_0x4aa4bb[_0x4fa2a1]={'$like':'%'+_0x3171e9[_0x71a9('0x37')][_0x71a9('0x4f')]+'%'};return _0x4aa4bb;})});}_0x760ef8=_[_0x71a9('0x43')]({},_0x760ef8,_0x3171e9[_0x71a9('0x44')]);return _0x2e265c[_0x71a9('0x51')](_0x760ef8);}})['then'](function(_0x6f12aa){if(_0x6f12aa){_0x2da60e=_0x6f12aa[_0x71a9('0x3c')];if(!_0x3171e9[_0x71a9('0x37')][_0x71a9('0x50')](_0x71a9('0x3d'))){_0x760ef8[_0x71a9('0x27')]=qs[_0x71a9('0x27')](_0x3171e9[_0x71a9('0x37')][_0x71a9('0x27')]);_0x760ef8[_0x71a9('0x26')]=qs[_0x71a9('0x26')](_0x3171e9['query']['offset']);}return _0x2e265c[_0x71a9('0x51')](_0x760ef8);}})[_0x71a9('0x18')](function(_0xf5732){if(_0xf5732){return _0xf5732?{'count':_0x2da60e,'rows':_0xf5732}:null;}})[_0x71a9('0x18')](respondWithResult(_0x387b5e,null))[_0x71a9('0x21')](handleError(_0x387b5e,null));};exports[_0x71a9('0x52')]=function(_0xe1dd9e,_0x3c3023,_0x4ff058){var _0x79ab88={};var _0x44056f={};var _0xfabb00;var _0x4b36b0;return db['FreshdeskConfiguration'][_0x71a9('0x53')]({'where':{'id':_0xe1dd9e['params']['id']}})[_0x71a9('0x18')](handleEntityNotFound(_0x3c3023,null))[_0x71a9('0x18')](function(_0xff60fd){if(_0xff60fd){_0xfabb00=_0xff60fd;_0x44056f['model']=_[_0x71a9('0x38')](db[_0x71a9('0x4e')][_0x71a9('0x33')]);_0x44056f['query']=_[_0x71a9('0x38')](_0xe1dd9e[_0x71a9('0x37')]);_0x44056f[_0x71a9('0x40')]=_[_0x71a9('0x39')](_0x44056f[_0x71a9('0x36')],_0x44056f[_0x71a9('0x37')]);_0x79ab88[_0x71a9('0x3a')]=_[_0x71a9('0x39')](_0x44056f[_0x71a9('0x36')],qs[_0x71a9('0x3b')](_0xe1dd9e[_0x71a9('0x37')][_0x71a9('0x3b')]));_0x79ab88[_0x71a9('0x3a')]=_0x79ab88[_0x71a9('0x3a')][_0x71a9('0x3c')]?_0x79ab88[_0x71a9('0x3a')]:_0x44056f[_0x71a9('0x36')];_0x79ab88[_0x71a9('0x3e')]=qs[_0x71a9('0x3f')](_0xe1dd9e[_0x71a9('0x37')]['sort']);_0x79ab88[_0x71a9('0x42')]=qs[_0x71a9('0x40')](_[_0x71a9('0x41')](_0xe1dd9e['query'],_0x44056f[_0x71a9('0x40')]));if(_0xe1dd9e['query']['filter']){_0x79ab88[_0x71a9('0x42')]=_[_0x71a9('0x43')](_0x79ab88[_0x71a9('0x42')],{'$or':_[_0x71a9('0x31')](_0x79ab88[_0x71a9('0x3a')],function(_0x5ebe89){var _0x78ff7f={};_0x78ff7f[_0x5ebe89]={'$like':'%'+_0xe1dd9e['query'][_0x71a9('0x4f')]+'%'};return _0x78ff7f;})});}_0x79ab88=_[_0x71a9('0x43')]({},_0x79ab88,_0xe1dd9e[_0x71a9('0x44')]);return _0xfabb00['getDescriptions'](_0x79ab88);}})['then'](function(_0x4f6c73){if(_0x4f6c73){_0x4b36b0=_0x4f6c73[_0x71a9('0x3c')];if(!_0xe1dd9e[_0x71a9('0x37')]['hasOwnProperty']('nolimit')){_0x79ab88[_0x71a9('0x27')]=qs[_0x71a9('0x27')](_0xe1dd9e[_0x71a9('0x37')]['limit']);_0x79ab88['offset']=qs[_0x71a9('0x26')](_0xe1dd9e[_0x71a9('0x37')]['offset']);}return _0xfabb00[_0x71a9('0x52')](_0x79ab88);}})[_0x71a9('0x18')](function(_0x3fd5b0){if(_0x3fd5b0){return _0x3fd5b0?{'count':_0x4b36b0,'rows':_0x3fd5b0}:null;}})[_0x71a9('0x18')](respondWithResult(_0x3c3023,null))[_0x71a9('0x21')](handleError(_0x3c3023,null));};exports[_0x71a9('0x54')]=function(_0x5cd69e,_0x592612,_0x3d0883){var _0x5b43de={};var _0x33737a={};var _0x262b66;var _0x140831;return db[_0x71a9('0x32')]['findOne']({'where':{'id':_0x5cd69e[_0x71a9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x592612,null))['then'](function(_0x458447){if(_0x458447){_0x262b66=_0x458447;_0x33737a[_0x71a9('0x36')]=_['keys'](db[_0x71a9('0x55')][_0x71a9('0x33')]);_0x33737a[_0x71a9('0x37')]=_[_0x71a9('0x38')](_0x5cd69e[_0x71a9('0x37')]);_0x33737a[_0x71a9('0x40')]=_[_0x71a9('0x39')](_0x33737a[_0x71a9('0x36')],_0x33737a[_0x71a9('0x37')]);_0x5b43de['attributes']=_[_0x71a9('0x39')](_0x33737a[_0x71a9('0x36')],qs[_0x71a9('0x3b')](_0x5cd69e[_0x71a9('0x37')][_0x71a9('0x3b')]));_0x5b43de[_0x71a9('0x3a')]=_0x5b43de[_0x71a9('0x3a')][_0x71a9('0x3c')]?_0x5b43de[_0x71a9('0x3a')]:_0x33737a[_0x71a9('0x36')];_0x5b43de[_0x71a9('0x3e')]=qs[_0x71a9('0x3f')](_0x5cd69e[_0x71a9('0x37')][_0x71a9('0x3f')]);_0x5b43de['where']=qs[_0x71a9('0x40')](_[_0x71a9('0x41')](_0x5cd69e['query'],_0x33737a[_0x71a9('0x40')]));if(_0x5cd69e[_0x71a9('0x37')][_0x71a9('0x4f')]){_0x5b43de[_0x71a9('0x42')]=_[_0x71a9('0x43')](_0x5b43de['where'],{'$or':_[_0x71a9('0x31')](_0x5b43de['attributes'],function(_0x1950c6){var _0x210c04={};_0x210c04[_0x1950c6]={'$like':'%'+_0x5cd69e[_0x71a9('0x37')]['filter']+'%'};return _0x210c04;})});}_0x5b43de=_[_0x71a9('0x43')]({},_0x5b43de,_0x5cd69e[_0x71a9('0x44')]);return _0x262b66['getTags'](_0x5b43de);}})[_0x71a9('0x18')](function(_0x5452c9){if(_0x5452c9){_0x140831=_0x5452c9[_0x71a9('0x3c')];if(!_0x5cd69e['query'][_0x71a9('0x50')](_0x71a9('0x3d'))){_0x5b43de[_0x71a9('0x27')]=qs['limit'](_0x5cd69e[_0x71a9('0x37')][_0x71a9('0x27')]);_0x5b43de[_0x71a9('0x26')]=qs[_0x71a9('0x26')](_0x5cd69e[_0x71a9('0x37')][_0x71a9('0x26')]);}return _0x262b66[_0x71a9('0x54')](_0x5b43de);}})[_0x71a9('0x18')](function(_0x1b5a20){if(_0x1b5a20){return _0x1b5a20?{'count':_0x140831,'rows':_0x1b5a20}:null;}})['then'](respondWithResult(_0x592612,null))[_0x71a9('0x21')](handleError(_0x592612,null));};exports[_0x71a9('0x56')]=function(_0x32c17f,_0x279936,_0x361f92){if(_0x32c17f[_0x71a9('0x4b')]['id']){delete _0x32c17f[_0x71a9('0x4b')]['id'];}return db[_0x71a9('0x32')][_0x71a9('0x53')]({'where':{'id':_0x32c17f[_0x71a9('0x4c')]['id']}})[_0x71a9('0x18')](handleEntityNotFound(_0x279936,null))[_0x71a9('0x18')](function(_0x12da87){if(_0x12da87){return _0x12da87[_0x71a9('0x56')](_0x32c17f[_0x71a9('0x4b')][_0x71a9('0x57')]||[]);}return null;})[_0x71a9('0x18')](respondWithResult(_0x279936,null))[_0x71a9('0x21')](handleError(_0x279936,null));};
\ No newline at end of file