Built motion from commit (unavailable).|2.5.25
[motion2.git] / server / api / intFreshdeskConfiguration / intFreshdeskConfiguration.controller.js
index 259c9bd..c273680 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7701=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','test','Sequelize','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','end','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','show','keys','create','body','find','params','getFields','findOne','FreshdeskField','pick','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids'];(function(_0x383158,_0x415e43){var _0x507985=function(_0x1e498e){while(--_0x1e498e){_0x383158['push'](_0x383158['shift']());}};_0x507985(++_0x415e43);}(_0x7701,0xc2));var _0x1770=function(_0x126252,_0x2e41d4){_0x126252=_0x126252-0x0;var _0x589e99=_0x7701[_0x126252];return _0x589e99;};'use strict';var pdf=require(_0x1770('0x0'));var emlformat=require(_0x1770('0x1'));var rimraf=require(_0x1770('0x2'));var zipdir=require(_0x1770('0x3'));var jsonpatch=require(_0x1770('0x4'));var rp=require('request-promise');var moment=require(_0x1770('0x5'));var BPromise=require(_0x1770('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1770('0x7'));var csv=require(_0x1770('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1770('0x9'));var squel=require(_0x1770('0xa'));var crypto=require('crypto');var jsforce=require(_0x1770('0xb'));var deskjs=require(_0x1770('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1770('0xd'));var Redis=require(_0x1770('0xe'));var authService=require(_0x1770('0xf'));var qs=require(_0x1770('0x10'));var as=require(_0x1770('0x11'));var hardwareService=require(_0x1770('0x12'));var logger=require(_0x1770('0x13'))(_0x1770('0x14'));var utils=require(_0x1770('0x15'));var config=require(_0x1770('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1770('0x17'));var client=jayson[_0x1770('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x5269bf,_0x329c80,_0x10e5bc){if(_0x10e5bc){var _0x127511=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x127511[_0x1770('0x19')](_0x329c80)){return _0x5269bf;}else{throw new db[(_0x1770('0x1a'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5269bf;}}function respondWithRpcPromise(_0x28f27c,_0x24905f,_0x471b91,_0x16b3d5){return new BPromise(function(_0x5485f3,_0x5af28c){var _0x266973=_0x16b3d5||client;return _0x266973[_0x1770('0x1b')](_0x28f27c,_0x471b91)[_0x1770('0x1c')](function(_0x72cb61){logger[_0x1770('0x1d')](_0x1770('0x1e'),_0x24905f,'request\x20sent');logger[_0x1770('0x1f')](_0x1770('0x20'),_0x24905f,_0x1770('0x21'),JSON[_0x1770('0x22')](_0x72cb61));if(_0x72cb61[_0x1770('0x23')]){if(_0x72cb61[_0x1770('0x23')][_0x1770('0x24')]===0x1f4){logger[_0x1770('0x23')](_0x1770('0x1e'),_0x24905f,_0x72cb61[_0x1770('0x23')]['message']);return _0x5af28c(_0x72cb61[_0x1770('0x23')][_0x1770('0x25')]);}logger[_0x1770('0x23')](_0x1770('0x1e'),_0x24905f,_0x72cb61[_0x1770('0x23')][_0x1770('0x25')]);return _0x5485f3(_0x72cb61[_0x1770('0x23')][_0x1770('0x25')]);}else{logger['info'](_0x1770('0x1e'),_0x24905f,_0x1770('0x21'));_0x5485f3(_0x72cb61[_0x1770('0x26')][_0x1770('0x25')]);}})[_0x1770('0x27')](function(_0x111eb){logger['error'](_0x1770('0x1e'),_0x24905f,_0x111eb);_0x5af28c(_0x111eb);});});}function respondWithStatusCode(_0x1cf75b,_0x4e6028){_0x4e6028=_0x4e6028||0xcc;return function(_0x3bb59d){if(_0x3bb59d){return _0x1cf75b[_0x1770('0x28')](_0x4e6028);}return _0x1cf75b['status'](_0x4e6028)['end']();};}function respondWithResult(_0x54c73e,_0x3cf2e0){_0x3cf2e0=_0x3cf2e0||0xc8;return function(_0x2b4842){if(_0x2b4842){return _0x54c73e[_0x1770('0x29')](_0x3cf2e0)[_0x1770('0x2a')](_0x2b4842);}};}function respondWithFilteredResult(_0x2bd72e,_0x41f2bf){return function(_0x1594aa){if(_0x1594aa){var _0x5c7cca=_0x1594aa[_0x1770('0x2b')],_0x1b049a=_0x41f2bf[_0x1770('0x2c')],_0x1bb491=_0x41f2bf[_0x1770('0x2c')]+_0x41f2bf[_0x1770('0x2d')],_0x105733;if(_0x1bb491>=_0x5c7cca){_0x1bb491=_0x5c7cca;_0x105733=0xc8;}else{_0x105733=0xce;}_0x2bd72e[_0x1770('0x29')](_0x105733);return _0x2bd72e[_0x1770('0x2e')](_0x1770('0x2f'),_0x1b049a+'-'+_0x1bb491+'/'+_0x5c7cca)[_0x1770('0x2a')](_0x1594aa);}return null;};}function patchUpdates(_0x473607){return function(_0x55d809){try{jsonpatch[_0x1770('0x30')](_0x55d809,_0x473607,!![]);}catch(_0x5090f6){return BPromise['reject'](_0x5090f6);}return _0x55d809[_0x1770('0x31')]();};}function saveUpdates(_0x23abf0,_0x3c3059){return function(_0x55cea2){if(_0x55cea2){return _0x55cea2[_0x1770('0x32')](_0x23abf0)[_0x1770('0x1c')](function(_0x243116){return _0x243116;});}return null;};}function removeEntity(_0x4a646c,_0x157396){return function(_0xf9fb65){if(_0xf9fb65){return _0xf9fb65[_0x1770('0x33')]()[_0x1770('0x1c')](function(){_0x4a646c[_0x1770('0x29')](0xcc)[_0x1770('0x34')]();});}};}function handleEntityNotFound(_0xec8acf,_0x286136){return function(_0x2ba046){if(!_0x2ba046){_0xec8acf[_0x1770('0x28')](0x194);}return _0x2ba046;};}function handleError(_0x2f1ed0,_0x323775){_0x323775=_0x323775||0x1f4;return function(_0x4f6443){logger[_0x1770('0x23')](_0x4f6443[_0x1770('0x35')]);if(_0x4f6443[_0x1770('0x36')]){delete _0x4f6443[_0x1770('0x36')];}_0x2f1ed0[_0x1770('0x29')](_0x323775)[_0x1770('0x37')](_0x4f6443);};}exports[_0x1770('0x38')]=function(_0x29e617,_0x14d107){var _0x276a22={},_0x4ef716={},_0x2b2355={'count':0x0,'rows':[]};var _0x531b87=_[_0x1770('0x39')](db[_0x1770('0x3a')][_0x1770('0x3b')],function(_0x23f121){return{'name':_0x23f121[_0x1770('0x3c')],'type':_0x23f121[_0x1770('0x3d')][_0x1770('0x3e')]};});_0x4ef716[_0x1770('0x3f')]=_[_0x1770('0x39')](_0x531b87,_0x1770('0x36'));_0x4ef716[_0x1770('0x40')]=_['keys'](_0x29e617[_0x1770('0x40')]);_0x4ef716[_0x1770('0x41')]=_[_0x1770('0x42')](_0x4ef716['model'],_0x4ef716[_0x1770('0x40')]);_0x276a22[_0x1770('0x43')]=_[_0x1770('0x42')](_0x4ef716[_0x1770('0x3f')],qs[_0x1770('0x44')](_0x29e617[_0x1770('0x40')][_0x1770('0x44')]));_0x276a22[_0x1770('0x43')]=_0x276a22[_0x1770('0x43')][_0x1770('0x45')]?_0x276a22['attributes']:_0x4ef716[_0x1770('0x3f')];if(!_0x29e617[_0x1770('0x40')][_0x1770('0x46')]('nolimit')){_0x276a22[_0x1770('0x2d')]=qs[_0x1770('0x2d')](_0x29e617[_0x1770('0x40')][_0x1770('0x2d')]);_0x276a22['offset']=qs[_0x1770('0x2c')](_0x29e617[_0x1770('0x40')]['offset']);}_0x276a22[_0x1770('0x47')]=qs[_0x1770('0x48')](_0x29e617[_0x1770('0x40')]['sort']);_0x276a22[_0x1770('0x49')]=qs[_0x1770('0x41')](_['pick'](_0x29e617[_0x1770('0x40')],_0x4ef716['filters']));if(_0x29e617[_0x1770('0x40')][_0x1770('0x4a')]){_0x276a22['where']=_[_0x1770('0x4b')](_0x276a22[_0x1770('0x49')],{'$or':_[_0x1770('0x39')](_0x531b87,function(_0x3d1dd4){if(_0x3d1dd4[_0x1770('0x3d')]!==_0x1770('0x4c')){var _0x381e55={};_0x381e55[_0x3d1dd4['name']]={'$like':'%'+_0x29e617[_0x1770('0x40')][_0x1770('0x4a')]+'%'};return _0x381e55;}})});}_0x276a22=_[_0x1770('0x4b')]({},_0x276a22,_0x29e617[_0x1770('0x4d')]);var _0x160292={'where':_0x276a22['where']};return db[_0x1770('0x3a')][_0x1770('0x2b')](_0x160292)[_0x1770('0x1c')](function(_0x827eab){_0x2b2355[_0x1770('0x2b')]=_0x827eab;if(_0x29e617[_0x1770('0x40')][_0x1770('0x4e')]){_0x276a22['include']=[{'all':!![]}];}return db[_0x1770('0x3a')][_0x1770('0x4f')](_0x276a22);})[_0x1770('0x1c')](function(_0x1549a6){_0x2b2355['rows']=_0x1549a6;return _0x2b2355;})[_0x1770('0x1c')](respondWithFilteredResult(_0x14d107,_0x276a22))[_0x1770('0x27')](handleError(_0x14d107,null));};exports[_0x1770('0x50')]=function(_0x6f8875,_0x150537){var _0x20c635={'raw':![],'where':{'id':_0x6f8875['params']['id']}},_0x3a2515={};_0x3a2515[_0x1770('0x3f')]=_[_0x1770('0x51')](db[_0x1770('0x3a')][_0x1770('0x3b')]);_0x3a2515[_0x1770('0x40')]=_[_0x1770('0x51')](_0x6f8875[_0x1770('0x40')]);_0x3a2515[_0x1770('0x41')]=_[_0x1770('0x42')](_0x3a2515[_0x1770('0x3f')],_0x3a2515['query']);_0x20c635['attributes']=_['intersection'](_0x3a2515['model'],qs[_0x1770('0x44')](_0x6f8875[_0x1770('0x40')][_0x1770('0x44')]));_0x20c635[_0x1770('0x43')]=_0x20c635[_0x1770('0x43')][_0x1770('0x45')]?_0x20c635[_0x1770('0x43')]:_0x3a2515[_0x1770('0x3f')];if(_0x6f8875[_0x1770('0x40')][_0x1770('0x4e')]){_0x20c635['include']=[{'all':!![]}];}_0x20c635=_[_0x1770('0x4b')]({},_0x20c635,_0x6f8875['options']);return db[_0x1770('0x3a')]['find'](_0x20c635)[_0x1770('0x1c')](handleEntityNotFound(_0x150537,null))[_0x1770('0x1c')](respondWithResult(_0x150537,null))['catch'](handleError(_0x150537,null));};exports[_0x1770('0x52')]=function(_0x151187,_0x3c7aea){return db['FreshdeskConfiguration'][_0x1770('0x52')](_0x151187[_0x1770('0x53')],{})[_0x1770('0x1c')](respondWithResult(_0x3c7aea,0xc9))[_0x1770('0x27')](handleError(_0x3c7aea,null));};exports['update']=function(_0xd1c7b5,_0x372058){if(_0xd1c7b5[_0x1770('0x53')]['id']){delete _0xd1c7b5[_0x1770('0x53')]['id'];}return db[_0x1770('0x3a')][_0x1770('0x54')]({'where':{'id':_0xd1c7b5[_0x1770('0x55')]['id']}})[_0x1770('0x1c')](handleEntityNotFound(_0x372058,null))[_0x1770('0x1c')](saveUpdates(_0xd1c7b5[_0x1770('0x53')],null))[_0x1770('0x1c')](respondWithResult(_0x372058,null))[_0x1770('0x27')](handleError(_0x372058,null));};exports[_0x1770('0x33')]=function(_0x27ed3c,_0x2a10b2){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x27ed3c[_0x1770('0x55')]['id']}})[_0x1770('0x1c')](handleEntityNotFound(_0x2a10b2,null))[_0x1770('0x1c')](removeEntity(_0x2a10b2,null))[_0x1770('0x27')](handleError(_0x2a10b2,null));};exports[_0x1770('0x56')]=function(_0x335bd2,_0x117115,_0x1014a9){var _0x307758={};var _0x12965e={};var _0x4c5d20;var _0x53df41;return db[_0x1770('0x3a')][_0x1770('0x57')]({'where':{'id':_0x335bd2['params']['id']}})[_0x1770('0x1c')](handleEntityNotFound(_0x117115,null))['then'](function(_0x242ae1){if(_0x242ae1){_0x4c5d20=_0x242ae1;_0x12965e[_0x1770('0x3f')]=_[_0x1770('0x51')](db[_0x1770('0x58')][_0x1770('0x3b')]);_0x12965e[_0x1770('0x40')]=_[_0x1770('0x51')](_0x335bd2[_0x1770('0x40')]);_0x12965e[_0x1770('0x41')]=_['intersection'](_0x12965e[_0x1770('0x3f')],_0x12965e['query']);_0x307758[_0x1770('0x43')]=_[_0x1770('0x42')](_0x12965e[_0x1770('0x3f')],qs[_0x1770('0x44')](_0x335bd2[_0x1770('0x40')][_0x1770('0x44')]));_0x307758[_0x1770('0x43')]=_0x307758[_0x1770('0x43')][_0x1770('0x45')]?_0x307758['attributes']:_0x12965e[_0x1770('0x3f')];_0x307758[_0x1770('0x47')]=qs[_0x1770('0x48')](_0x335bd2[_0x1770('0x40')][_0x1770('0x48')]);_0x307758[_0x1770('0x49')]=qs['filters'](_['pick'](_0x335bd2[_0x1770('0x40')],_0x12965e[_0x1770('0x41')]));if(_0x335bd2['query'][_0x1770('0x4a')]){_0x307758['where']=_[_0x1770('0x4b')](_0x307758[_0x1770('0x49')],{'$or':_[_0x1770('0x39')](_0x307758[_0x1770('0x43')],function(_0x59a800){var _0xc842dd={};_0xc842dd[_0x59a800]={'$like':'%'+_0x335bd2[_0x1770('0x40')]['filter']+'%'};return _0xc842dd;})});}_0x307758=_[_0x1770('0x4b')]({},_0x307758,_0x335bd2[_0x1770('0x4d')]);return _0x4c5d20[_0x1770('0x56')](_0x307758);}})['then'](function(_0x3651be){if(_0x3651be){_0x53df41=_0x3651be[_0x1770('0x45')];if(!_0x335bd2[_0x1770('0x40')]['hasOwnProperty']('nolimit')){_0x307758[_0x1770('0x2d')]=qs[_0x1770('0x2d')](_0x335bd2[_0x1770('0x40')][_0x1770('0x2d')]);_0x307758[_0x1770('0x2c')]=qs[_0x1770('0x2c')](_0x335bd2[_0x1770('0x40')][_0x1770('0x2c')]);}return _0x4c5d20['getFields'](_0x307758);}})['then'](function(_0x632bdf){if(_0x632bdf){return _0x632bdf?{'count':_0x53df41,'rows':_0x632bdf}:null;}})['then'](respondWithResult(_0x117115,null))[_0x1770('0x27')](handleError(_0x117115,null));};exports['getSubjects']=function(_0x2e7a36,_0x5d2e6b,_0xb1cd3a){var _0x329d7c={};var _0x2769aa={};var _0x524168;var _0x37fd62;return db[_0x1770('0x3a')][_0x1770('0x57')]({'where':{'id':_0x2e7a36['params']['id']}})[_0x1770('0x1c')](handleEntityNotFound(_0x5d2e6b,null))[_0x1770('0x1c')](function(_0x4056ef){if(_0x4056ef){_0x524168=_0x4056ef;_0x2769aa[_0x1770('0x3f')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x2769aa['query']=_[_0x1770('0x51')](_0x2e7a36['query']);_0x2769aa[_0x1770('0x41')]=_[_0x1770('0x42')](_0x2769aa[_0x1770('0x3f')],_0x2769aa[_0x1770('0x40')]);_0x329d7c[_0x1770('0x43')]=_[_0x1770('0x42')](_0x2769aa[_0x1770('0x3f')],qs[_0x1770('0x44')](_0x2e7a36[_0x1770('0x40')][_0x1770('0x44')]));_0x329d7c[_0x1770('0x43')]=_0x329d7c[_0x1770('0x43')][_0x1770('0x45')]?_0x329d7c['attributes']:_0x2769aa[_0x1770('0x3f')];_0x329d7c[_0x1770('0x47')]=qs[_0x1770('0x48')](_0x2e7a36[_0x1770('0x40')][_0x1770('0x48')]);_0x329d7c[_0x1770('0x49')]=qs[_0x1770('0x41')](_[_0x1770('0x59')](_0x2e7a36[_0x1770('0x40')],_0x2769aa[_0x1770('0x41')]));if(_0x2e7a36[_0x1770('0x40')][_0x1770('0x4a')]){_0x329d7c[_0x1770('0x49')]=_['merge'](_0x329d7c[_0x1770('0x49')],{'$or':_['map'](_0x329d7c['attributes'],function(_0x278ec9){var _0x4a86c4={};_0x4a86c4[_0x278ec9]={'$like':'%'+_0x2e7a36[_0x1770('0x40')][_0x1770('0x4a')]+'%'};return _0x4a86c4;})});}_0x329d7c=_[_0x1770('0x4b')]({},_0x329d7c,_0x2e7a36[_0x1770('0x4d')]);return _0x524168['getSubjects'](_0x329d7c);}})['then'](function(_0x1f2050){if(_0x1f2050){_0x37fd62=_0x1f2050[_0x1770('0x45')];if(!_0x2e7a36[_0x1770('0x40')][_0x1770('0x46')](_0x1770('0x5a'))){_0x329d7c['limit']=qs[_0x1770('0x2d')](_0x2e7a36[_0x1770('0x40')][_0x1770('0x2d')]);_0x329d7c[_0x1770('0x2c')]=qs[_0x1770('0x2c')](_0x2e7a36[_0x1770('0x40')]['offset']);}return _0x524168[_0x1770('0x5b')](_0x329d7c);}})['then'](function(_0x1188e3){if(_0x1188e3){return _0x1188e3?{'count':_0x37fd62,'rows':_0x1188e3}:null;}})[_0x1770('0x1c')](respondWithResult(_0x5d2e6b,null))[_0x1770('0x27')](handleError(_0x5d2e6b,null));};exports[_0x1770('0x5c')]=function(_0x38f4d4,_0x5ac114,_0x196639){var _0x1fec2f={};var _0x423c8f={};var _0x435067;var _0x3fba1b;return db[_0x1770('0x3a')][_0x1770('0x57')]({'where':{'id':_0x38f4d4['params']['id']}})[_0x1770('0x1c')](handleEntityNotFound(_0x5ac114,null))[_0x1770('0x1c')](function(_0x5321b8){if(_0x5321b8){_0x435067=_0x5321b8;_0x423c8f[_0x1770('0x3f')]=_['keys'](db[_0x1770('0x58')]['rawAttributes']);_0x423c8f[_0x1770('0x40')]=_[_0x1770('0x51')](_0x38f4d4[_0x1770('0x40')]);_0x423c8f['filters']=_[_0x1770('0x42')](_0x423c8f[_0x1770('0x3f')],_0x423c8f[_0x1770('0x40')]);_0x1fec2f[_0x1770('0x43')]=_[_0x1770('0x42')](_0x423c8f[_0x1770('0x3f')],qs['fields'](_0x38f4d4[_0x1770('0x40')][_0x1770('0x44')]));_0x1fec2f[_0x1770('0x43')]=_0x1fec2f['attributes'][_0x1770('0x45')]?_0x1fec2f[_0x1770('0x43')]:_0x423c8f['model'];_0x1fec2f[_0x1770('0x47')]=qs[_0x1770('0x48')](_0x38f4d4[_0x1770('0x40')][_0x1770('0x48')]);_0x1fec2f[_0x1770('0x49')]=qs[_0x1770('0x41')](_[_0x1770('0x59')](_0x38f4d4[_0x1770('0x40')],_0x423c8f[_0x1770('0x41')]));if(_0x38f4d4[_0x1770('0x40')][_0x1770('0x4a')]){_0x1fec2f['where']=_[_0x1770('0x4b')](_0x1fec2f[_0x1770('0x49')],{'$or':_[_0x1770('0x39')](_0x1fec2f['attributes'],function(_0x40251b){var _0x1daea8={};_0x1daea8[_0x40251b]={'$like':'%'+_0x38f4d4['query']['filter']+'%'};return _0x1daea8;})});}_0x1fec2f=_[_0x1770('0x4b')]({},_0x1fec2f,_0x38f4d4[_0x1770('0x4d')]);return _0x435067[_0x1770('0x5c')](_0x1fec2f);}})[_0x1770('0x1c')](function(_0x292719){if(_0x292719){_0x3fba1b=_0x292719['length'];if(!_0x38f4d4[_0x1770('0x40')][_0x1770('0x46')](_0x1770('0x5a'))){_0x1fec2f[_0x1770('0x2d')]=qs[_0x1770('0x2d')](_0x38f4d4['query'][_0x1770('0x2d')]);_0x1fec2f['offset']=qs['offset'](_0x38f4d4['query'][_0x1770('0x2c')]);}return _0x435067[_0x1770('0x5c')](_0x1fec2f);}})['then'](function(_0x422ec6){if(_0x422ec6){return _0x422ec6?{'count':_0x3fba1b,'rows':_0x422ec6}:null;}})['then'](respondWithResult(_0x5ac114,null))[_0x1770('0x27')](handleError(_0x5ac114,null));};exports[_0x1770('0x5d')]=function(_0x2a66bd,_0x6ef899,_0x4892e4){var _0x1c6c83={};var _0x23c8bf={};var _0x383ed4;var _0x82cb30;return db[_0x1770('0x3a')]['findOne']({'where':{'id':_0x2a66bd[_0x1770('0x55')]['id']}})[_0x1770('0x1c')](handleEntityNotFound(_0x6ef899,null))['then'](function(_0x5751af){if(_0x5751af){_0x383ed4=_0x5751af;_0x23c8bf[_0x1770('0x3f')]=_[_0x1770('0x51')](db[_0x1770('0x5e')]['rawAttributes']);_0x23c8bf['query']=_['keys'](_0x2a66bd[_0x1770('0x40')]);_0x23c8bf[_0x1770('0x41')]=_[_0x1770('0x42')](_0x23c8bf['model'],_0x23c8bf[_0x1770('0x40')]);_0x1c6c83[_0x1770('0x43')]=_[_0x1770('0x42')](_0x23c8bf[_0x1770('0x3f')],qs['fields'](_0x2a66bd['query'][_0x1770('0x44')]));_0x1c6c83[_0x1770('0x43')]=_0x1c6c83['attributes']['length']?_0x1c6c83[_0x1770('0x43')]:_0x23c8bf[_0x1770('0x3f')];_0x1c6c83[_0x1770('0x47')]=qs[_0x1770('0x48')](_0x2a66bd[_0x1770('0x40')]['sort']);_0x1c6c83[_0x1770('0x49')]=qs[_0x1770('0x41')](_[_0x1770('0x59')](_0x2a66bd[_0x1770('0x40')],_0x23c8bf[_0x1770('0x41')]));if(_0x2a66bd[_0x1770('0x40')][_0x1770('0x4a')]){_0x1c6c83[_0x1770('0x49')]=_['merge'](_0x1c6c83[_0x1770('0x49')],{'$or':_['map'](_0x1c6c83[_0x1770('0x43')],function(_0x40091b){var _0x5142ff={};_0x5142ff[_0x40091b]={'$like':'%'+_0x2a66bd[_0x1770('0x40')][_0x1770('0x4a')]+'%'};return _0x5142ff;})});}_0x1c6c83=_['merge']({},_0x1c6c83,_0x2a66bd['options']);return _0x383ed4[_0x1770('0x5d')](_0x1c6c83);}})[_0x1770('0x1c')](function(_0x3a32a4){if(_0x3a32a4){_0x82cb30=_0x3a32a4[_0x1770('0x45')];if(!_0x2a66bd[_0x1770('0x40')][_0x1770('0x46')](_0x1770('0x5a'))){_0x1c6c83[_0x1770('0x2d')]=qs[_0x1770('0x2d')](_0x2a66bd[_0x1770('0x40')][_0x1770('0x2d')]);_0x1c6c83[_0x1770('0x2c')]=qs[_0x1770('0x2c')](_0x2a66bd[_0x1770('0x40')][_0x1770('0x2c')]);}return _0x383ed4[_0x1770('0x5d')](_0x1c6c83);}})[_0x1770('0x1c')](function(_0x192625){if(_0x192625){return _0x192625?{'count':_0x82cb30,'rows':_0x192625}:null;}})[_0x1770('0x1c')](respondWithResult(_0x6ef899,null))[_0x1770('0x27')](handleError(_0x6ef899,null));};exports[_0x1770('0x5f')]=function(_0x441c1c,_0x430779,_0x256e96){if(_0x441c1c[_0x1770('0x53')]['id']){delete _0x441c1c['body']['id'];}return db[_0x1770('0x3a')][_0x1770('0x57')]({'where':{'id':_0x441c1c[_0x1770('0x55')]['id']}})[_0x1770('0x1c')](handleEntityNotFound(_0x430779,null))['then'](function(_0x337e6f){if(_0x337e6f){return _0x337e6f[_0x1770('0x5f')](_0x441c1c[_0x1770('0x53')][_0x1770('0x60')]||[]);}return null;})[_0x1770('0x1c')](respondWithResult(_0x430779,null))[_0x1770('0x27')](handleError(_0x430779,null));};
\ No newline at end of file
+var _0xbe96=['error','code','message','result','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save','update','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','rows','show','params','include','find','catch','create','body','getFields','findOne','order','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xbe96,0x100));var _0x6be9=function(_0x155d14,_0x1a1ada){_0x155d14=_0x155d14-0x0;var _0x32b6c0=_0xbe96[_0x155d14];return _0x32b6c0;};'use strict';var pdf=require(_0x6be9('0x0'));var emlformat=require(_0x6be9('0x1'));var rimraf=require(_0x6be9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6be9('0x3'));var rp=require(_0x6be9('0x4'));var moment=require(_0x6be9('0x5'));var BPromise=require(_0x6be9('0x6'));var Mustache=require(_0x6be9('0x7'));var util=require(_0x6be9('0x8'));var path=require(_0x6be9('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6be9('0xa'));var squel=require(_0x6be9('0xb'));var crypto=require(_0x6be9('0xc'));var jsforce=require(_0x6be9('0xd'));var deskjs=require(_0x6be9('0xe'));var toCsv=require(_0x6be9('0xf'));var querystring=require(_0x6be9('0x10'));var Papa=require(_0x6be9('0x11'));var Redis=require('ioredis');var authService=require(_0x6be9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6be9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6be9('0x14'))('api');var utils=require(_0x6be9('0x15'));var config=require(_0x6be9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6be9('0x17'))['db'];var jayson=require(_0x6be9('0x18'));var client=jayson[_0x6be9('0x19')][_0x6be9('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x66e987,_0x4cced3,_0x15f95e,_0x39843b){return new BPromise(function(_0x105c8b,_0x2c77e5){var _0x2fe9de=_0x39843b||client;return _0x2fe9de[_0x6be9('0x1b')](_0x66e987,_0x15f95e)[_0x6be9('0x1c')](function(_0x27e189){logger[_0x6be9('0x1d')](_0x6be9('0x1e'),_0x4cced3,'request\x20sent');logger[_0x6be9('0x1f')](_0x6be9('0x20'),_0x4cced3,_0x6be9('0x21'),JSON[_0x6be9('0x22')](_0x27e189));if(_0x27e189['error']){if(_0x27e189[_0x6be9('0x23')][_0x6be9('0x24')]===0x1f4){logger[_0x6be9('0x23')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4cced3,_0x27e189[_0x6be9('0x23')]['message']);return _0x2c77e5(_0x27e189[_0x6be9('0x23')][_0x6be9('0x25')]);}logger[_0x6be9('0x23')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4cced3,_0x27e189[_0x6be9('0x23')][_0x6be9('0x25')]);return _0x105c8b(_0x27e189[_0x6be9('0x23')][_0x6be9('0x25')]);}else{logger['info'](_0x6be9('0x1e'),_0x4cced3,_0x6be9('0x21'));_0x105c8b(_0x27e189[_0x6be9('0x26')]['message']);}})['catch'](function(_0x52ea56){logger[_0x6be9('0x23')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4cced3,_0x52ea56);_0x2c77e5(_0x52ea56);});});}function respondWithStatusCode(_0x445398,_0x47ed60){_0x47ed60=_0x47ed60||0xcc;return function(_0x508ef8){if(_0x508ef8){return _0x445398[_0x6be9('0x27')](_0x47ed60);}return _0x445398['status'](_0x47ed60)[_0x6be9('0x28')]();};}function respondWithResult(_0x17f34a,_0x1098d0){_0x1098d0=_0x1098d0||0xc8;return function(_0x243409){if(_0x243409){return _0x17f34a['status'](_0x1098d0)[_0x6be9('0x29')](_0x243409);}};}function respondWithFilteredResult(_0xb85c66,_0x4695a3){return function(_0x3ec54d){if(_0x3ec54d){var _0x2ec943=_0x3ec54d[_0x6be9('0x2a')],_0x243fb7=_0x4695a3[_0x6be9('0x2b')],_0x1e8c38=_0x4695a3[_0x6be9('0x2b')]+_0x4695a3[_0x6be9('0x2c')],_0x47b2b3;if(_0x1e8c38>=_0x2ec943){_0x1e8c38=_0x2ec943;_0x47b2b3=0xc8;}else{_0x47b2b3=0xce;}_0xb85c66[_0x6be9('0x2d')](_0x47b2b3);return _0xb85c66[_0x6be9('0x2e')]('Content-Range',_0x243fb7+'-'+_0x1e8c38+'/'+_0x2ec943)[_0x6be9('0x29')](_0x3ec54d);}return null;};}function patchUpdates(_0x53c3f5){return function(_0x5d419a){try{jsonpatch[_0x6be9('0x2f')](_0x5d419a,_0x53c3f5,!![]);}catch(_0x3084b3){return BPromise[_0x6be9('0x30')](_0x3084b3);}return _0x5d419a[_0x6be9('0x31')]();};}function saveUpdates(_0x13c1db,_0x18e35f){return function(_0x452015){if(_0x452015){return _0x452015[_0x6be9('0x32')](_0x13c1db)['then'](function(_0x14ee5a){return _0x14ee5a;});}return null;};}function removeEntity(_0x53f307,_0x330647){return function(_0x360af6){if(_0x360af6){return _0x360af6[_0x6be9('0x33')]()['then'](function(){_0x53f307[_0x6be9('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5eebd3,_0x33248b){return function(_0xf9bde0){if(!_0xf9bde0){_0x5eebd3[_0x6be9('0x27')](0x194);}return _0xf9bde0;};}function handleError(_0x2463bd,_0x2c4d9e){_0x2c4d9e=_0x2c4d9e||0x1f4;return function(_0x3a94e5){logger[_0x6be9('0x23')](_0x3a94e5[_0x6be9('0x34')]);if(_0x3a94e5[_0x6be9('0x35')]){delete _0x3a94e5[_0x6be9('0x35')];}_0x2463bd[_0x6be9('0x2d')](_0x2c4d9e)[_0x6be9('0x36')](_0x3a94e5);};}exports[_0x6be9('0x37')]=function(_0x37131e,_0x528f54){var _0x55611d={},_0x68f8cd={},_0x20a6da={'count':0x0,'rows':[]};var _0x5f35c3=_[_0x6be9('0x38')](db[_0x6be9('0x39')][_0x6be9('0x3a')],function(_0x5e5465){return{'name':_0x5e5465[_0x6be9('0x3b')],'type':_0x5e5465[_0x6be9('0x3c')][_0x6be9('0x3d')]};});_0x68f8cd[_0x6be9('0x3e')]=_['map'](_0x5f35c3,_0x6be9('0x35'));_0x68f8cd[_0x6be9('0x3f')]=_[_0x6be9('0x40')](_0x37131e[_0x6be9('0x3f')]);_0x68f8cd[_0x6be9('0x41')]=_['intersection'](_0x68f8cd[_0x6be9('0x3e')],_0x68f8cd[_0x6be9('0x3f')]);_0x55611d['attributes']=_[_0x6be9('0x42')](_0x68f8cd[_0x6be9('0x3e')],qs[_0x6be9('0x43')](_0x37131e['query'][_0x6be9('0x43')]));_0x55611d[_0x6be9('0x44')]=_0x55611d[_0x6be9('0x44')][_0x6be9('0x45')]?_0x55611d['attributes']:_0x68f8cd[_0x6be9('0x3e')];if(!_0x37131e[_0x6be9('0x3f')][_0x6be9('0x46')](_0x6be9('0x47'))){_0x55611d[_0x6be9('0x2c')]=qs[_0x6be9('0x2c')](_0x37131e['query'][_0x6be9('0x2c')]);_0x55611d['offset']=qs[_0x6be9('0x2b')](_0x37131e[_0x6be9('0x3f')][_0x6be9('0x2b')]);}_0x55611d['order']=qs[_0x6be9('0x48')](_0x37131e['query']['sort']);_0x55611d['where']=qs[_0x6be9('0x41')](_[_0x6be9('0x49')](_0x37131e['query'],_0x68f8cd[_0x6be9('0x41')]),_0x5f35c3);if(_0x37131e[_0x6be9('0x3f')][_0x6be9('0x4a')]){_0x55611d[_0x6be9('0x4b')]=_[_0x6be9('0x4c')](_0x55611d[_0x6be9('0x4b')],{'$or':_[_0x6be9('0x38')](_0x5f35c3,function(_0x341cd6){if(_0x341cd6[_0x6be9('0x3c')]!=='VIRTUAL'){var _0x4f1817={};_0x4f1817[_0x341cd6[_0x6be9('0x35')]]={'$like':'%'+_0x37131e['query'][_0x6be9('0x4a')]+'%'};return _0x4f1817;}})});}_0x55611d=_[_0x6be9('0x4c')]({},_0x55611d,_0x37131e[_0x6be9('0x4d')]);var _0x3f3122={'where':_0x55611d[_0x6be9('0x4b')]};return db[_0x6be9('0x39')][_0x6be9('0x2a')](_0x3f3122)['then'](function(_0x396fc2){_0x20a6da[_0x6be9('0x2a')]=_0x396fc2;if(_0x37131e[_0x6be9('0x3f')][_0x6be9('0x4e')]){_0x55611d['include']=[{'all':!![]}];}return db[_0x6be9('0x39')]['findAll'](_0x55611d);})[_0x6be9('0x1c')](function(_0x551284){_0x20a6da[_0x6be9('0x4f')]=_0x551284;return _0x20a6da;})['then'](respondWithFilteredResult(_0x528f54,_0x55611d))['catch'](handleError(_0x528f54,null));};exports[_0x6be9('0x50')]=function(_0x15348d,_0x15044d){var _0x87359f={'raw':![],'where':{'id':_0x15348d[_0x6be9('0x51')]['id']}},_0xbf22ac={};_0xbf22ac[_0x6be9('0x3e')]=_[_0x6be9('0x40')](db[_0x6be9('0x39')][_0x6be9('0x3a')]);_0xbf22ac['query']=_[_0x6be9('0x40')](_0x15348d['query']);_0xbf22ac[_0x6be9('0x41')]=_[_0x6be9('0x42')](_0xbf22ac[_0x6be9('0x3e')],_0xbf22ac['query']);_0x87359f[_0x6be9('0x44')]=_[_0x6be9('0x42')](_0xbf22ac[_0x6be9('0x3e')],qs['fields'](_0x15348d[_0x6be9('0x3f')][_0x6be9('0x43')]));_0x87359f[_0x6be9('0x44')]=_0x87359f[_0x6be9('0x44')][_0x6be9('0x45')]?_0x87359f[_0x6be9('0x44')]:_0xbf22ac[_0x6be9('0x3e')];if(_0x15348d[_0x6be9('0x3f')]['includeAll']){_0x87359f[_0x6be9('0x52')]=[{'all':!![]}];}_0x87359f=_['merge']({},_0x87359f,_0x15348d[_0x6be9('0x4d')]);return db[_0x6be9('0x39')][_0x6be9('0x53')](_0x87359f)[_0x6be9('0x1c')](handleEntityNotFound(_0x15044d,null))['then'](respondWithResult(_0x15044d,null))[_0x6be9('0x54')](handleError(_0x15044d,null));};exports['create']=function(_0xd18b22,_0x4495bf){return db[_0x6be9('0x39')][_0x6be9('0x55')](_0xd18b22['body'],{})['then'](respondWithResult(_0x4495bf,0xc9))[_0x6be9('0x54')](handleError(_0x4495bf,null));};exports[_0x6be9('0x32')]=function(_0x19257a,_0x28044b){if(_0x19257a['body']['id']){delete _0x19257a[_0x6be9('0x56')]['id'];}return db['FreshdeskConfiguration'][_0x6be9('0x53')]({'where':{'id':_0x19257a[_0x6be9('0x51')]['id']}})[_0x6be9('0x1c')](handleEntityNotFound(_0x28044b,null))[_0x6be9('0x1c')](saveUpdates(_0x19257a['body'],null))['then'](respondWithResult(_0x28044b,null))['catch'](handleError(_0x28044b,null));};exports[_0x6be9('0x33')]=function(_0xc1c50e,_0xc68288){return db[_0x6be9('0x39')]['find']({'where':{'id':_0xc1c50e['params']['id']}})['then'](handleEntityNotFound(_0xc68288,null))[_0x6be9('0x1c')](removeEntity(_0xc68288,null))['catch'](handleError(_0xc68288,null));};exports[_0x6be9('0x57')]=function(_0x46ab25,_0x25529c,_0x841434){var _0x43317e={};var _0x297e49={};var _0x546e87;var _0x3661df;return db['FreshdeskConfiguration'][_0x6be9('0x58')]({'where':{'id':_0x46ab25[_0x6be9('0x51')]['id']}})[_0x6be9('0x1c')](handleEntityNotFound(_0x25529c,null))[_0x6be9('0x1c')](function(_0x2d490e){if(_0x2d490e){_0x546e87=_0x2d490e;_0x297e49['model']=_[_0x6be9('0x40')](db['FreshdeskField'][_0x6be9('0x3a')]);_0x297e49['query']=_[_0x6be9('0x40')](_0x46ab25['query']);_0x297e49['filters']=_['intersection'](_0x297e49[_0x6be9('0x3e')],_0x297e49[_0x6be9('0x3f')]);_0x43317e[_0x6be9('0x44')]=_[_0x6be9('0x42')](_0x297e49[_0x6be9('0x3e')],qs['fields'](_0x46ab25[_0x6be9('0x3f')][_0x6be9('0x43')]));_0x43317e[_0x6be9('0x44')]=_0x43317e['attributes'][_0x6be9('0x45')]?_0x43317e['attributes']:_0x297e49[_0x6be9('0x3e')];_0x43317e[_0x6be9('0x59')]=qs['sort'](_0x46ab25[_0x6be9('0x3f')]['sort']);_0x43317e[_0x6be9('0x4b')]=qs[_0x6be9('0x41')](_[_0x6be9('0x49')](_0x46ab25[_0x6be9('0x3f')],_0x297e49[_0x6be9('0x41')]));if(_0x46ab25['query'][_0x6be9('0x4a')]){_0x43317e[_0x6be9('0x4b')]=_[_0x6be9('0x4c')](_0x43317e[_0x6be9('0x4b')],{'$or':_[_0x6be9('0x38')](_0x43317e[_0x6be9('0x44')],function(_0x5ec0e1){var _0x2865ac={};_0x2865ac[_0x5ec0e1]={'$like':'%'+_0x46ab25[_0x6be9('0x3f')][_0x6be9('0x4a')]+'%'};return _0x2865ac;})});}_0x43317e=_[_0x6be9('0x4c')]({},_0x43317e,_0x46ab25[_0x6be9('0x4d')]);return _0x546e87[_0x6be9('0x57')](_0x43317e);}})[_0x6be9('0x1c')](function(_0x22d03a){if(_0x22d03a){_0x3661df=_0x22d03a['length'];if(!_0x46ab25['query'][_0x6be9('0x46')](_0x6be9('0x47'))){_0x43317e[_0x6be9('0x2c')]=qs['limit'](_0x46ab25[_0x6be9('0x3f')][_0x6be9('0x2c')]);_0x43317e[_0x6be9('0x2b')]=qs[_0x6be9('0x2b')](_0x46ab25[_0x6be9('0x3f')][_0x6be9('0x2b')]);}return _0x546e87[_0x6be9('0x57')](_0x43317e);}})[_0x6be9('0x1c')](function(_0x1fc27c){if(_0x1fc27c){return _0x1fc27c?{'count':_0x3661df,'rows':_0x1fc27c}:null;}})[_0x6be9('0x1c')](respondWithResult(_0x25529c,null))[_0x6be9('0x54')](handleError(_0x25529c,null));};exports[_0x6be9('0x5a')]=function(_0x4681cb,_0x50736f,_0x49ec12){var _0x713d5b={};var _0x5366b1={};var _0x593e04;var _0x1aef82;return db['FreshdeskConfiguration'][_0x6be9('0x58')]({'where':{'id':_0x4681cb[_0x6be9('0x51')]['id']}})['then'](handleEntityNotFound(_0x50736f,null))[_0x6be9('0x1c')](function(_0x18825d){if(_0x18825d){_0x593e04=_0x18825d;_0x5366b1[_0x6be9('0x3e')]=_['keys'](db[_0x6be9('0x5b')][_0x6be9('0x3a')]);_0x5366b1[_0x6be9('0x3f')]=_[_0x6be9('0x40')](_0x4681cb[_0x6be9('0x3f')]);_0x5366b1[_0x6be9('0x41')]=_[_0x6be9('0x42')](_0x5366b1['model'],_0x5366b1[_0x6be9('0x3f')]);_0x713d5b[_0x6be9('0x44')]=_[_0x6be9('0x42')](_0x5366b1['model'],qs[_0x6be9('0x43')](_0x4681cb[_0x6be9('0x3f')][_0x6be9('0x43')]));_0x713d5b[_0x6be9('0x44')]=_0x713d5b[_0x6be9('0x44')]['length']?_0x713d5b[_0x6be9('0x44')]:_0x5366b1[_0x6be9('0x3e')];_0x713d5b[_0x6be9('0x59')]=qs[_0x6be9('0x48')](_0x4681cb['query'][_0x6be9('0x48')]);_0x713d5b[_0x6be9('0x4b')]=qs[_0x6be9('0x41')](_[_0x6be9('0x49')](_0x4681cb[_0x6be9('0x3f')],_0x5366b1[_0x6be9('0x41')]));if(_0x4681cb['query'][_0x6be9('0x4a')]){_0x713d5b[_0x6be9('0x4b')]=_[_0x6be9('0x4c')](_0x713d5b['where'],{'$or':_[_0x6be9('0x38')](_0x713d5b[_0x6be9('0x44')],function(_0x3adce4){var _0x584001={};_0x584001[_0x3adce4]={'$like':'%'+_0x4681cb[_0x6be9('0x3f')]['filter']+'%'};return _0x584001;})});}_0x713d5b=_['merge']({},_0x713d5b,_0x4681cb[_0x6be9('0x4d')]);return _0x593e04[_0x6be9('0x5a')](_0x713d5b);}})['then'](function(_0x2fdac5){if(_0x2fdac5){_0x1aef82=_0x2fdac5[_0x6be9('0x45')];if(!_0x4681cb[_0x6be9('0x3f')][_0x6be9('0x46')]('nolimit')){_0x713d5b[_0x6be9('0x2c')]=qs[_0x6be9('0x2c')](_0x4681cb[_0x6be9('0x3f')][_0x6be9('0x2c')]);_0x713d5b[_0x6be9('0x2b')]=qs[_0x6be9('0x2b')](_0x4681cb[_0x6be9('0x3f')][_0x6be9('0x2b')]);}return _0x593e04[_0x6be9('0x5a')](_0x713d5b);}})[_0x6be9('0x1c')](function(_0x44612b){if(_0x44612b){return _0x44612b?{'count':_0x1aef82,'rows':_0x44612b}:null;}})[_0x6be9('0x1c')](respondWithResult(_0x50736f,null))[_0x6be9('0x54')](handleError(_0x50736f,null));};exports[_0x6be9('0x5c')]=function(_0x2e7edc,_0x37bd2b,_0x26f85d){var _0x3bdd2={};var _0x174f42={};var _0x396e15;var _0x399ba6;return db[_0x6be9('0x39')][_0x6be9('0x58')]({'where':{'id':_0x2e7edc[_0x6be9('0x51')]['id']}})['then'](handleEntityNotFound(_0x37bd2b,null))[_0x6be9('0x1c')](function(_0x4917ab){if(_0x4917ab){_0x396e15=_0x4917ab;_0x174f42[_0x6be9('0x3e')]=_[_0x6be9('0x40')](db['FreshdeskField'][_0x6be9('0x3a')]);_0x174f42['query']=_['keys'](_0x2e7edc[_0x6be9('0x3f')]);_0x174f42[_0x6be9('0x41')]=_[_0x6be9('0x42')](_0x174f42[_0x6be9('0x3e')],_0x174f42[_0x6be9('0x3f')]);_0x3bdd2[_0x6be9('0x44')]=_['intersection'](_0x174f42[_0x6be9('0x3e')],qs[_0x6be9('0x43')](_0x2e7edc[_0x6be9('0x3f')][_0x6be9('0x43')]));_0x3bdd2['attributes']=_0x3bdd2['attributes'][_0x6be9('0x45')]?_0x3bdd2[_0x6be9('0x44')]:_0x174f42['model'];_0x3bdd2['order']=qs[_0x6be9('0x48')](_0x2e7edc['query'][_0x6be9('0x48')]);_0x3bdd2['where']=qs[_0x6be9('0x41')](_[_0x6be9('0x49')](_0x2e7edc['query'],_0x174f42[_0x6be9('0x41')]));if(_0x2e7edc[_0x6be9('0x3f')][_0x6be9('0x4a')]){_0x3bdd2[_0x6be9('0x4b')]=_['merge'](_0x3bdd2[_0x6be9('0x4b')],{'$or':_[_0x6be9('0x38')](_0x3bdd2['attributes'],function(_0x27f95e){var _0x4333f6={};_0x4333f6[_0x27f95e]={'$like':'%'+_0x2e7edc[_0x6be9('0x3f')]['filter']+'%'};return _0x4333f6;})});}_0x3bdd2=_[_0x6be9('0x4c')]({},_0x3bdd2,_0x2e7edc[_0x6be9('0x4d')]);return _0x396e15[_0x6be9('0x5c')](_0x3bdd2);}})[_0x6be9('0x1c')](function(_0x49ea94){if(_0x49ea94){_0x399ba6=_0x49ea94[_0x6be9('0x45')];if(!_0x2e7edc['query']['hasOwnProperty']('nolimit')){_0x3bdd2[_0x6be9('0x2c')]=qs[_0x6be9('0x2c')](_0x2e7edc['query'][_0x6be9('0x2c')]);_0x3bdd2[_0x6be9('0x2b')]=qs['offset'](_0x2e7edc['query'][_0x6be9('0x2b')]);}return _0x396e15['getDescriptions'](_0x3bdd2);}})['then'](function(_0x2e7c31){if(_0x2e7c31){return _0x2e7c31?{'count':_0x399ba6,'rows':_0x2e7c31}:null;}})[_0x6be9('0x1c')](respondWithResult(_0x37bd2b,null))[_0x6be9('0x54')](handleError(_0x37bd2b,null));};exports[_0x6be9('0x5d')]=function(_0x1e22ed,_0x43caa5,_0x1a256b){var _0x47648d={};var _0xe796d0={};var _0x3e42cd;var _0x2a74dd;return db[_0x6be9('0x39')][_0x6be9('0x58')]({'where':{'id':_0x1e22ed['params']['id']}})[_0x6be9('0x1c')](handleEntityNotFound(_0x43caa5,null))[_0x6be9('0x1c')](function(_0x23dc55){if(_0x23dc55){_0x3e42cd=_0x23dc55;_0xe796d0[_0x6be9('0x3e')]=_[_0x6be9('0x40')](db[_0x6be9('0x5e')]['rawAttributes']);_0xe796d0[_0x6be9('0x3f')]=_[_0x6be9('0x40')](_0x1e22ed[_0x6be9('0x3f')]);_0xe796d0[_0x6be9('0x41')]=_[_0x6be9('0x42')](_0xe796d0[_0x6be9('0x3e')],_0xe796d0[_0x6be9('0x3f')]);_0x47648d[_0x6be9('0x44')]=_[_0x6be9('0x42')](_0xe796d0['model'],qs[_0x6be9('0x43')](_0x1e22ed[_0x6be9('0x3f')][_0x6be9('0x43')]));_0x47648d['attributes']=_0x47648d[_0x6be9('0x44')][_0x6be9('0x45')]?_0x47648d['attributes']:_0xe796d0['model'];_0x47648d[_0x6be9('0x59')]=qs['sort'](_0x1e22ed[_0x6be9('0x3f')]['sort']);_0x47648d[_0x6be9('0x4b')]=qs[_0x6be9('0x41')](_['pick'](_0x1e22ed[_0x6be9('0x3f')],_0xe796d0[_0x6be9('0x41')]));if(_0x1e22ed[_0x6be9('0x3f')][_0x6be9('0x4a')]){_0x47648d[_0x6be9('0x4b')]=_[_0x6be9('0x4c')](_0x47648d[_0x6be9('0x4b')],{'$or':_[_0x6be9('0x38')](_0x47648d[_0x6be9('0x44')],function(_0x215352){var _0x2226c1={};_0x2226c1[_0x215352]={'$like':'%'+_0x1e22ed[_0x6be9('0x3f')][_0x6be9('0x4a')]+'%'};return _0x2226c1;})});}_0x47648d=_[_0x6be9('0x4c')]({},_0x47648d,_0x1e22ed[_0x6be9('0x4d')]);return _0x3e42cd[_0x6be9('0x5d')](_0x47648d);}})[_0x6be9('0x1c')](function(_0x1760dd){if(_0x1760dd){_0x2a74dd=_0x1760dd[_0x6be9('0x45')];if(!_0x1e22ed['query'][_0x6be9('0x46')](_0x6be9('0x47'))){_0x47648d[_0x6be9('0x2c')]=qs['limit'](_0x1e22ed[_0x6be9('0x3f')][_0x6be9('0x2c')]);_0x47648d[_0x6be9('0x2b')]=qs[_0x6be9('0x2b')](_0x1e22ed[_0x6be9('0x3f')][_0x6be9('0x2b')]);}return _0x3e42cd[_0x6be9('0x5d')](_0x47648d);}})[_0x6be9('0x1c')](function(_0xd64660){if(_0xd64660){return _0xd64660?{'count':_0x2a74dd,'rows':_0xd64660}:null;}})[_0x6be9('0x1c')](respondWithResult(_0x43caa5,null))[_0x6be9('0x54')](handleError(_0x43caa5,null));};exports['setTags']=function(_0x399bbd,_0x25eef6,_0x2b721b){if(_0x399bbd[_0x6be9('0x56')]['id']){delete _0x399bbd['body']['id'];}return db[_0x6be9('0x39')][_0x6be9('0x58')]({'where':{'id':_0x399bbd[_0x6be9('0x51')]['id']}})[_0x6be9('0x1c')](handleEntityNotFound(_0x25eef6,null))[_0x6be9('0x1c')](function(_0x3ab03e){if(_0x3ab03e){return _0x3ab03e[_0x6be9('0x5f')](_0x399bbd[_0x6be9('0x56')][_0x6be9('0x60')]||[]);}return null;})['then'](respondWithResult(_0x25eef6,null))[_0x6be9('0x54')](handleError(_0x25eef6,null));};
\ No newline at end of file