Built motion from commit ddca4d0d.|2.5.47
[motion2.git] / server / api / intFreshdeskConfiguration / intFreshdeskConfiguration.controller.js
index 802d092..ace7d64 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdca7=['../../config/utils','../../config/environment','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','length','hasOwnProperty','nolimit','order','sort','pick','filters','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','attributes','fields','find','body','getFields','findOne','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x296a75,_0x449ca7){var _0x328264=function(_0x26362c){while(--_0x26362c){_0x296a75['push'](_0x296a75['shift']());}};_0x328264(++_0x449ca7);}(_0xdca7,0x94));var _0x7dca=function(_0x47c933,_0x3733b1){_0x47c933=_0x47c933-0x0;var _0x5e3c14=_0xdca7[_0x47c933];return _0x5e3c14;};'use strict';var emlformat=require(_0x7dca('0x0'));var rimraf=require(_0x7dca('0x1'));var zipdir=require(_0x7dca('0x2'));var jsonpatch=require(_0x7dca('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7dca('0x4'));var path=require(_0x7dca('0x5'));var sox=require(_0x7dca('0x6'));var csv=require(_0x7dca('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7dca('0x8'));var _=require(_0x7dca('0x9'));var squel=require('squel');var crypto=require(_0x7dca('0xa'));var jsforce=require(_0x7dca('0xb'));var deskjs=require(_0x7dca('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7dca('0xd'));var Papa=require(_0x7dca('0xe'));var Redis=require(_0x7dca('0xf'));var authService=require(_0x7dca('0x10'));var qs=require(_0x7dca('0x11'));var as=require(_0x7dca('0x12'));var hardwareService=require(_0x7dca('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7dca('0x14'));var config=require(_0x7dca('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7dca('0x16'))['db'];function respondWithStatusCode(_0x42df70,_0x1df49b){_0x1df49b=_0x1df49b||0xcc;return function(_0x3e34d8){if(_0x3e34d8){return _0x42df70['sendStatus'](_0x1df49b);}return _0x42df70['status'](_0x1df49b)[_0x7dca('0x17')]();};}function respondWithResult(_0x1fc2a4,_0x28bcdc){_0x28bcdc=_0x28bcdc||0xc8;return function(_0x1d4267){if(_0x1d4267){return _0x1fc2a4[_0x7dca('0x18')](_0x28bcdc)[_0x7dca('0x19')](_0x1d4267);}};}function respondWithFilteredResult(_0x43e722,_0x53c57b){return function(_0x401bdb){if(_0x401bdb){var _0x19c57f=typeof _0x53c57b['offset']===_0x7dca('0x1a')&&typeof _0x53c57b[_0x7dca('0x1b')]===_0x7dca('0x1a');var _0x17519d=_0x401bdb[_0x7dca('0x1c')];var _0x3e9a9f=_0x19c57f?0x0:_0x53c57b[_0x7dca('0x1d')];var _0x2a1f74=_0x19c57f?_0x401bdb[_0x7dca('0x1c')]:_0x53c57b[_0x7dca('0x1d')]+_0x53c57b[_0x7dca('0x1b')];var _0x5d148d;if(_0x2a1f74>=_0x17519d){_0x2a1f74=_0x17519d;_0x5d148d=0xc8;}else{_0x5d148d=0xce;}_0x43e722[_0x7dca('0x18')](_0x5d148d);return _0x43e722[_0x7dca('0x1e')](_0x7dca('0x1f'),_0x3e9a9f+'-'+_0x2a1f74+'/'+_0x17519d)[_0x7dca('0x19')](_0x401bdb);}return null;};}function patchUpdates(_0x11d448){return function(_0xe59347){try{jsonpatch[_0x7dca('0x20')](_0xe59347,_0x11d448,!![]);}catch(_0xbf24d4){return BPromise[_0x7dca('0x21')](_0xbf24d4);}return _0xe59347['save']();};}function saveUpdates(_0x5f2b90,_0x1c145b){return function(_0x195337){if(_0x195337){return _0x195337[_0x7dca('0x22')](_0x5f2b90)['then'](function(_0x4de3cd){return _0x4de3cd;});}return null;};}function removeEntity(_0x16d7e0,_0x23e291){return function(_0x182d8d){if(_0x182d8d){return _0x182d8d[_0x7dca('0x23')]()[_0x7dca('0x24')](function(){_0x16d7e0[_0x7dca('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f51e2,_0x3e0857){return function(_0x1b9253){if(!_0x1b9253){_0x3f51e2[_0x7dca('0x25')](0x194);}return _0x1b9253;};}function handleError(_0x395dc9,_0x58a68f){_0x58a68f=_0x58a68f||0x1f4;return function(_0x364675){logger[_0x7dca('0x26')](_0x364675[_0x7dca('0x27')]);if(_0x364675['name']){delete _0x364675[_0x7dca('0x28')];}_0x395dc9[_0x7dca('0x18')](_0x58a68f)[_0x7dca('0x29')](_0x364675);};}exports[_0x7dca('0x2a')]=function(_0x22c75e,_0x1544cb){var _0x13e9ab={},_0x23dd86={},_0x4b09ee={'count':0x0,'rows':[]};var _0x33d335=_['map'](db[_0x7dca('0x2b')][_0x7dca('0x2c')],function(_0x7c043b){return{'name':_0x7c043b[_0x7dca('0x2d')],'type':_0x7c043b[_0x7dca('0x2e')][_0x7dca('0x2f')]};});_0x23dd86[_0x7dca('0x30')]=_['map'](_0x33d335,'name');_0x23dd86[_0x7dca('0x31')]=_[_0x7dca('0x32')](_0x22c75e['query']);_0x23dd86['filters']=_[_0x7dca('0x33')](_0x23dd86[_0x7dca('0x30')],_0x23dd86[_0x7dca('0x31')]);_0x13e9ab['attributes']=_[_0x7dca('0x33')](_0x23dd86[_0x7dca('0x30')],qs['fields'](_0x22c75e[_0x7dca('0x31')]['fields']));_0x13e9ab['attributes']=_0x13e9ab['attributes'][_0x7dca('0x34')]?_0x13e9ab['attributes']:_0x23dd86[_0x7dca('0x30')];if(!_0x22c75e[_0x7dca('0x31')][_0x7dca('0x35')](_0x7dca('0x36'))){_0x13e9ab[_0x7dca('0x1b')]=qs['limit'](_0x22c75e[_0x7dca('0x31')]['limit']);_0x13e9ab[_0x7dca('0x1d')]=qs[_0x7dca('0x1d')](_0x22c75e[_0x7dca('0x31')][_0x7dca('0x1d')]);}_0x13e9ab[_0x7dca('0x37')]=qs['sort'](_0x22c75e[_0x7dca('0x31')][_0x7dca('0x38')]);_0x13e9ab['where']=qs['filters'](_[_0x7dca('0x39')](_0x22c75e['query'],_0x23dd86[_0x7dca('0x3a')]),_0x33d335);if(_0x22c75e[_0x7dca('0x31')]['filter']){_0x13e9ab[_0x7dca('0x3b')]=_[_0x7dca('0x3c')](_0x13e9ab[_0x7dca('0x3b')],{'$or':_[_0x7dca('0x3d')](_0x33d335,function(_0x681b4f){if(_0x681b4f[_0x7dca('0x2e')]!==_0x7dca('0x3e')){var _0x3a9b1b={};_0x3a9b1b[_0x681b4f[_0x7dca('0x28')]]={'$like':'%'+_0x22c75e[_0x7dca('0x31')][_0x7dca('0x3f')]+'%'};return _0x3a9b1b;}})});}_0x13e9ab=_[_0x7dca('0x3c')]({},_0x13e9ab,_0x22c75e[_0x7dca('0x40')]);var _0x45eb66={'where':_0x13e9ab[_0x7dca('0x3b')]};return db[_0x7dca('0x2b')][_0x7dca('0x1c')](_0x45eb66)[_0x7dca('0x24')](function(_0x27db2d){_0x4b09ee[_0x7dca('0x1c')]=_0x27db2d;if(_0x22c75e['query'][_0x7dca('0x41')]){_0x13e9ab[_0x7dca('0x42')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x7dca('0x43')](_0x13e9ab);})[_0x7dca('0x24')](function(_0x9645bb){_0x4b09ee[_0x7dca('0x44')]=_0x9645bb;return _0x4b09ee;})[_0x7dca('0x24')](respondWithFilteredResult(_0x1544cb,_0x13e9ab))[_0x7dca('0x45')](handleError(_0x1544cb,null));};exports['show']=function(_0x8a7ba1,_0x25f7a2){var _0x4d3e87={'raw':![],'where':{'id':_0x8a7ba1[_0x7dca('0x46')]['id']}},_0x31eaaa={};_0x31eaaa['model']=_[_0x7dca('0x32')](db[_0x7dca('0x2b')]['rawAttributes']);_0x31eaaa['query']=_[_0x7dca('0x32')](_0x8a7ba1[_0x7dca('0x31')]);_0x31eaaa[_0x7dca('0x3a')]=_[_0x7dca('0x33')](_0x31eaaa['model'],_0x31eaaa[_0x7dca('0x31')]);_0x4d3e87[_0x7dca('0x47')]=_[_0x7dca('0x33')](_0x31eaaa['model'],qs[_0x7dca('0x48')](_0x8a7ba1[_0x7dca('0x31')][_0x7dca('0x48')]));_0x4d3e87[_0x7dca('0x47')]=_0x4d3e87[_0x7dca('0x47')]['length']?_0x4d3e87[_0x7dca('0x47')]:_0x31eaaa['model'];if(_0x8a7ba1[_0x7dca('0x31')]['includeAll']){_0x4d3e87[_0x7dca('0x42')]=[{'all':!![]}];}_0x4d3e87=_[_0x7dca('0x3c')]({},_0x4d3e87,_0x8a7ba1['options']);return db['FreshdeskConfiguration'][_0x7dca('0x49')](_0x4d3e87)[_0x7dca('0x24')](handleEntityNotFound(_0x25f7a2,null))[_0x7dca('0x24')](respondWithResult(_0x25f7a2,null))['catch'](handleError(_0x25f7a2,null));};exports['create']=function(_0x15a7e7,_0x26193f){return db['FreshdeskConfiguration']['create'](_0x15a7e7[_0x7dca('0x4a')],{})['then'](respondWithResult(_0x26193f,0xc9))[_0x7dca('0x45')](handleError(_0x26193f,null));};exports[_0x7dca('0x22')]=function(_0x178553,_0x123d2d){if(_0x178553[_0x7dca('0x4a')]['id']){delete _0x178553[_0x7dca('0x4a')]['id'];}return db[_0x7dca('0x2b')][_0x7dca('0x49')]({'where':{'id':_0x178553[_0x7dca('0x46')]['id']}})[_0x7dca('0x24')](handleEntityNotFound(_0x123d2d,null))['then'](saveUpdates(_0x178553[_0x7dca('0x4a')],null))[_0x7dca('0x24')](respondWithResult(_0x123d2d,null))[_0x7dca('0x45')](handleError(_0x123d2d,null));};exports[_0x7dca('0x23')]=function(_0x5dba1e,_0x1b8447){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x5dba1e['params']['id']}})[_0x7dca('0x24')](handleEntityNotFound(_0x1b8447,null))['then'](removeEntity(_0x1b8447,null))[_0x7dca('0x45')](handleError(_0x1b8447,null));};exports[_0x7dca('0x4b')]=function(_0x549206,_0x5e103f,_0x345c89){var _0x2ec65b={};var _0xf63e76={};var _0x16cbd9;var _0xc51e78;return db['FreshdeskConfiguration'][_0x7dca('0x4c')]({'where':{'id':_0x549206[_0x7dca('0x46')]['id']}})[_0x7dca('0x24')](handleEntityNotFound(_0x5e103f,null))[_0x7dca('0x24')](function(_0xc61bad){if(_0xc61bad){_0x16cbd9=_0xc61bad;_0xf63e76['model']=_[_0x7dca('0x32')](db['FreshdeskField'][_0x7dca('0x2c')]);_0xf63e76['query']=_[_0x7dca('0x32')](_0x549206[_0x7dca('0x31')]);_0xf63e76[_0x7dca('0x3a')]=_[_0x7dca('0x33')](_0xf63e76[_0x7dca('0x30')],_0xf63e76[_0x7dca('0x31')]);_0x2ec65b[_0x7dca('0x47')]=_[_0x7dca('0x33')](_0xf63e76[_0x7dca('0x30')],qs[_0x7dca('0x48')](_0x549206[_0x7dca('0x31')][_0x7dca('0x48')]));_0x2ec65b[_0x7dca('0x47')]=_0x2ec65b[_0x7dca('0x47')][_0x7dca('0x34')]?_0x2ec65b[_0x7dca('0x47')]:_0xf63e76[_0x7dca('0x30')];_0x2ec65b['order']=qs[_0x7dca('0x38')](_0x549206[_0x7dca('0x31')][_0x7dca('0x38')]);_0x2ec65b['where']=qs[_0x7dca('0x3a')](_[_0x7dca('0x39')](_0x549206[_0x7dca('0x31')],_0xf63e76['filters']));if(_0x549206[_0x7dca('0x31')]['filter']){_0x2ec65b[_0x7dca('0x3b')]=_[_0x7dca('0x3c')](_0x2ec65b[_0x7dca('0x3b')],{'$or':_[_0x7dca('0x3d')](_0x2ec65b[_0x7dca('0x47')],function(_0x1e1878){var _0x320716={};_0x320716[_0x1e1878]={'$like':'%'+_0x549206[_0x7dca('0x31')]['filter']+'%'};return _0x320716;})});}_0x2ec65b=_[_0x7dca('0x3c')]({},_0x2ec65b,_0x549206[_0x7dca('0x40')]);return _0x16cbd9[_0x7dca('0x4b')](_0x2ec65b);}})[_0x7dca('0x24')](function(_0x3ca9c4){if(_0x3ca9c4){_0xc51e78=_0x3ca9c4[_0x7dca('0x34')];if(!_0x549206[_0x7dca('0x31')][_0x7dca('0x35')]('nolimit')){_0x2ec65b[_0x7dca('0x1b')]=qs[_0x7dca('0x1b')](_0x549206[_0x7dca('0x31')][_0x7dca('0x1b')]);_0x2ec65b[_0x7dca('0x1d')]=qs[_0x7dca('0x1d')](_0x549206[_0x7dca('0x31')][_0x7dca('0x1d')]);}return _0x16cbd9[_0x7dca('0x4b')](_0x2ec65b);}})[_0x7dca('0x24')](function(_0x3e8dec){if(_0x3e8dec){return _0x3e8dec?{'count':_0xc51e78,'rows':_0x3e8dec}:null;}})['then'](respondWithResult(_0x5e103f,null))[_0x7dca('0x45')](handleError(_0x5e103f,null));};exports[_0x7dca('0x4d')]=function(_0x15cb08,_0x911faa,_0x41ad80){var _0x240ea7={};var _0x7704f2={};var _0x37c56d;var _0x29881b;return db[_0x7dca('0x2b')]['findOne']({'where':{'id':_0x15cb08[_0x7dca('0x46')]['id']}})[_0x7dca('0x24')](handleEntityNotFound(_0x911faa,null))['then'](function(_0x5f38a0){if(_0x5f38a0){_0x37c56d=_0x5f38a0;_0x7704f2[_0x7dca('0x30')]=_['keys'](db[_0x7dca('0x4e')]['rawAttributes']);_0x7704f2['query']=_[_0x7dca('0x32')](_0x15cb08[_0x7dca('0x31')]);_0x7704f2['filters']=_[_0x7dca('0x33')](_0x7704f2[_0x7dca('0x30')],_0x7704f2[_0x7dca('0x31')]);_0x240ea7['attributes']=_[_0x7dca('0x33')](_0x7704f2[_0x7dca('0x30')],qs['fields'](_0x15cb08[_0x7dca('0x31')][_0x7dca('0x48')]));_0x240ea7[_0x7dca('0x47')]=_0x240ea7[_0x7dca('0x47')]['length']?_0x240ea7['attributes']:_0x7704f2[_0x7dca('0x30')];_0x240ea7[_0x7dca('0x37')]=qs[_0x7dca('0x38')](_0x15cb08[_0x7dca('0x31')][_0x7dca('0x38')]);_0x240ea7[_0x7dca('0x3b')]=qs[_0x7dca('0x3a')](_['pick'](_0x15cb08['query'],_0x7704f2[_0x7dca('0x3a')]));if(_0x15cb08[_0x7dca('0x31')]['filter']){_0x240ea7[_0x7dca('0x3b')]=_[_0x7dca('0x3c')](_0x240ea7[_0x7dca('0x3b')],{'$or':_['map'](_0x240ea7[_0x7dca('0x47')],function(_0x5d83e7){var _0x2b56c9={};_0x2b56c9[_0x5d83e7]={'$like':'%'+_0x15cb08[_0x7dca('0x31')][_0x7dca('0x3f')]+'%'};return _0x2b56c9;})});}_0x240ea7=_['merge']({},_0x240ea7,_0x15cb08[_0x7dca('0x40')]);return _0x37c56d['getSubjects'](_0x240ea7);}})[_0x7dca('0x24')](function(_0x3308e3){if(_0x3308e3){_0x29881b=_0x3308e3[_0x7dca('0x34')];if(!_0x15cb08['query'][_0x7dca('0x35')]('nolimit')){_0x240ea7[_0x7dca('0x1b')]=qs[_0x7dca('0x1b')](_0x15cb08[_0x7dca('0x31')][_0x7dca('0x1b')]);_0x240ea7['offset']=qs['offset'](_0x15cb08[_0x7dca('0x31')][_0x7dca('0x1d')]);}return _0x37c56d['getSubjects'](_0x240ea7);}})[_0x7dca('0x24')](function(_0x29143d){if(_0x29143d){return _0x29143d?{'count':_0x29881b,'rows':_0x29143d}:null;}})[_0x7dca('0x24')](respondWithResult(_0x911faa,null))[_0x7dca('0x45')](handleError(_0x911faa,null));};exports[_0x7dca('0x4f')]=function(_0x5c91eb,_0x221fa,_0x2da59c){var _0x3ca586={};var _0x1976e0={};var _0x568e57;var _0x5968fe;return db[_0x7dca('0x2b')][_0x7dca('0x4c')]({'where':{'id':_0x5c91eb[_0x7dca('0x46')]['id']}})[_0x7dca('0x24')](handleEntityNotFound(_0x221fa,null))[_0x7dca('0x24')](function(_0x3b9da7){if(_0x3b9da7){_0x568e57=_0x3b9da7;_0x1976e0[_0x7dca('0x30')]=_[_0x7dca('0x32')](db[_0x7dca('0x4e')][_0x7dca('0x2c')]);_0x1976e0['query']=_[_0x7dca('0x32')](_0x5c91eb[_0x7dca('0x31')]);_0x1976e0[_0x7dca('0x3a')]=_[_0x7dca('0x33')](_0x1976e0['model'],_0x1976e0[_0x7dca('0x31')]);_0x3ca586[_0x7dca('0x47')]=_[_0x7dca('0x33')](_0x1976e0[_0x7dca('0x30')],qs[_0x7dca('0x48')](_0x5c91eb['query'][_0x7dca('0x48')]));_0x3ca586['attributes']=_0x3ca586[_0x7dca('0x47')][_0x7dca('0x34')]?_0x3ca586[_0x7dca('0x47')]:_0x1976e0[_0x7dca('0x30')];_0x3ca586[_0x7dca('0x37')]=qs[_0x7dca('0x38')](_0x5c91eb[_0x7dca('0x31')][_0x7dca('0x38')]);_0x3ca586[_0x7dca('0x3b')]=qs['filters'](_[_0x7dca('0x39')](_0x5c91eb[_0x7dca('0x31')],_0x1976e0[_0x7dca('0x3a')]));if(_0x5c91eb[_0x7dca('0x31')]['filter']){_0x3ca586[_0x7dca('0x3b')]=_[_0x7dca('0x3c')](_0x3ca586[_0x7dca('0x3b')],{'$or':_['map'](_0x3ca586['attributes'],function(_0x52eb97){var _0x5df858={};_0x5df858[_0x52eb97]={'$like':'%'+_0x5c91eb[_0x7dca('0x31')][_0x7dca('0x3f')]+'%'};return _0x5df858;})});}_0x3ca586=_[_0x7dca('0x3c')]({},_0x3ca586,_0x5c91eb['options']);return _0x568e57[_0x7dca('0x4f')](_0x3ca586);}})[_0x7dca('0x24')](function(_0x3648a3){if(_0x3648a3){_0x5968fe=_0x3648a3['length'];if(!_0x5c91eb[_0x7dca('0x31')][_0x7dca('0x35')](_0x7dca('0x36'))){_0x3ca586[_0x7dca('0x1b')]=qs['limit'](_0x5c91eb[_0x7dca('0x31')]['limit']);_0x3ca586[_0x7dca('0x1d')]=qs['offset'](_0x5c91eb[_0x7dca('0x31')]['offset']);}return _0x568e57[_0x7dca('0x4f')](_0x3ca586);}})[_0x7dca('0x24')](function(_0x5d2dac){if(_0x5d2dac){return _0x5d2dac?{'count':_0x5968fe,'rows':_0x5d2dac}:null;}})[_0x7dca('0x24')](respondWithResult(_0x221fa,null))[_0x7dca('0x45')](handleError(_0x221fa,null));};exports[_0x7dca('0x50')]=function(_0x37ef03,_0x2b1e21,_0x50de19){var _0x57d51b={};var _0x3b3ff5={};var _0xbc5d8;var _0x3d48ea;return db['FreshdeskConfiguration'][_0x7dca('0x4c')]({'where':{'id':_0x37ef03[_0x7dca('0x46')]['id']}})[_0x7dca('0x24')](handleEntityNotFound(_0x2b1e21,null))[_0x7dca('0x24')](function(_0x5e1a11){if(_0x5e1a11){_0xbc5d8=_0x5e1a11;_0x3b3ff5['model']=_[_0x7dca('0x32')](db[_0x7dca('0x51')][_0x7dca('0x2c')]);_0x3b3ff5[_0x7dca('0x31')]=_[_0x7dca('0x32')](_0x37ef03[_0x7dca('0x31')]);_0x3b3ff5['filters']=_[_0x7dca('0x33')](_0x3b3ff5[_0x7dca('0x30')],_0x3b3ff5[_0x7dca('0x31')]);_0x57d51b[_0x7dca('0x47')]=_[_0x7dca('0x33')](_0x3b3ff5[_0x7dca('0x30')],qs['fields'](_0x37ef03['query'][_0x7dca('0x48')]));_0x57d51b[_0x7dca('0x47')]=_0x57d51b['attributes'][_0x7dca('0x34')]?_0x57d51b[_0x7dca('0x47')]:_0x3b3ff5[_0x7dca('0x30')];_0x57d51b[_0x7dca('0x37')]=qs[_0x7dca('0x38')](_0x37ef03[_0x7dca('0x31')][_0x7dca('0x38')]);_0x57d51b['where']=qs[_0x7dca('0x3a')](_['pick'](_0x37ef03[_0x7dca('0x31')],_0x3b3ff5[_0x7dca('0x3a')]));if(_0x37ef03['query'][_0x7dca('0x3f')]){_0x57d51b[_0x7dca('0x3b')]=_['merge'](_0x57d51b['where'],{'$or':_[_0x7dca('0x3d')](_0x57d51b[_0x7dca('0x47')],function(_0x2c08d1){var _0x18f4fd={};_0x18f4fd[_0x2c08d1]={'$like':'%'+_0x37ef03['query'][_0x7dca('0x3f')]+'%'};return _0x18f4fd;})});}_0x57d51b=_[_0x7dca('0x3c')]({},_0x57d51b,_0x37ef03[_0x7dca('0x40')]);return _0xbc5d8['getTags'](_0x57d51b);}})[_0x7dca('0x24')](function(_0x5d54af){if(_0x5d54af){_0x3d48ea=_0x5d54af[_0x7dca('0x34')];if(!_0x37ef03['query'][_0x7dca('0x35')](_0x7dca('0x36'))){_0x57d51b['limit']=qs[_0x7dca('0x1b')](_0x37ef03['query'][_0x7dca('0x1b')]);_0x57d51b[_0x7dca('0x1d')]=qs[_0x7dca('0x1d')](_0x37ef03[_0x7dca('0x31')][_0x7dca('0x1d')]);}return _0xbc5d8['getTags'](_0x57d51b);}})[_0x7dca('0x24')](function(_0x3b00ab){if(_0x3b00ab){return _0x3b00ab?{'count':_0x3d48ea,'rows':_0x3b00ab}:null;}})[_0x7dca('0x24')](respondWithResult(_0x2b1e21,null))[_0x7dca('0x45')](handleError(_0x2b1e21,null));};exports[_0x7dca('0x52')]=function(_0x5bfa9f,_0x26dab2,_0x3adb8b){if(_0x5bfa9f[_0x7dca('0x4a')]['id']){delete _0x5bfa9f[_0x7dca('0x4a')]['id'];}return db[_0x7dca('0x2b')][_0x7dca('0x4c')]({'where':{'id':_0x5bfa9f[_0x7dca('0x46')]['id']}})[_0x7dca('0x24')](handleEntityNotFound(_0x26dab2,null))[_0x7dca('0x24')](function(_0x181f7e){if(_0x181f7e){return _0x181f7e[_0x7dca('0x52')](_0x5bfa9f[_0x7dca('0x4a')][_0x7dca('0x53')]||[]);}return null;})[_0x7dca('0x24')](respondWithResult(_0x26dab2,null))[_0x7dca('0x45')](handleError(_0x26dab2,null));};
\ No newline at end of file
+var _0x71ce=['getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','type','key','query','filters','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','FreshdeskConfiguration','includeAll','include','findAll','catch','show','params','rawAttributes','keys','fields','find','create','body','FreshdeskField','intersection','getFields','getSubjects','findOne'];(function(_0x2250cb,_0x27e8be){var _0x1b1df9=function(_0x29f1f8){while(--_0x29f1f8){_0x2250cb['push'](_0x2250cb['shift']());}};_0x1b1df9(++_0x27e8be);}(_0x71ce,0xaf));var _0xe71c=function(_0x4c8778,_0x49941){_0x4c8778=_0x4c8778-0x0;var _0xab0f25=_0x71ce[_0x4c8778];return _0xab0f25;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe71c('0x0'));var zipdir=require(_0xe71c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe71c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe71c('0x3'));var util=require(_0xe71c('0x4'));var path=require(_0xe71c('0x5'));var sox=require(_0xe71c('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe71c('0x7'));var _=require(_0xe71c('0x8'));var squel=require(_0xe71c('0x9'));var crypto=require(_0xe71c('0xa'));var jsforce=require(_0xe71c('0xb'));var deskjs=require(_0xe71c('0xc'));var toCsv=require(_0xe71c('0xd'));var querystring=require(_0xe71c('0xe'));var Papa=require(_0xe71c('0xf'));var Redis=require(_0xe71c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe71c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe71c('0x12'));var logger=require(_0xe71c('0x13'))(_0xe71c('0x14'));var utils=require(_0xe71c('0x15'));var config=require(_0xe71c('0x16'));var licenseUtil=require(_0xe71c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49338d,_0x9b7964){_0x9b7964=_0x9b7964||0xcc;return function(_0x2d1543){if(_0x2d1543){return _0x49338d[_0xe71c('0x18')](_0x9b7964);}return _0x49338d[_0xe71c('0x19')](_0x9b7964)[_0xe71c('0x1a')]();};}function respondWithResult(_0x32f91a,_0x170e12){_0x170e12=_0x170e12||0xc8;return function(_0x4cc46e){if(_0x4cc46e){return _0x32f91a['status'](_0x170e12)['json'](_0x4cc46e);}};}function respondWithFilteredResult(_0x3123e2,_0x501c46){return function(_0x563e90){if(_0x563e90){var _0x17454e=typeof _0x501c46[_0xe71c('0x1b')]===_0xe71c('0x1c')&&typeof _0x501c46[_0xe71c('0x1d')]==='undefined';var _0x4f3179=_0x563e90[_0xe71c('0x1e')];var _0x5acb19=_0x17454e?0x0:_0x501c46[_0xe71c('0x1b')];var _0x532bf6=_0x17454e?_0x563e90['count']:_0x501c46[_0xe71c('0x1b')]+_0x501c46[_0xe71c('0x1d')];var _0xc6a9d;if(_0x532bf6>=_0x4f3179){_0x532bf6=_0x4f3179;_0xc6a9d=0xc8;}else{_0xc6a9d=0xce;}_0x3123e2[_0xe71c('0x19')](_0xc6a9d);return _0x3123e2[_0xe71c('0x1f')](_0xe71c('0x20'),_0x5acb19+'-'+_0x532bf6+'/'+_0x4f3179)[_0xe71c('0x21')](_0x563e90);}return null;};}function patchUpdates(_0x56073f){return function(_0x22188d){try{jsonpatch[_0xe71c('0x22')](_0x22188d,_0x56073f,!![]);}catch(_0x2bb20f){return BPromise[_0xe71c('0x23')](_0x2bb20f);}return _0x22188d[_0xe71c('0x24')]();};}function saveUpdates(_0x2c81de,_0x34b351){return function(_0x3f1099){if(_0x3f1099){return _0x3f1099['update'](_0x2c81de)[_0xe71c('0x25')](function(_0x240330){return _0x240330;});}return null;};}function removeEntity(_0x1f248c,_0x525a10){return function(_0x1c2eb7){if(_0x1c2eb7){return _0x1c2eb7[_0xe71c('0x26')]()[_0xe71c('0x25')](function(){_0x1f248c[_0xe71c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57112c,_0x5764dd){return function(_0x5167ed){if(!_0x5167ed){_0x57112c[_0xe71c('0x18')](0x194);}return _0x5167ed;};}function handleError(_0x1ea7cc,_0x31a9ef){_0x31a9ef=_0x31a9ef||0x1f4;return function(_0x2cf93f){logger[_0xe71c('0x27')](_0x2cf93f[_0xe71c('0x28')]);if(_0x2cf93f[_0xe71c('0x29')]){delete _0x2cf93f[_0xe71c('0x29')];}_0x1ea7cc['status'](_0x31a9ef)[_0xe71c('0x2a')](_0x2cf93f);};}exports[_0xe71c('0x2b')]=function(_0x2809a3,_0x3c4648){var _0x4aad86={},_0x53aa95={},_0x1d2014={'count':0x0,'rows':[]};var _0x4badd1=_[_0xe71c('0x2c')](db['FreshdeskConfiguration']['rawAttributes'],function(_0xc07641){return{'name':_0xc07641['fieldName'],'type':_0xc07641[_0xe71c('0x2d')][_0xe71c('0x2e')]};});_0x53aa95['model']=_[_0xe71c('0x2c')](_0x4badd1,_0xe71c('0x29'));_0x53aa95['query']=_['keys'](_0x2809a3[_0xe71c('0x2f')]);_0x53aa95[_0xe71c('0x30')]=_['intersection'](_0x53aa95[_0xe71c('0x31')],_0x53aa95[_0xe71c('0x2f')]);_0x4aad86[_0xe71c('0x32')]=_['intersection'](_0x53aa95[_0xe71c('0x31')],qs['fields'](_0x2809a3[_0xe71c('0x2f')]['fields']));_0x4aad86['attributes']=_0x4aad86[_0xe71c('0x32')][_0xe71c('0x33')]?_0x4aad86['attributes']:_0x53aa95[_0xe71c('0x31')];if(!_0x2809a3[_0xe71c('0x2f')][_0xe71c('0x34')](_0xe71c('0x35'))){_0x4aad86[_0xe71c('0x1d')]=qs[_0xe71c('0x1d')](_0x2809a3['query']['limit']);_0x4aad86[_0xe71c('0x1b')]=qs[_0xe71c('0x1b')](_0x2809a3[_0xe71c('0x2f')][_0xe71c('0x1b')]);}_0x4aad86[_0xe71c('0x36')]=qs[_0xe71c('0x37')](_0x2809a3[_0xe71c('0x2f')][_0xe71c('0x37')]);_0x4aad86[_0xe71c('0x38')]=qs[_0xe71c('0x30')](_[_0xe71c('0x39')](_0x2809a3[_0xe71c('0x2f')],_0x53aa95[_0xe71c('0x30')]),_0x4badd1);if(_0x2809a3[_0xe71c('0x2f')][_0xe71c('0x3a')]){_0x4aad86[_0xe71c('0x38')]=_['merge'](_0x4aad86['where'],{'$or':_[_0xe71c('0x2c')](_0x4badd1,function(_0xda0b31){if(_0xda0b31['type']!==_0xe71c('0x3b')){var _0x23fb44={};_0x23fb44[_0xda0b31[_0xe71c('0x29')]]={'$like':'%'+_0x2809a3[_0xe71c('0x2f')][_0xe71c('0x3a')]+'%'};return _0x23fb44;}})});}_0x4aad86=_[_0xe71c('0x3c')]({},_0x4aad86,_0x2809a3[_0xe71c('0x3d')]);var _0x2b0408={'where':_0x4aad86[_0xe71c('0x38')]};return db[_0xe71c('0x3e')][_0xe71c('0x1e')](_0x2b0408)[_0xe71c('0x25')](function(_0x23984f){_0x1d2014[_0xe71c('0x1e')]=_0x23984f;if(_0x2809a3[_0xe71c('0x2f')][_0xe71c('0x3f')]){_0x4aad86[_0xe71c('0x40')]=[{'all':!![]}];}return db[_0xe71c('0x3e')][_0xe71c('0x41')](_0x4aad86);})[_0xe71c('0x25')](function(_0x4137d4){_0x1d2014['rows']=_0x4137d4;return _0x1d2014;})[_0xe71c('0x25')](respondWithFilteredResult(_0x3c4648,_0x4aad86))[_0xe71c('0x42')](handleError(_0x3c4648,null));};exports[_0xe71c('0x43')]=function(_0x117df6,_0x2a9e42){var _0x31c0c5={'raw':![],'where':{'id':_0x117df6[_0xe71c('0x44')]['id']}},_0x39dbf1={};_0x39dbf1[_0xe71c('0x31')]=_['keys'](db[_0xe71c('0x3e')][_0xe71c('0x45')]);_0x39dbf1[_0xe71c('0x2f')]=_[_0xe71c('0x46')](_0x117df6[_0xe71c('0x2f')]);_0x39dbf1[_0xe71c('0x30')]=_['intersection'](_0x39dbf1[_0xe71c('0x31')],_0x39dbf1[_0xe71c('0x2f')]);_0x31c0c5[_0xe71c('0x32')]=_['intersection'](_0x39dbf1['model'],qs['fields'](_0x117df6[_0xe71c('0x2f')][_0xe71c('0x47')]));_0x31c0c5[_0xe71c('0x32')]=_0x31c0c5['attributes'][_0xe71c('0x33')]?_0x31c0c5[_0xe71c('0x32')]:_0x39dbf1[_0xe71c('0x31')];if(_0x117df6[_0xe71c('0x2f')][_0xe71c('0x3f')]){_0x31c0c5['include']=[{'all':!![]}];}_0x31c0c5=_['merge']({},_0x31c0c5,_0x117df6[_0xe71c('0x3d')]);return db[_0xe71c('0x3e')][_0xe71c('0x48')](_0x31c0c5)[_0xe71c('0x25')](handleEntityNotFound(_0x2a9e42,null))[_0xe71c('0x25')](respondWithResult(_0x2a9e42,null))['catch'](handleError(_0x2a9e42,null));};exports[_0xe71c('0x49')]=function(_0x5b0876,_0x3a8e31){return db[_0xe71c('0x3e')][_0xe71c('0x49')](_0x5b0876[_0xe71c('0x4a')],{})['then'](respondWithResult(_0x3a8e31,0xc9))[_0xe71c('0x42')](handleError(_0x3a8e31,null));};exports['update']=function(_0x44b93b,_0x7032f7){if(_0x44b93b[_0xe71c('0x4a')]['id']){delete _0x44b93b[_0xe71c('0x4a')]['id'];}return db[_0xe71c('0x3e')]['find']({'where':{'id':_0x44b93b[_0xe71c('0x44')]['id']}})[_0xe71c('0x25')](handleEntityNotFound(_0x7032f7,null))[_0xe71c('0x25')](saveUpdates(_0x44b93b['body'],null))[_0xe71c('0x25')](respondWithResult(_0x7032f7,null))[_0xe71c('0x42')](handleError(_0x7032f7,null));};exports[_0xe71c('0x26')]=function(_0x1917c0,_0x472fc0){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x1917c0[_0xe71c('0x44')]['id']}})[_0xe71c('0x25')](handleEntityNotFound(_0x472fc0,null))['then'](removeEntity(_0x472fc0,null))[_0xe71c('0x42')](handleError(_0x472fc0,null));};exports['getFields']=function(_0x1798cf,_0x152a5f,_0x22e65b){var _0x52f678={};var _0x1a4443={};var _0x17199c;var _0x50701b;return db[_0xe71c('0x3e')]['findOne']({'where':{'id':_0x1798cf[_0xe71c('0x44')]['id']}})[_0xe71c('0x25')](handleEntityNotFound(_0x152a5f,null))[_0xe71c('0x25')](function(_0x1be3ac){if(_0x1be3ac){_0x17199c=_0x1be3ac;_0x1a4443['model']=_[_0xe71c('0x46')](db[_0xe71c('0x4b')][_0xe71c('0x45')]);_0x1a4443[_0xe71c('0x2f')]=_[_0xe71c('0x46')](_0x1798cf[_0xe71c('0x2f')]);_0x1a4443['filters']=_[_0xe71c('0x4c')](_0x1a4443[_0xe71c('0x31')],_0x1a4443[_0xe71c('0x2f')]);_0x52f678['attributes']=_[_0xe71c('0x4c')](_0x1a4443[_0xe71c('0x31')],qs[_0xe71c('0x47')](_0x1798cf[_0xe71c('0x2f')][_0xe71c('0x47')]));_0x52f678['attributes']=_0x52f678['attributes'][_0xe71c('0x33')]?_0x52f678[_0xe71c('0x32')]:_0x1a4443[_0xe71c('0x31')];_0x52f678['order']=qs[_0xe71c('0x37')](_0x1798cf[_0xe71c('0x2f')][_0xe71c('0x37')]);_0x52f678[_0xe71c('0x38')]=qs[_0xe71c('0x30')](_[_0xe71c('0x39')](_0x1798cf[_0xe71c('0x2f')],_0x1a4443[_0xe71c('0x30')]));if(_0x1798cf[_0xe71c('0x2f')][_0xe71c('0x3a')]){_0x52f678['where']=_[_0xe71c('0x3c')](_0x52f678[_0xe71c('0x38')],{'$or':_['map'](_0x52f678[_0xe71c('0x32')],function(_0x31749b){var _0x4998ff={};_0x4998ff[_0x31749b]={'$like':'%'+_0x1798cf[_0xe71c('0x2f')]['filter']+'%'};return _0x4998ff;})});}_0x52f678=_[_0xe71c('0x3c')]({},_0x52f678,_0x1798cf[_0xe71c('0x3d')]);return _0x17199c[_0xe71c('0x4d')](_0x52f678);}})[_0xe71c('0x25')](function(_0x2d1b50){if(_0x2d1b50){_0x50701b=_0x2d1b50[_0xe71c('0x33')];if(!_0x1798cf['query']['hasOwnProperty'](_0xe71c('0x35'))){_0x52f678['limit']=qs[_0xe71c('0x1d')](_0x1798cf['query']['limit']);_0x52f678[_0xe71c('0x1b')]=qs[_0xe71c('0x1b')](_0x1798cf[_0xe71c('0x2f')][_0xe71c('0x1b')]);}return _0x17199c[_0xe71c('0x4d')](_0x52f678);}})['then'](function(_0x5065a9){if(_0x5065a9){return _0x5065a9?{'count':_0x50701b,'rows':_0x5065a9}:null;}})[_0xe71c('0x25')](respondWithResult(_0x152a5f,null))[_0xe71c('0x42')](handleError(_0x152a5f,null));};exports[_0xe71c('0x4e')]=function(_0x3d68b1,_0x4952c0,_0x4f7815){var _0x2ad867={};var _0x1b2c04={};var _0x5ee37d;var _0x5210b5;return db[_0xe71c('0x3e')][_0xe71c('0x4f')]({'where':{'id':_0x3d68b1['params']['id']}})[_0xe71c('0x25')](handleEntityNotFound(_0x4952c0,null))[_0xe71c('0x25')](function(_0x1683d7){if(_0x1683d7){_0x5ee37d=_0x1683d7;_0x1b2c04[_0xe71c('0x31')]=_[_0xe71c('0x46')](db[_0xe71c('0x4b')][_0xe71c('0x45')]);_0x1b2c04[_0xe71c('0x2f')]=_[_0xe71c('0x46')](_0x3d68b1[_0xe71c('0x2f')]);_0x1b2c04[_0xe71c('0x30')]=_[_0xe71c('0x4c')](_0x1b2c04[_0xe71c('0x31')],_0x1b2c04[_0xe71c('0x2f')]);_0x2ad867[_0xe71c('0x32')]=_['intersection'](_0x1b2c04[_0xe71c('0x31')],qs['fields'](_0x3d68b1[_0xe71c('0x2f')][_0xe71c('0x47')]));_0x2ad867['attributes']=_0x2ad867[_0xe71c('0x32')][_0xe71c('0x33')]?_0x2ad867[_0xe71c('0x32')]:_0x1b2c04[_0xe71c('0x31')];_0x2ad867[_0xe71c('0x36')]=qs[_0xe71c('0x37')](_0x3d68b1['query'][_0xe71c('0x37')]);_0x2ad867[_0xe71c('0x38')]=qs[_0xe71c('0x30')](_[_0xe71c('0x39')](_0x3d68b1[_0xe71c('0x2f')],_0x1b2c04[_0xe71c('0x30')]));if(_0x3d68b1[_0xe71c('0x2f')][_0xe71c('0x3a')]){_0x2ad867['where']=_[_0xe71c('0x3c')](_0x2ad867[_0xe71c('0x38')],{'$or':_[_0xe71c('0x2c')](_0x2ad867[_0xe71c('0x32')],function(_0x11c6db){var _0x33bd00={};_0x33bd00[_0x11c6db]={'$like':'%'+_0x3d68b1[_0xe71c('0x2f')][_0xe71c('0x3a')]+'%'};return _0x33bd00;})});}_0x2ad867=_[_0xe71c('0x3c')]({},_0x2ad867,_0x3d68b1[_0xe71c('0x3d')]);return _0x5ee37d[_0xe71c('0x4e')](_0x2ad867);}})[_0xe71c('0x25')](function(_0xa3bd01){if(_0xa3bd01){_0x5210b5=_0xa3bd01[_0xe71c('0x33')];if(!_0x3d68b1[_0xe71c('0x2f')][_0xe71c('0x34')](_0xe71c('0x35'))){_0x2ad867[_0xe71c('0x1d')]=qs[_0xe71c('0x1d')](_0x3d68b1[_0xe71c('0x2f')][_0xe71c('0x1d')]);_0x2ad867[_0xe71c('0x1b')]=qs[_0xe71c('0x1b')](_0x3d68b1[_0xe71c('0x2f')][_0xe71c('0x1b')]);}return _0x5ee37d['getSubjects'](_0x2ad867);}})[_0xe71c('0x25')](function(_0x19c5c5){if(_0x19c5c5){return _0x19c5c5?{'count':_0x5210b5,'rows':_0x19c5c5}:null;}})[_0xe71c('0x25')](respondWithResult(_0x4952c0,null))[_0xe71c('0x42')](handleError(_0x4952c0,null));};exports[_0xe71c('0x50')]=function(_0x5dd982,_0x2b188a,_0x5ca677){var _0x543ea2={};var _0x40e5d9={};var _0x42adee;var _0x3ea2f2;return db[_0xe71c('0x3e')][_0xe71c('0x4f')]({'where':{'id':_0x5dd982['params']['id']}})['then'](handleEntityNotFound(_0x2b188a,null))[_0xe71c('0x25')](function(_0x16765b){if(_0x16765b){_0x42adee=_0x16765b;_0x40e5d9[_0xe71c('0x31')]=_[_0xe71c('0x46')](db[_0xe71c('0x4b')][_0xe71c('0x45')]);_0x40e5d9[_0xe71c('0x2f')]=_[_0xe71c('0x46')](_0x5dd982[_0xe71c('0x2f')]);_0x40e5d9[_0xe71c('0x30')]=_['intersection'](_0x40e5d9[_0xe71c('0x31')],_0x40e5d9[_0xe71c('0x2f')]);_0x543ea2['attributes']=_['intersection'](_0x40e5d9['model'],qs[_0xe71c('0x47')](_0x5dd982[_0xe71c('0x2f')]['fields']));_0x543ea2[_0xe71c('0x32')]=_0x543ea2[_0xe71c('0x32')][_0xe71c('0x33')]?_0x543ea2[_0xe71c('0x32')]:_0x40e5d9[_0xe71c('0x31')];_0x543ea2[_0xe71c('0x36')]=qs['sort'](_0x5dd982[_0xe71c('0x2f')][_0xe71c('0x37')]);_0x543ea2[_0xe71c('0x38')]=qs[_0xe71c('0x30')](_[_0xe71c('0x39')](_0x5dd982[_0xe71c('0x2f')],_0x40e5d9[_0xe71c('0x30')]));if(_0x5dd982[_0xe71c('0x2f')][_0xe71c('0x3a')]){_0x543ea2[_0xe71c('0x38')]=_['merge'](_0x543ea2[_0xe71c('0x38')],{'$or':_['map'](_0x543ea2[_0xe71c('0x32')],function(_0x45e646){var _0x18575f={};_0x18575f[_0x45e646]={'$like':'%'+_0x5dd982[_0xe71c('0x2f')][_0xe71c('0x3a')]+'%'};return _0x18575f;})});}_0x543ea2=_[_0xe71c('0x3c')]({},_0x543ea2,_0x5dd982[_0xe71c('0x3d')]);return _0x42adee[_0xe71c('0x50')](_0x543ea2);}})[_0xe71c('0x25')](function(_0x23f264){if(_0x23f264){_0x3ea2f2=_0x23f264[_0xe71c('0x33')];if(!_0x5dd982[_0xe71c('0x2f')][_0xe71c('0x34')](_0xe71c('0x35'))){_0x543ea2[_0xe71c('0x1d')]=qs['limit'](_0x5dd982[_0xe71c('0x2f')][_0xe71c('0x1d')]);_0x543ea2[_0xe71c('0x1b')]=qs[_0xe71c('0x1b')](_0x5dd982[_0xe71c('0x2f')]['offset']);}return _0x42adee['getDescriptions'](_0x543ea2);}})['then'](function(_0xf91ad8){if(_0xf91ad8){return _0xf91ad8?{'count':_0x3ea2f2,'rows':_0xf91ad8}:null;}})[_0xe71c('0x25')](respondWithResult(_0x2b188a,null))[_0xe71c('0x42')](handleError(_0x2b188a,null));};exports[_0xe71c('0x51')]=function(_0x5f42ac,_0xe5c6ab,_0x1cb407){var _0x89aeec={};var _0x2d8a50={};var _0x269e02;var _0x16b637;return db[_0xe71c('0x3e')][_0xe71c('0x4f')]({'where':{'id':_0x5f42ac[_0xe71c('0x44')]['id']}})[_0xe71c('0x25')](handleEntityNotFound(_0xe5c6ab,null))['then'](function(_0x45ff52){if(_0x45ff52){_0x269e02=_0x45ff52;_0x2d8a50['model']=_[_0xe71c('0x46')](db[_0xe71c('0x52')][_0xe71c('0x45')]);_0x2d8a50[_0xe71c('0x2f')]=_[_0xe71c('0x46')](_0x5f42ac[_0xe71c('0x2f')]);_0x2d8a50[_0xe71c('0x30')]=_['intersection'](_0x2d8a50[_0xe71c('0x31')],_0x2d8a50['query']);_0x89aeec[_0xe71c('0x32')]=_[_0xe71c('0x4c')](_0x2d8a50['model'],qs['fields'](_0x5f42ac[_0xe71c('0x2f')][_0xe71c('0x47')]));_0x89aeec[_0xe71c('0x32')]=_0x89aeec[_0xe71c('0x32')][_0xe71c('0x33')]?_0x89aeec['attributes']:_0x2d8a50[_0xe71c('0x31')];_0x89aeec[_0xe71c('0x36')]=qs[_0xe71c('0x37')](_0x5f42ac[_0xe71c('0x2f')][_0xe71c('0x37')]);_0x89aeec[_0xe71c('0x38')]=qs[_0xe71c('0x30')](_[_0xe71c('0x39')](_0x5f42ac['query'],_0x2d8a50[_0xe71c('0x30')]));if(_0x5f42ac[_0xe71c('0x2f')][_0xe71c('0x3a')]){_0x89aeec[_0xe71c('0x38')]=_[_0xe71c('0x3c')](_0x89aeec['where'],{'$or':_[_0xe71c('0x2c')](_0x89aeec[_0xe71c('0x32')],function(_0x552860){var _0x402594={};_0x402594[_0x552860]={'$like':'%'+_0x5f42ac['query']['filter']+'%'};return _0x402594;})});}_0x89aeec=_['merge']({},_0x89aeec,_0x5f42ac[_0xe71c('0x3d')]);return _0x269e02['getTags'](_0x89aeec);}})['then'](function(_0x51aa62){if(_0x51aa62){_0x16b637=_0x51aa62[_0xe71c('0x33')];if(!_0x5f42ac['query'][_0xe71c('0x34')](_0xe71c('0x35'))){_0x89aeec[_0xe71c('0x1d')]=qs[_0xe71c('0x1d')](_0x5f42ac['query'][_0xe71c('0x1d')]);_0x89aeec[_0xe71c('0x1b')]=qs[_0xe71c('0x1b')](_0x5f42ac[_0xe71c('0x2f')][_0xe71c('0x1b')]);}return _0x269e02[_0xe71c('0x51')](_0x89aeec);}})[_0xe71c('0x25')](function(_0x3de466){if(_0x3de466){return _0x3de466?{'count':_0x16b637,'rows':_0x3de466}:null;}})[_0xe71c('0x25')](respondWithResult(_0xe5c6ab,null))[_0xe71c('0x42')](handleError(_0xe5c6ab,null));};exports[_0xe71c('0x53')]=function(_0x3ac5a3,_0xad1bf2,_0x48b413){if(_0x3ac5a3[_0xe71c('0x4a')]['id']){delete _0x3ac5a3[_0xe71c('0x4a')]['id'];}return db['FreshdeskConfiguration'][_0xe71c('0x4f')]({'where':{'id':_0x3ac5a3[_0xe71c('0x44')]['id']}})[_0xe71c('0x25')](handleEntityNotFound(_0xad1bf2,null))[_0xe71c('0x25')](function(_0x118351){if(_0x118351){return _0x118351[_0xe71c('0x53')](_0x3ac5a3[_0xe71c('0x4a')][_0xe71c('0x54')]||[]);}return null;})[_0xe71c('0x25')](respondWithResult(_0xad1bf2,null))[_0xe71c('0x42')](handleError(_0xad1bf2,null));};
\ No newline at end of file