Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / intFreshdeskConfiguration / intFreshdeskConfiguration.controller.js
index 098e1cd..012283f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc101=['util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','create','body','find','getFields','hasOwnProperty','getSubjects','findOne','FreshdeskField','pick','map','getDescriptions','getTags','setTags','rimraf','request-promise','moment','mustache'];(function(_0x164a40,_0xb704f7){var _0x2a551a=function(_0x8c0588){while(--_0x8c0588){_0x164a40['push'](_0x164a40['shift']());}};_0x2a551a(++_0xb704f7);}(_0xc101,0x187));var _0x1c10=function(_0x438912,_0x3f7f74){_0x438912=_0x438912-0x0;var _0x18112f=_0xc101[_0x438912];return _0x18112f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c10('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1c10('0x1'));var moment=require(_0x1c10('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1c10('0x3'));var util=require(_0x1c10('0x4'));var path=require(_0x1c10('0x5'));var sox=require(_0x1c10('0x6'));var csv=require('to-csv');var ejs=require(_0x1c10('0x7'));var fs=require('fs');var fs_extra=require(_0x1c10('0x8'));var _=require('lodash');var squel=require(_0x1c10('0x9'));var crypto=require('crypto');var jsforce=require(_0x1c10('0xa'));var deskjs=require(_0x1c10('0xb'));var toCsv=require(_0x1c10('0xc'));var querystring=require(_0x1c10('0xd'));var Papa=require('papaparse');var Redis=require(_0x1c10('0xe'));var authService=require(_0x1c10('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1c10('0x10'));var hardwareService=require(_0x1c10('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1c10('0x12'));var licenseUtil=require(_0x1c10('0x13'));var db=require(_0x1c10('0x14'))['db'];function respondWithStatusCode(_0x254b93,_0x2f59fd){_0x2f59fd=_0x2f59fd||0xcc;return function(_0x4cc69b){if(_0x4cc69b){return _0x254b93[_0x1c10('0x15')](_0x2f59fd);}return _0x254b93[_0x1c10('0x16')](_0x2f59fd)[_0x1c10('0x17')]();};}function respondWithResult(_0x4c372d,_0x205e66){_0x205e66=_0x205e66||0xc8;return function(_0x4c138c){if(_0x4c138c){return _0x4c372d[_0x1c10('0x16')](_0x205e66)[_0x1c10('0x18')](_0x4c138c);}};}function respondWithFilteredResult(_0x4253b7,_0x35420c){return function(_0x397a1b){if(_0x397a1b){var _0x3476b4=typeof _0x35420c[_0x1c10('0x19')]===_0x1c10('0x1a')&&typeof _0x35420c[_0x1c10('0x1b')]===_0x1c10('0x1a');var _0x1c96e4=_0x397a1b[_0x1c10('0x1c')];var _0x431bd8=_0x3476b4?0x0:_0x35420c[_0x1c10('0x19')];var _0x111a00=_0x3476b4?_0x397a1b[_0x1c10('0x1c')]:_0x35420c[_0x1c10('0x19')]+_0x35420c[_0x1c10('0x1b')];var _0x13ec3b;if(_0x111a00>=_0x1c96e4){_0x111a00=_0x1c96e4;_0x13ec3b=0xc8;}else{_0x13ec3b=0xce;}_0x4253b7[_0x1c10('0x16')](_0x13ec3b);return _0x4253b7['set']('Content-Range',_0x431bd8+'-'+_0x111a00+'/'+_0x1c96e4)['json'](_0x397a1b);}return null;};}function patchUpdates(_0x4724b1){return function(_0x19e3f8){try{jsonpatch[_0x1c10('0x1d')](_0x19e3f8,_0x4724b1,!![]);}catch(_0x495388){return BPromise[_0x1c10('0x1e')](_0x495388);}return _0x19e3f8[_0x1c10('0x1f')]();};}function saveUpdates(_0x4786c2,_0x19d129){return function(_0x403f80){if(_0x403f80){return _0x403f80[_0x1c10('0x20')](_0x4786c2)[_0x1c10('0x21')](function(_0x434795){return _0x434795;});}return null;};}function removeEntity(_0x568b73,_0xb148e){return function(_0x126dea){if(_0x126dea){return _0x126dea[_0x1c10('0x22')]()['then'](function(){_0x568b73['status'](0xcc)[_0x1c10('0x17')]();});}};}function handleEntityNotFound(_0x475666,_0x3c0f14){return function(_0x51d889){if(!_0x51d889){_0x475666[_0x1c10('0x15')](0x194);}return _0x51d889;};}function handleError(_0x75c20d,_0x39e59a){_0x39e59a=_0x39e59a||0x1f4;return function(_0x9a1af0){logger[_0x1c10('0x23')](_0x9a1af0['stack']);if(_0x9a1af0[_0x1c10('0x24')]){delete _0x9a1af0[_0x1c10('0x24')];}_0x75c20d[_0x1c10('0x16')](_0x39e59a)[_0x1c10('0x25')](_0x9a1af0);};}exports[_0x1c10('0x26')]=function(_0x5a91fd,_0x1630a3){var _0x1497e3={},_0x1f667c={},_0x329aa4={'count':0x0,'rows':[]};var _0x27d4bf=_['map'](db[_0x1c10('0x27')][_0x1c10('0x28')],function(_0x1a176c){return{'name':_0x1a176c[_0x1c10('0x29')],'type':_0x1a176c[_0x1c10('0x2a')][_0x1c10('0x2b')]};});_0x1f667c['model']=_['map'](_0x27d4bf,_0x1c10('0x24'));_0x1f667c[_0x1c10('0x2c')]=_[_0x1c10('0x2d')](_0x5a91fd['query']);_0x1f667c[_0x1c10('0x2e')]=_[_0x1c10('0x2f')](_0x1f667c[_0x1c10('0x30')],_0x1f667c[_0x1c10('0x2c')]);_0x1497e3[_0x1c10('0x31')]=_[_0x1c10('0x2f')](_0x1f667c[_0x1c10('0x30')],qs[_0x1c10('0x32')](_0x5a91fd[_0x1c10('0x2c')]['fields']));_0x1497e3[_0x1c10('0x31')]=_0x1497e3['attributes'][_0x1c10('0x33')]?_0x1497e3[_0x1c10('0x31')]:_0x1f667c[_0x1c10('0x30')];if(!_0x5a91fd[_0x1c10('0x2c')]['hasOwnProperty'](_0x1c10('0x34'))){_0x1497e3['limit']=qs[_0x1c10('0x1b')](_0x5a91fd[_0x1c10('0x2c')][_0x1c10('0x1b')]);_0x1497e3[_0x1c10('0x19')]=qs[_0x1c10('0x19')](_0x5a91fd[_0x1c10('0x2c')][_0x1c10('0x19')]);}_0x1497e3[_0x1c10('0x35')]=qs[_0x1c10('0x36')](_0x5a91fd['query'][_0x1c10('0x36')]);_0x1497e3[_0x1c10('0x37')]=qs[_0x1c10('0x2e')](_['pick'](_0x5a91fd[_0x1c10('0x2c')],_0x1f667c[_0x1c10('0x2e')]),_0x27d4bf);if(_0x5a91fd[_0x1c10('0x2c')][_0x1c10('0x38')]){_0x1497e3[_0x1c10('0x37')]=_[_0x1c10('0x39')](_0x1497e3[_0x1c10('0x37')],{'$or':_['map'](_0x27d4bf,function(_0x45a89c){if(_0x45a89c[_0x1c10('0x2a')]!==_0x1c10('0x3a')){var _0x3850f8={};_0x3850f8[_0x45a89c[_0x1c10('0x24')]]={'$like':'%'+_0x5a91fd[_0x1c10('0x2c')]['filter']+'%'};return _0x3850f8;}})});}_0x1497e3=_[_0x1c10('0x39')]({},_0x1497e3,_0x5a91fd[_0x1c10('0x3b')]);var _0x14da01={'where':_0x1497e3[_0x1c10('0x37')]};return db[_0x1c10('0x27')]['count'](_0x14da01)[_0x1c10('0x21')](function(_0x5eb985){_0x329aa4[_0x1c10('0x1c')]=_0x5eb985;if(_0x5a91fd['query']['includeAll']){_0x1497e3[_0x1c10('0x3c')]=[{'all':!![]}];}return db[_0x1c10('0x27')][_0x1c10('0x3d')](_0x1497e3);})['then'](function(_0x40d9e5){_0x329aa4[_0x1c10('0x3e')]=_0x40d9e5;return _0x329aa4;})[_0x1c10('0x21')](respondWithFilteredResult(_0x1630a3,_0x1497e3))[_0x1c10('0x3f')](handleError(_0x1630a3,null));};exports['show']=function(_0x179865,_0x32f7e9){var _0x5972aa={'raw':![],'where':{'id':_0x179865[_0x1c10('0x40')]['id']}},_0x3a9d47={};_0x3a9d47[_0x1c10('0x30')]=_[_0x1c10('0x2d')](db[_0x1c10('0x27')][_0x1c10('0x28')]);_0x3a9d47['query']=_[_0x1c10('0x2d')](_0x179865[_0x1c10('0x2c')]);_0x3a9d47['filters']=_[_0x1c10('0x2f')](_0x3a9d47[_0x1c10('0x30')],_0x3a9d47['query']);_0x5972aa[_0x1c10('0x31')]=_[_0x1c10('0x2f')](_0x3a9d47[_0x1c10('0x30')],qs[_0x1c10('0x32')](_0x179865['query'][_0x1c10('0x32')]));_0x5972aa['attributes']=_0x5972aa[_0x1c10('0x31')][_0x1c10('0x33')]?_0x5972aa['attributes']:_0x3a9d47[_0x1c10('0x30')];if(_0x179865[_0x1c10('0x2c')][_0x1c10('0x41')]){_0x5972aa[_0x1c10('0x3c')]=[{'all':!![]}];}_0x5972aa=_['merge']({},_0x5972aa,_0x179865[_0x1c10('0x3b')]);return db['FreshdeskConfiguration']['find'](_0x5972aa)[_0x1c10('0x21')](handleEntityNotFound(_0x32f7e9,null))[_0x1c10('0x21')](respondWithResult(_0x32f7e9,null))[_0x1c10('0x3f')](handleError(_0x32f7e9,null));};exports['create']=function(_0x2066c2,_0x352eab){return db['FreshdeskConfiguration'][_0x1c10('0x42')](_0x2066c2[_0x1c10('0x43')],{})[_0x1c10('0x21')](respondWithResult(_0x352eab,0xc9))['catch'](handleError(_0x352eab,null));};exports[_0x1c10('0x20')]=function(_0x22f57f,_0x4c3b51){if(_0x22f57f[_0x1c10('0x43')]['id']){delete _0x22f57f['body']['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x22f57f['params']['id']}})['then'](handleEntityNotFound(_0x4c3b51,null))[_0x1c10('0x21')](saveUpdates(_0x22f57f[_0x1c10('0x43')],null))[_0x1c10('0x21')](respondWithResult(_0x4c3b51,null))[_0x1c10('0x3f')](handleError(_0x4c3b51,null));};exports['destroy']=function(_0x39fd94,_0x1bfd65){return db['FreshdeskConfiguration'][_0x1c10('0x44')]({'where':{'id':_0x39fd94[_0x1c10('0x40')]['id']}})['then'](handleEntityNotFound(_0x1bfd65,null))[_0x1c10('0x21')](removeEntity(_0x1bfd65,null))[_0x1c10('0x3f')](handleError(_0x1bfd65,null));};exports['getFields']=function(_0x555a0c,_0x443409,_0x4419e1){var _0x56d1be={};var _0x41e85a={};var _0xf40a80;var _0x868516;return db[_0x1c10('0x27')]['findOne']({'where':{'id':_0x555a0c[_0x1c10('0x40')]['id']}})[_0x1c10('0x21')](handleEntityNotFound(_0x443409,null))[_0x1c10('0x21')](function(_0xda803b){if(_0xda803b){_0xf40a80=_0xda803b;_0x41e85a[_0x1c10('0x30')]=_[_0x1c10('0x2d')](db['FreshdeskField'][_0x1c10('0x28')]);_0x41e85a[_0x1c10('0x2c')]=_[_0x1c10('0x2d')](_0x555a0c[_0x1c10('0x2c')]);_0x41e85a['filters']=_['intersection'](_0x41e85a[_0x1c10('0x30')],_0x41e85a[_0x1c10('0x2c')]);_0x56d1be[_0x1c10('0x31')]=_[_0x1c10('0x2f')](_0x41e85a[_0x1c10('0x30')],qs[_0x1c10('0x32')](_0x555a0c['query'][_0x1c10('0x32')]));_0x56d1be[_0x1c10('0x31')]=_0x56d1be[_0x1c10('0x31')][_0x1c10('0x33')]?_0x56d1be[_0x1c10('0x31')]:_0x41e85a[_0x1c10('0x30')];_0x56d1be[_0x1c10('0x35')]=qs[_0x1c10('0x36')](_0x555a0c[_0x1c10('0x2c')][_0x1c10('0x36')]);_0x56d1be['where']=qs[_0x1c10('0x2e')](_['pick'](_0x555a0c['query'],_0x41e85a[_0x1c10('0x2e')]));if(_0x555a0c[_0x1c10('0x2c')]['filter']){_0x56d1be[_0x1c10('0x37')]=_[_0x1c10('0x39')](_0x56d1be['where'],{'$or':_['map'](_0x56d1be[_0x1c10('0x31')],function(_0x246ab7){var _0x1e5148={};_0x1e5148[_0x246ab7]={'$like':'%'+_0x555a0c[_0x1c10('0x2c')][_0x1c10('0x38')]+'%'};return _0x1e5148;})});}_0x56d1be=_[_0x1c10('0x39')]({},_0x56d1be,_0x555a0c[_0x1c10('0x3b')]);return _0xf40a80[_0x1c10('0x45')](_0x56d1be);}})[_0x1c10('0x21')](function(_0x15b74c){if(_0x15b74c){_0x868516=_0x15b74c[_0x1c10('0x33')];if(!_0x555a0c[_0x1c10('0x2c')][_0x1c10('0x46')](_0x1c10('0x34'))){_0x56d1be[_0x1c10('0x1b')]=qs[_0x1c10('0x1b')](_0x555a0c['query'][_0x1c10('0x1b')]);_0x56d1be['offset']=qs['offset'](_0x555a0c[_0x1c10('0x2c')]['offset']);}return _0xf40a80[_0x1c10('0x45')](_0x56d1be);}})[_0x1c10('0x21')](function(_0x17e15f){if(_0x17e15f){return _0x17e15f?{'count':_0x868516,'rows':_0x17e15f}:null;}})[_0x1c10('0x21')](respondWithResult(_0x443409,null))[_0x1c10('0x3f')](handleError(_0x443409,null));};exports[_0x1c10('0x47')]=function(_0x1b1572,_0x23163f,_0x63d1c4){var _0xb2b376={};var _0x3d3945={};var _0x1d3497;var _0x3c6192;return db[_0x1c10('0x27')][_0x1c10('0x48')]({'where':{'id':_0x1b1572[_0x1c10('0x40')]['id']}})['then'](handleEntityNotFound(_0x23163f,null))[_0x1c10('0x21')](function(_0x1afe90){if(_0x1afe90){_0x1d3497=_0x1afe90;_0x3d3945[_0x1c10('0x30')]=_[_0x1c10('0x2d')](db[_0x1c10('0x49')][_0x1c10('0x28')]);_0x3d3945['query']=_[_0x1c10('0x2d')](_0x1b1572[_0x1c10('0x2c')]);_0x3d3945['filters']=_['intersection'](_0x3d3945['model'],_0x3d3945[_0x1c10('0x2c')]);_0xb2b376[_0x1c10('0x31')]=_[_0x1c10('0x2f')](_0x3d3945[_0x1c10('0x30')],qs[_0x1c10('0x32')](_0x1b1572[_0x1c10('0x2c')]['fields']));_0xb2b376['attributes']=_0xb2b376['attributes'][_0x1c10('0x33')]?_0xb2b376[_0x1c10('0x31')]:_0x3d3945[_0x1c10('0x30')];_0xb2b376[_0x1c10('0x35')]=qs['sort'](_0x1b1572[_0x1c10('0x2c')]['sort']);_0xb2b376['where']=qs[_0x1c10('0x2e')](_[_0x1c10('0x4a')](_0x1b1572['query'],_0x3d3945[_0x1c10('0x2e')]));if(_0x1b1572[_0x1c10('0x2c')][_0x1c10('0x38')]){_0xb2b376[_0x1c10('0x37')]=_[_0x1c10('0x39')](_0xb2b376[_0x1c10('0x37')],{'$or':_[_0x1c10('0x4b')](_0xb2b376[_0x1c10('0x31')],function(_0x5a8436){var _0x29fd3f={};_0x29fd3f[_0x5a8436]={'$like':'%'+_0x1b1572['query'][_0x1c10('0x38')]+'%'};return _0x29fd3f;})});}_0xb2b376=_['merge']({},_0xb2b376,_0x1b1572['options']);return _0x1d3497[_0x1c10('0x47')](_0xb2b376);}})[_0x1c10('0x21')](function(_0x9d0868){if(_0x9d0868){_0x3c6192=_0x9d0868[_0x1c10('0x33')];if(!_0x1b1572['query'][_0x1c10('0x46')](_0x1c10('0x34'))){_0xb2b376[_0x1c10('0x1b')]=qs[_0x1c10('0x1b')](_0x1b1572[_0x1c10('0x2c')][_0x1c10('0x1b')]);_0xb2b376[_0x1c10('0x19')]=qs[_0x1c10('0x19')](_0x1b1572[_0x1c10('0x2c')][_0x1c10('0x19')]);}return _0x1d3497[_0x1c10('0x47')](_0xb2b376);}})['then'](function(_0x46bfb0){if(_0x46bfb0){return _0x46bfb0?{'count':_0x3c6192,'rows':_0x46bfb0}:null;}})[_0x1c10('0x21')](respondWithResult(_0x23163f,null))[_0x1c10('0x3f')](handleError(_0x23163f,null));};exports[_0x1c10('0x4c')]=function(_0x2825d4,_0x1812bc,_0x13c9b5){var _0x160081={};var _0x155224={};var _0x578924;var _0x150ac0;return db[_0x1c10('0x27')]['findOne']({'where':{'id':_0x2825d4[_0x1c10('0x40')]['id']}})['then'](handleEntityNotFound(_0x1812bc,null))[_0x1c10('0x21')](function(_0x41a07d){if(_0x41a07d){_0x578924=_0x41a07d;_0x155224[_0x1c10('0x30')]=_[_0x1c10('0x2d')](db[_0x1c10('0x49')][_0x1c10('0x28')]);_0x155224[_0x1c10('0x2c')]=_[_0x1c10('0x2d')](_0x2825d4[_0x1c10('0x2c')]);_0x155224['filters']=_[_0x1c10('0x2f')](_0x155224[_0x1c10('0x30')],_0x155224['query']);_0x160081[_0x1c10('0x31')]=_[_0x1c10('0x2f')](_0x155224[_0x1c10('0x30')],qs[_0x1c10('0x32')](_0x2825d4['query'][_0x1c10('0x32')]));_0x160081[_0x1c10('0x31')]=_0x160081[_0x1c10('0x31')][_0x1c10('0x33')]?_0x160081[_0x1c10('0x31')]:_0x155224[_0x1c10('0x30')];_0x160081[_0x1c10('0x35')]=qs['sort'](_0x2825d4[_0x1c10('0x2c')][_0x1c10('0x36')]);_0x160081['where']=qs['filters'](_[_0x1c10('0x4a')](_0x2825d4[_0x1c10('0x2c')],_0x155224[_0x1c10('0x2e')]));if(_0x2825d4['query'][_0x1c10('0x38')]){_0x160081[_0x1c10('0x37')]=_[_0x1c10('0x39')](_0x160081[_0x1c10('0x37')],{'$or':_['map'](_0x160081[_0x1c10('0x31')],function(_0x2ffddd){var _0x7ef648={};_0x7ef648[_0x2ffddd]={'$like':'%'+_0x2825d4[_0x1c10('0x2c')][_0x1c10('0x38')]+'%'};return _0x7ef648;})});}_0x160081=_[_0x1c10('0x39')]({},_0x160081,_0x2825d4[_0x1c10('0x3b')]);return _0x578924[_0x1c10('0x4c')](_0x160081);}})['then'](function(_0x28050f){if(_0x28050f){_0x150ac0=_0x28050f[_0x1c10('0x33')];if(!_0x2825d4['query']['hasOwnProperty'](_0x1c10('0x34'))){_0x160081[_0x1c10('0x1b')]=qs['limit'](_0x2825d4[_0x1c10('0x2c')][_0x1c10('0x1b')]);_0x160081['offset']=qs['offset'](_0x2825d4[_0x1c10('0x2c')][_0x1c10('0x19')]);}return _0x578924[_0x1c10('0x4c')](_0x160081);}})['then'](function(_0x5b5643){if(_0x5b5643){return _0x5b5643?{'count':_0x150ac0,'rows':_0x5b5643}:null;}})[_0x1c10('0x21')](respondWithResult(_0x1812bc,null))['catch'](handleError(_0x1812bc,null));};exports['getTags']=function(_0xc53e3c,_0x2b6516,_0x247482){var _0x5e2ace={};var _0x1c125d={};var _0x92c32c;var _0x48213e;return db[_0x1c10('0x27')][_0x1c10('0x48')]({'where':{'id':_0xc53e3c[_0x1c10('0x40')]['id']}})[_0x1c10('0x21')](handleEntityNotFound(_0x2b6516,null))[_0x1c10('0x21')](function(_0x3aeeeb){if(_0x3aeeeb){_0x92c32c=_0x3aeeeb;_0x1c125d[_0x1c10('0x30')]=_[_0x1c10('0x2d')](db['Tag'][_0x1c10('0x28')]);_0x1c125d['query']=_[_0x1c10('0x2d')](_0xc53e3c[_0x1c10('0x2c')]);_0x1c125d['filters']=_['intersection'](_0x1c125d[_0x1c10('0x30')],_0x1c125d[_0x1c10('0x2c')]);_0x5e2ace[_0x1c10('0x31')]=_[_0x1c10('0x2f')](_0x1c125d[_0x1c10('0x30')],qs[_0x1c10('0x32')](_0xc53e3c[_0x1c10('0x2c')]['fields']));_0x5e2ace[_0x1c10('0x31')]=_0x5e2ace['attributes'][_0x1c10('0x33')]?_0x5e2ace['attributes']:_0x1c125d[_0x1c10('0x30')];_0x5e2ace[_0x1c10('0x35')]=qs['sort'](_0xc53e3c[_0x1c10('0x2c')][_0x1c10('0x36')]);_0x5e2ace[_0x1c10('0x37')]=qs['filters'](_[_0x1c10('0x4a')](_0xc53e3c[_0x1c10('0x2c')],_0x1c125d[_0x1c10('0x2e')]));if(_0xc53e3c[_0x1c10('0x2c')]['filter']){_0x5e2ace[_0x1c10('0x37')]=_[_0x1c10('0x39')](_0x5e2ace[_0x1c10('0x37')],{'$or':_[_0x1c10('0x4b')](_0x5e2ace[_0x1c10('0x31')],function(_0x5cc4fa){var _0xf32d59={};_0xf32d59[_0x5cc4fa]={'$like':'%'+_0xc53e3c[_0x1c10('0x2c')]['filter']+'%'};return _0xf32d59;})});}_0x5e2ace=_['merge']({},_0x5e2ace,_0xc53e3c['options']);return _0x92c32c[_0x1c10('0x4d')](_0x5e2ace);}})[_0x1c10('0x21')](function(_0xe0eaf7){if(_0xe0eaf7){_0x48213e=_0xe0eaf7[_0x1c10('0x33')];if(!_0xc53e3c['query']['hasOwnProperty'](_0x1c10('0x34'))){_0x5e2ace[_0x1c10('0x1b')]=qs[_0x1c10('0x1b')](_0xc53e3c['query']['limit']);_0x5e2ace['offset']=qs[_0x1c10('0x19')](_0xc53e3c[_0x1c10('0x2c')][_0x1c10('0x19')]);}return _0x92c32c['getTags'](_0x5e2ace);}})[_0x1c10('0x21')](function(_0xbd3954){if(_0xbd3954){return _0xbd3954?{'count':_0x48213e,'rows':_0xbd3954}:null;}})[_0x1c10('0x21')](respondWithResult(_0x2b6516,null))[_0x1c10('0x3f')](handleError(_0x2b6516,null));};exports['setTags']=function(_0x84386b,_0xa46fa6,_0x38dd23){if(_0x84386b['body']['id']){delete _0x84386b[_0x1c10('0x43')]['id'];}return db[_0x1c10('0x27')][_0x1c10('0x48')]({'where':{'id':_0x84386b[_0x1c10('0x40')]['id']}})[_0x1c10('0x21')](handleEntityNotFound(_0xa46fa6,null))['then'](function(_0x244c22){if(_0x244c22){return _0x244c22[_0x1c10('0x4e')](_0x84386b[_0x1c10('0x43')]['ids']||[]);}return null;})['then'](respondWithResult(_0xa46fa6,null))['catch'](handleError(_0xa46fa6,null));};
\ No newline at end of file
+var _0x3879=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','stack','name','send','map','FreshdeskConfiguration','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','rows','catch','params','rawAttributes','includeAll','include','find','create','body','getFields','FreshdeskField','pick','findOne','keys','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x291f14,_0x32ddbc){var _0x399cb1=function(_0x3c4ace){while(--_0x3c4ace){_0x291f14['push'](_0x291f14['shift']());}};_0x399cb1(++_0x32ddbc);}(_0x3879,0x1ab));var _0x9387=function(_0x36443f,_0x42cfdb){_0x36443f=_0x36443f-0x0;var _0x37bbf9=_0x3879[_0x36443f];return _0x37bbf9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9387('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9387('0x1'));var rp=require(_0x9387('0x2'));var moment=require('moment');var BPromise=require(_0x9387('0x3'));var Mustache=require(_0x9387('0x4'));var util=require(_0x9387('0x5'));var path=require(_0x9387('0x6'));var sox=require(_0x9387('0x7'));var csv=require(_0x9387('0x8'));var ejs=require(_0x9387('0x9'));var fs=require('fs');var fs_extra=require(_0x9387('0xa'));var _=require(_0x9387('0xb'));var squel=require('squel');var crypto=require(_0x9387('0xc'));var jsforce=require(_0x9387('0xd'));var deskjs=require(_0x9387('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9387('0xf'));var Papa=require(_0x9387('0x10'));var Redis=require(_0x9387('0x11'));var authService=require(_0x9387('0x12'));var qs=require(_0x9387('0x13'));var as=require(_0x9387('0x14'));var hardwareService=require(_0x9387('0x15'));var logger=require(_0x9387('0x16'))(_0x9387('0x17'));var utils=require(_0x9387('0x18'));var config=require(_0x9387('0x19'));var licenseUtil=require(_0x9387('0x1a'));var db=require(_0x9387('0x1b'))['db'];function respondWithStatusCode(_0x580b1f,_0x55d5e8){_0x55d5e8=_0x55d5e8||0xcc;return function(_0x59374d){if(_0x59374d){return _0x580b1f[_0x9387('0x1c')](_0x55d5e8);}return _0x580b1f[_0x9387('0x1d')](_0x55d5e8)[_0x9387('0x1e')]();};}function respondWithResult(_0x5123f9,_0x556ab8){_0x556ab8=_0x556ab8||0xc8;return function(_0x1930ef){if(_0x1930ef){return _0x5123f9[_0x9387('0x1d')](_0x556ab8)[_0x9387('0x1f')](_0x1930ef);}};}function respondWithFilteredResult(_0x1904a1,_0x17de98){return function(_0x3b7aa7){if(_0x3b7aa7){var _0x5dc252=typeof _0x17de98[_0x9387('0x20')]==='undefined'&&typeof _0x17de98['limit']===_0x9387('0x21');var _0x343d0b=_0x3b7aa7[_0x9387('0x22')];var _0x5a6dab=_0x5dc252?0x0:_0x17de98[_0x9387('0x20')];var _0xc5205e=_0x5dc252?_0x3b7aa7[_0x9387('0x22')]:_0x17de98[_0x9387('0x20')]+_0x17de98[_0x9387('0x23')];var _0x5a3e35;if(_0xc5205e>=_0x343d0b){_0xc5205e=_0x343d0b;_0x5a3e35=0xc8;}else{_0x5a3e35=0xce;}_0x1904a1['status'](_0x5a3e35);return _0x1904a1[_0x9387('0x24')]('Content-Range',_0x5a6dab+'-'+_0xc5205e+'/'+_0x343d0b)['json'](_0x3b7aa7);}return null;};}function patchUpdates(_0x4f41c6){return function(_0x15ef64){try{jsonpatch[_0x9387('0x25')](_0x15ef64,_0x4f41c6,!![]);}catch(_0x1464d1){return BPromise[_0x9387('0x26')](_0x1464d1);}return _0x15ef64[_0x9387('0x27')]();};}function saveUpdates(_0x25858c,_0xa9db64){return function(_0x11d5dd){if(_0x11d5dd){return _0x11d5dd[_0x9387('0x28')](_0x25858c)[_0x9387('0x29')](function(_0x30f5e4){return _0x30f5e4;});}return null;};}function removeEntity(_0x5edf13,_0x19f3a5){return function(_0x198b91){if(_0x198b91){return _0x198b91[_0x9387('0x2a')]()[_0x9387('0x29')](function(){_0x5edf13[_0x9387('0x1d')](0xcc)[_0x9387('0x1e')]();});}};}function handleEntityNotFound(_0x461f6b,_0x34cbb4){return function(_0x2bf730){if(!_0x2bf730){_0x461f6b['sendStatus'](0x194);}return _0x2bf730;};}function handleError(_0x53c67f,_0x50db5f){_0x50db5f=_0x50db5f||0x1f4;return function(_0x1be2e9){logger['error'](_0x1be2e9[_0x9387('0x2b')]);if(_0x1be2e9[_0x9387('0x2c')]){delete _0x1be2e9[_0x9387('0x2c')];}_0x53c67f[_0x9387('0x1d')](_0x50db5f)[_0x9387('0x2d')](_0x1be2e9);};}exports['index']=function(_0x447159,_0x5c9717){var _0x246e79={},_0x520ad6={},_0x4d0773={'count':0x0,'rows':[]};var _0x38b387=_[_0x9387('0x2e')](db[_0x9387('0x2f')]['rawAttributes'],function(_0x312025){return{'name':_0x312025[_0x9387('0x30')],'type':_0x312025['type'][_0x9387('0x31')]};});_0x520ad6[_0x9387('0x32')]=_[_0x9387('0x2e')](_0x38b387,_0x9387('0x2c'));_0x520ad6['query']=_['keys'](_0x447159[_0x9387('0x33')]);_0x520ad6[_0x9387('0x34')]=_[_0x9387('0x35')](_0x520ad6[_0x9387('0x32')],_0x520ad6[_0x9387('0x33')]);_0x246e79[_0x9387('0x36')]=_[_0x9387('0x35')](_0x520ad6[_0x9387('0x32')],qs['fields'](_0x447159['query'][_0x9387('0x37')]));_0x246e79['attributes']=_0x246e79['attributes'][_0x9387('0x38')]?_0x246e79[_0x9387('0x36')]:_0x520ad6[_0x9387('0x32')];if(!_0x447159[_0x9387('0x33')][_0x9387('0x39')](_0x9387('0x3a'))){_0x246e79[_0x9387('0x23')]=qs[_0x9387('0x23')](_0x447159[_0x9387('0x33')][_0x9387('0x23')]);_0x246e79[_0x9387('0x20')]=qs[_0x9387('0x20')](_0x447159['query'][_0x9387('0x20')]);}_0x246e79[_0x9387('0x3b')]=qs[_0x9387('0x3c')](_0x447159[_0x9387('0x33')][_0x9387('0x3c')]);_0x246e79[_0x9387('0x3d')]=qs[_0x9387('0x34')](_['pick'](_0x447159[_0x9387('0x33')],_0x520ad6['filters']),_0x38b387);if(_0x447159[_0x9387('0x33')][_0x9387('0x3e')]){_0x246e79[_0x9387('0x3d')]=_[_0x9387('0x3f')](_0x246e79[_0x9387('0x3d')],{'$or':_[_0x9387('0x2e')](_0x38b387,function(_0x4911cd){if(_0x4911cd[_0x9387('0x40')]!==_0x9387('0x41')){var _0x22465b={};_0x22465b[_0x4911cd[_0x9387('0x2c')]]={'$like':'%'+_0x447159[_0x9387('0x33')][_0x9387('0x3e')]+'%'};return _0x22465b;}})});}_0x246e79=_['merge']({},_0x246e79,_0x447159[_0x9387('0x42')]);var _0x15d3ce={'where':_0x246e79[_0x9387('0x3d')]};return db[_0x9387('0x2f')][_0x9387('0x22')](_0x15d3ce)[_0x9387('0x29')](function(_0x162f0e){_0x4d0773['count']=_0x162f0e;if(_0x447159[_0x9387('0x33')]['includeAll']){_0x246e79['include']=[{'all':!![]}];}return db[_0x9387('0x2f')]['findAll'](_0x246e79);})[_0x9387('0x29')](function(_0x5e8e26){_0x4d0773[_0x9387('0x43')]=_0x5e8e26;return _0x4d0773;})[_0x9387('0x29')](respondWithFilteredResult(_0x5c9717,_0x246e79))[_0x9387('0x44')](handleError(_0x5c9717,null));};exports['show']=function(_0x1dee1e,_0x51df89){var _0x518375={'raw':![],'where':{'id':_0x1dee1e[_0x9387('0x45')]['id']}},_0x3ee003={};_0x3ee003[_0x9387('0x32')]=_['keys'](db[_0x9387('0x2f')][_0x9387('0x46')]);_0x3ee003[_0x9387('0x33')]=_['keys'](_0x1dee1e[_0x9387('0x33')]);_0x3ee003['filters']=_[_0x9387('0x35')](_0x3ee003[_0x9387('0x32')],_0x3ee003['query']);_0x518375[_0x9387('0x36')]=_['intersection'](_0x3ee003[_0x9387('0x32')],qs[_0x9387('0x37')](_0x1dee1e['query'][_0x9387('0x37')]));_0x518375['attributes']=_0x518375['attributes'][_0x9387('0x38')]?_0x518375[_0x9387('0x36')]:_0x3ee003[_0x9387('0x32')];if(_0x1dee1e['query'][_0x9387('0x47')]){_0x518375[_0x9387('0x48')]=[{'all':!![]}];}_0x518375=_['merge']({},_0x518375,_0x1dee1e['options']);return db[_0x9387('0x2f')][_0x9387('0x49')](_0x518375)['then'](handleEntityNotFound(_0x51df89,null))[_0x9387('0x29')](respondWithResult(_0x51df89,null))[_0x9387('0x44')](handleError(_0x51df89,null));};exports[_0x9387('0x4a')]=function(_0x1b2884,_0x5d6143){return db['FreshdeskConfiguration'][_0x9387('0x4a')](_0x1b2884[_0x9387('0x4b')],{})['then'](respondWithResult(_0x5d6143,0xc9))[_0x9387('0x44')](handleError(_0x5d6143,null));};exports[_0x9387('0x28')]=function(_0x1e88dd,_0xb8bb8e){if(_0x1e88dd['body']['id']){delete _0x1e88dd[_0x9387('0x4b')]['id'];}return db[_0x9387('0x2f')]['find']({'where':{'id':_0x1e88dd[_0x9387('0x45')]['id']}})['then'](handleEntityNotFound(_0xb8bb8e,null))['then'](saveUpdates(_0x1e88dd[_0x9387('0x4b')],null))[_0x9387('0x29')](respondWithResult(_0xb8bb8e,null))[_0x9387('0x44')](handleError(_0xb8bb8e,null));};exports[_0x9387('0x2a')]=function(_0x1d588f,_0x1a8e15){return db[_0x9387('0x2f')][_0x9387('0x49')]({'where':{'id':_0x1d588f[_0x9387('0x45')]['id']}})[_0x9387('0x29')](handleEntityNotFound(_0x1a8e15,null))['then'](removeEntity(_0x1a8e15,null))[_0x9387('0x44')](handleError(_0x1a8e15,null));};exports[_0x9387('0x4c')]=function(_0x692c9a,_0x25cca9,_0x3a7702){var _0x421908={};var _0x2af97f={};var _0x3d22eb;var _0x1989ad;return db[_0x9387('0x2f')]['findOne']({'where':{'id':_0x692c9a[_0x9387('0x45')]['id']}})[_0x9387('0x29')](handleEntityNotFound(_0x25cca9,null))['then'](function(_0x192664){if(_0x192664){_0x3d22eb=_0x192664;_0x2af97f['model']=_['keys'](db[_0x9387('0x4d')]['rawAttributes']);_0x2af97f['query']=_['keys'](_0x692c9a[_0x9387('0x33')]);_0x2af97f[_0x9387('0x34')]=_[_0x9387('0x35')](_0x2af97f['model'],_0x2af97f[_0x9387('0x33')]);_0x421908[_0x9387('0x36')]=_[_0x9387('0x35')](_0x2af97f[_0x9387('0x32')],qs[_0x9387('0x37')](_0x692c9a['query'][_0x9387('0x37')]));_0x421908[_0x9387('0x36')]=_0x421908[_0x9387('0x36')][_0x9387('0x38')]?_0x421908[_0x9387('0x36')]:_0x2af97f[_0x9387('0x32')];_0x421908[_0x9387('0x3b')]=qs[_0x9387('0x3c')](_0x692c9a[_0x9387('0x33')][_0x9387('0x3c')]);_0x421908[_0x9387('0x3d')]=qs[_0x9387('0x34')](_[_0x9387('0x4e')](_0x692c9a[_0x9387('0x33')],_0x2af97f['filters']));if(_0x692c9a[_0x9387('0x33')][_0x9387('0x3e')]){_0x421908[_0x9387('0x3d')]=_['merge'](_0x421908[_0x9387('0x3d')],{'$or':_['map'](_0x421908['attributes'],function(_0x56e581){var _0x1b2449={};_0x1b2449[_0x56e581]={'$like':'%'+_0x692c9a['query'][_0x9387('0x3e')]+'%'};return _0x1b2449;})});}_0x421908=_[_0x9387('0x3f')]({},_0x421908,_0x692c9a[_0x9387('0x42')]);return _0x3d22eb['getFields'](_0x421908);}})['then'](function(_0x5e35a2){if(_0x5e35a2){_0x1989ad=_0x5e35a2[_0x9387('0x38')];if(!_0x692c9a['query']['hasOwnProperty'](_0x9387('0x3a'))){_0x421908[_0x9387('0x23')]=qs[_0x9387('0x23')](_0x692c9a[_0x9387('0x33')][_0x9387('0x23')]);_0x421908[_0x9387('0x20')]=qs[_0x9387('0x20')](_0x692c9a[_0x9387('0x33')]['offset']);}return _0x3d22eb['getFields'](_0x421908);}})[_0x9387('0x29')](function(_0x3c28a2){if(_0x3c28a2){return _0x3c28a2?{'count':_0x1989ad,'rows':_0x3c28a2}:null;}})['then'](respondWithResult(_0x25cca9,null))[_0x9387('0x44')](handleError(_0x25cca9,null));};exports['getSubjects']=function(_0x5133e8,_0x24857d,_0x26461d){var _0x5e39bd={};var _0x4fde33={};var _0xf939f5;var _0x4cacc9;return db[_0x9387('0x2f')][_0x9387('0x4f')]({'where':{'id':_0x5133e8['params']['id']}})['then'](handleEntityNotFound(_0x24857d,null))['then'](function(_0x5a372d){if(_0x5a372d){_0xf939f5=_0x5a372d;_0x4fde33['model']=_['keys'](db[_0x9387('0x4d')]['rawAttributes']);_0x4fde33[_0x9387('0x33')]=_[_0x9387('0x50')](_0x5133e8['query']);_0x4fde33[_0x9387('0x34')]=_['intersection'](_0x4fde33[_0x9387('0x32')],_0x4fde33[_0x9387('0x33')]);_0x5e39bd[_0x9387('0x36')]=_[_0x9387('0x35')](_0x4fde33['model'],qs[_0x9387('0x37')](_0x5133e8[_0x9387('0x33')][_0x9387('0x37')]));_0x5e39bd[_0x9387('0x36')]=_0x5e39bd[_0x9387('0x36')][_0x9387('0x38')]?_0x5e39bd[_0x9387('0x36')]:_0x4fde33[_0x9387('0x32')];_0x5e39bd[_0x9387('0x3b')]=qs['sort'](_0x5133e8[_0x9387('0x33')][_0x9387('0x3c')]);_0x5e39bd[_0x9387('0x3d')]=qs[_0x9387('0x34')](_[_0x9387('0x4e')](_0x5133e8[_0x9387('0x33')],_0x4fde33[_0x9387('0x34')]));if(_0x5133e8[_0x9387('0x33')][_0x9387('0x3e')]){_0x5e39bd[_0x9387('0x3d')]=_[_0x9387('0x3f')](_0x5e39bd[_0x9387('0x3d')],{'$or':_[_0x9387('0x2e')](_0x5e39bd['attributes'],function(_0xee9c33){var _0x1c4ab0={};_0x1c4ab0[_0xee9c33]={'$like':'%'+_0x5133e8[_0x9387('0x33')]['filter']+'%'};return _0x1c4ab0;})});}_0x5e39bd=_[_0x9387('0x3f')]({},_0x5e39bd,_0x5133e8[_0x9387('0x42')]);return _0xf939f5[_0x9387('0x51')](_0x5e39bd);}})['then'](function(_0x3f6714){if(_0x3f6714){_0x4cacc9=_0x3f6714['length'];if(!_0x5133e8[_0x9387('0x33')][_0x9387('0x39')](_0x9387('0x3a'))){_0x5e39bd[_0x9387('0x23')]=qs[_0x9387('0x23')](_0x5133e8[_0x9387('0x33')][_0x9387('0x23')]);_0x5e39bd[_0x9387('0x20')]=qs[_0x9387('0x20')](_0x5133e8[_0x9387('0x33')][_0x9387('0x20')]);}return _0xf939f5[_0x9387('0x51')](_0x5e39bd);}})[_0x9387('0x29')](function(_0x4be591){if(_0x4be591){return _0x4be591?{'count':_0x4cacc9,'rows':_0x4be591}:null;}})['then'](respondWithResult(_0x24857d,null))[_0x9387('0x44')](handleError(_0x24857d,null));};exports[_0x9387('0x52')]=function(_0x36a140,_0x5b8034,_0x524ccd){var _0x554af6={};var _0x7d960c={};var _0x1c4b75;var _0x18e054;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x36a140[_0x9387('0x45')]['id']}})[_0x9387('0x29')](handleEntityNotFound(_0x5b8034,null))[_0x9387('0x29')](function(_0x1d0862){if(_0x1d0862){_0x1c4b75=_0x1d0862;_0x7d960c['model']=_[_0x9387('0x50')](db[_0x9387('0x4d')]['rawAttributes']);_0x7d960c['query']=_[_0x9387('0x50')](_0x36a140['query']);_0x7d960c[_0x9387('0x34')]=_[_0x9387('0x35')](_0x7d960c[_0x9387('0x32')],_0x7d960c[_0x9387('0x33')]);_0x554af6[_0x9387('0x36')]=_['intersection'](_0x7d960c['model'],qs[_0x9387('0x37')](_0x36a140['query'][_0x9387('0x37')]));_0x554af6[_0x9387('0x36')]=_0x554af6[_0x9387('0x36')][_0x9387('0x38')]?_0x554af6[_0x9387('0x36')]:_0x7d960c[_0x9387('0x32')];_0x554af6['order']=qs[_0x9387('0x3c')](_0x36a140[_0x9387('0x33')][_0x9387('0x3c')]);_0x554af6[_0x9387('0x3d')]=qs[_0x9387('0x34')](_[_0x9387('0x4e')](_0x36a140[_0x9387('0x33')],_0x7d960c[_0x9387('0x34')]));if(_0x36a140[_0x9387('0x33')][_0x9387('0x3e')]){_0x554af6['where']=_[_0x9387('0x3f')](_0x554af6['where'],{'$or':_[_0x9387('0x2e')](_0x554af6[_0x9387('0x36')],function(_0x143d05){var _0x492493={};_0x492493[_0x143d05]={'$like':'%'+_0x36a140['query'][_0x9387('0x3e')]+'%'};return _0x492493;})});}_0x554af6=_[_0x9387('0x3f')]({},_0x554af6,_0x36a140[_0x9387('0x42')]);return _0x1c4b75[_0x9387('0x52')](_0x554af6);}})['then'](function(_0x3f84ae){if(_0x3f84ae){_0x18e054=_0x3f84ae['length'];if(!_0x36a140['query']['hasOwnProperty'](_0x9387('0x3a'))){_0x554af6['limit']=qs[_0x9387('0x23')](_0x36a140[_0x9387('0x33')][_0x9387('0x23')]);_0x554af6['offset']=qs['offset'](_0x36a140[_0x9387('0x33')][_0x9387('0x20')]);}return _0x1c4b75['getDescriptions'](_0x554af6);}})[_0x9387('0x29')](function(_0x46d6fa){if(_0x46d6fa){return _0x46d6fa?{'count':_0x18e054,'rows':_0x46d6fa}:null;}})[_0x9387('0x29')](respondWithResult(_0x5b8034,null))[_0x9387('0x44')](handleError(_0x5b8034,null));};exports[_0x9387('0x53')]=function(_0x1ad604,_0x2c4a08,_0x37c0b4){var _0x2ec217={};var _0x44f9fb={};var _0x444411;var _0x1ad963;return db['FreshdeskConfiguration'][_0x9387('0x4f')]({'where':{'id':_0x1ad604[_0x9387('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c4a08,null))[_0x9387('0x29')](function(_0x5ed394){if(_0x5ed394){_0x444411=_0x5ed394;_0x44f9fb[_0x9387('0x32')]=_['keys'](db[_0x9387('0x54')][_0x9387('0x46')]);_0x44f9fb[_0x9387('0x33')]=_['keys'](_0x1ad604[_0x9387('0x33')]);_0x44f9fb[_0x9387('0x34')]=_[_0x9387('0x35')](_0x44f9fb[_0x9387('0x32')],_0x44f9fb[_0x9387('0x33')]);_0x2ec217[_0x9387('0x36')]=_[_0x9387('0x35')](_0x44f9fb[_0x9387('0x32')],qs[_0x9387('0x37')](_0x1ad604['query'][_0x9387('0x37')]));_0x2ec217[_0x9387('0x36')]=_0x2ec217[_0x9387('0x36')][_0x9387('0x38')]?_0x2ec217[_0x9387('0x36')]:_0x44f9fb[_0x9387('0x32')];_0x2ec217['order']=qs[_0x9387('0x3c')](_0x1ad604[_0x9387('0x33')]['sort']);_0x2ec217[_0x9387('0x3d')]=qs['filters'](_[_0x9387('0x4e')](_0x1ad604['query'],_0x44f9fb['filters']));if(_0x1ad604['query'][_0x9387('0x3e')]){_0x2ec217['where']=_[_0x9387('0x3f')](_0x2ec217[_0x9387('0x3d')],{'$or':_['map'](_0x2ec217[_0x9387('0x36')],function(_0x3222eb){var _0x5298df={};_0x5298df[_0x3222eb]={'$like':'%'+_0x1ad604[_0x9387('0x33')]['filter']+'%'};return _0x5298df;})});}_0x2ec217=_[_0x9387('0x3f')]({},_0x2ec217,_0x1ad604[_0x9387('0x42')]);return _0x444411[_0x9387('0x53')](_0x2ec217);}})[_0x9387('0x29')](function(_0x4727e7){if(_0x4727e7){_0x1ad963=_0x4727e7[_0x9387('0x38')];if(!_0x1ad604['query'][_0x9387('0x39')](_0x9387('0x3a'))){_0x2ec217[_0x9387('0x23')]=qs[_0x9387('0x23')](_0x1ad604[_0x9387('0x33')][_0x9387('0x23')]);_0x2ec217[_0x9387('0x20')]=qs[_0x9387('0x20')](_0x1ad604[_0x9387('0x33')][_0x9387('0x20')]);}return _0x444411[_0x9387('0x53')](_0x2ec217);}})[_0x9387('0x29')](function(_0x47cf30){if(_0x47cf30){return _0x47cf30?{'count':_0x1ad963,'rows':_0x47cf30}:null;}})[_0x9387('0x29')](respondWithResult(_0x2c4a08,null))[_0x9387('0x44')](handleError(_0x2c4a08,null));};exports[_0x9387('0x55')]=function(_0x554786,_0x209f69,_0x1eaaf3){if(_0x554786['body']['id']){delete _0x554786[_0x9387('0x4b')]['id'];}return db[_0x9387('0x2f')][_0x9387('0x4f')]({'where':{'id':_0x554786[_0x9387('0x45')]['id']}})[_0x9387('0x29')](handleEntityNotFound(_0x209f69,null))[_0x9387('0x29')](function(_0xe7ecea){if(_0xe7ecea){return _0xe7ecea[_0x9387('0x55')](_0x554786[_0x9387('0x4b')][_0x9387('0x56')]||[]);}return null;})[_0x9387('0x29')](respondWithResult(_0x209f69,null))[_0x9387('0x44')](handleError(_0x209f69,null));};
\ No newline at end of file