Built motion from commit b5996064.|2.6.21
[motion2.git] / server / api / intFreshdeskConfiguration / intFreshdeskConfiguration.controller.js
index 645198f..a597847 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1897=['include','FreshdeskConfiguration','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','update','destroy','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','stack','name','map','fieldName','type','key','model','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0xc6ab6a,_0x5daab6){var _0x1c1a52=function(_0x581c6e){while(--_0x581c6e){_0xc6ab6a['push'](_0xc6ab6a['shift']());}};_0x1c1a52(++_0x5daab6);}(_0x1897,0x162));var _0x7189=function(_0x2abb22,_0x29bcd0){_0x2abb22=_0x2abb22-0x0;var _0x569662=_0x1897[_0x2abb22];return _0x569662;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7189('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7189('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7189('0x2'));var Mustache=require(_0x7189('0x3'));var util=require(_0x7189('0x4'));var path=require(_0x7189('0x5'));var sox=require(_0x7189('0x6'));var csv=require('to-csv');var ejs=require(_0x7189('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7189('0x8'));var squel=require(_0x7189('0x9'));var crypto=require(_0x7189('0xa'));var jsforce=require(_0x7189('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7189('0xc'));var querystring=require(_0x7189('0xd'));var Papa=require(_0x7189('0xe'));var Redis=require(_0x7189('0xf'));var authService=require(_0x7189('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7189('0x11'));var logger=require(_0x7189('0x12'))(_0x7189('0x13'));var utils=require(_0x7189('0x14'));var config=require(_0x7189('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7189('0x16'))['db'];function respondWithStatusCode(_0x397a76,_0x325cbb){_0x325cbb=_0x325cbb||0xcc;return function(_0x573f8f){if(_0x573f8f){return _0x397a76[_0x7189('0x17')](_0x325cbb);}return _0x397a76['status'](_0x325cbb)[_0x7189('0x18')]();};}function respondWithResult(_0x26617e,_0x2cb6f2){_0x2cb6f2=_0x2cb6f2||0xc8;return function(_0x1027f1){if(_0x1027f1){return _0x26617e[_0x7189('0x19')](_0x2cb6f2)[_0x7189('0x1a')](_0x1027f1);}};}function respondWithFilteredResult(_0x39168d,_0x874adf){return function(_0x734f41){if(_0x734f41){var _0x292ad5=typeof _0x874adf[_0x7189('0x1b')]===_0x7189('0x1c')&&typeof _0x874adf[_0x7189('0x1d')]==='undefined';var _0x306643=_0x734f41[_0x7189('0x1e')];var _0x5f357e=_0x292ad5?0x0:_0x874adf[_0x7189('0x1b')];var _0x3caaf7=_0x292ad5?_0x734f41[_0x7189('0x1e')]:_0x874adf[_0x7189('0x1b')]+_0x874adf[_0x7189('0x1d')];var _0xddc9af;if(_0x3caaf7>=_0x306643){_0x3caaf7=_0x306643;_0xddc9af=0xc8;}else{_0xddc9af=0xce;}_0x39168d[_0x7189('0x19')](_0xddc9af);return _0x39168d[_0x7189('0x1f')](_0x7189('0x20'),_0x5f357e+'-'+_0x3caaf7+'/'+_0x306643)[_0x7189('0x1a')](_0x734f41);}return null;};}function patchUpdates(_0x54c6f7){return function(_0x4c38b3){try{jsonpatch[_0x7189('0x21')](_0x4c38b3,_0x54c6f7,!![]);}catch(_0x359345){return BPromise['reject'](_0x359345);}return _0x4c38b3[_0x7189('0x22')]();};}function saveUpdates(_0x16b485,_0x5f9447){return function(_0x2d52ec){if(_0x2d52ec){return _0x2d52ec['update'](_0x16b485)['then'](function(_0x2ac264){return _0x2ac264;});}return null;};}function removeEntity(_0x371e64,_0xe9fbde){return function(_0x25fb4c){if(_0x25fb4c){return _0x25fb4c['destroy']()[_0x7189('0x23')](function(){_0x371e64[_0x7189('0x19')](0xcc)[_0x7189('0x18')]();});}};}function handleEntityNotFound(_0x5135ae,_0x152413){return function(_0x3d388f){if(!_0x3d388f){_0x5135ae[_0x7189('0x17')](0x194);}return _0x3d388f;};}function handleError(_0x42afa9,_0x453720){_0x453720=_0x453720||0x1f4;return function(_0x56fec4){logger[_0x7189('0x24')](_0x56fec4[_0x7189('0x25')]);if(_0x56fec4[_0x7189('0x26')]){delete _0x56fec4['name'];}_0x42afa9[_0x7189('0x19')](_0x453720)['send'](_0x56fec4);};}exports['index']=function(_0x483bb6,_0x2c7867){var _0x3c43b5={},_0x710c64={},_0x54eecb={'count':0x0,'rows':[]};var _0x1e75a4=_[_0x7189('0x27')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x540591){return{'name':_0x540591[_0x7189('0x28')],'type':_0x540591[_0x7189('0x29')][_0x7189('0x2a')]};});_0x710c64[_0x7189('0x2b')]=_['map'](_0x1e75a4,_0x7189('0x26'));_0x710c64['query']=_['keys'](_0x483bb6['query']);_0x710c64[_0x7189('0x2c')]=_[_0x7189('0x2d')](_0x710c64[_0x7189('0x2b')],_0x710c64['query']);_0x3c43b5[_0x7189('0x2e')]=_[_0x7189('0x2d')](_0x710c64['model'],qs['fields'](_0x483bb6[_0x7189('0x2f')][_0x7189('0x30')]));_0x3c43b5[_0x7189('0x2e')]=_0x3c43b5['attributes'][_0x7189('0x31')]?_0x3c43b5[_0x7189('0x2e')]:_0x710c64[_0x7189('0x2b')];if(!_0x483bb6[_0x7189('0x2f')][_0x7189('0x32')](_0x7189('0x33'))){_0x3c43b5[_0x7189('0x1d')]=qs['limit'](_0x483bb6[_0x7189('0x2f')][_0x7189('0x1d')]);_0x3c43b5[_0x7189('0x1b')]=qs[_0x7189('0x1b')](_0x483bb6[_0x7189('0x2f')][_0x7189('0x1b')]);}_0x3c43b5[_0x7189('0x34')]=qs[_0x7189('0x35')](_0x483bb6[_0x7189('0x2f')][_0x7189('0x35')]);_0x3c43b5[_0x7189('0x36')]=qs[_0x7189('0x2c')](_[_0x7189('0x37')](_0x483bb6[_0x7189('0x2f')],_0x710c64[_0x7189('0x2c')]),_0x1e75a4);if(_0x483bb6[_0x7189('0x2f')][_0x7189('0x38')]){_0x3c43b5[_0x7189('0x36')]=_[_0x7189('0x39')](_0x3c43b5[_0x7189('0x36')],{'$or':_[_0x7189('0x27')](_0x1e75a4,function(_0x12a5b6){if(_0x12a5b6[_0x7189('0x29')]!==_0x7189('0x3a')){var _0x2489e3={};_0x2489e3[_0x12a5b6[_0x7189('0x26')]]={'$like':'%'+_0x483bb6[_0x7189('0x2f')][_0x7189('0x38')]+'%'};return _0x2489e3;}})});}_0x3c43b5=_['merge']({},_0x3c43b5,_0x483bb6[_0x7189('0x3b')]);var _0x38c437={'where':_0x3c43b5[_0x7189('0x36')]};return db['FreshdeskConfiguration']['count'](_0x38c437)['then'](function(_0x387b51){_0x54eecb[_0x7189('0x1e')]=_0x387b51;if(_0x483bb6[_0x7189('0x2f')][_0x7189('0x3c')]){_0x3c43b5[_0x7189('0x3d')]=[{'all':!![]}];}return db[_0x7189('0x3e')][_0x7189('0x3f')](_0x3c43b5);})[_0x7189('0x23')](function(_0x1c0feb){_0x54eecb[_0x7189('0x40')]=_0x1c0feb;return _0x54eecb;})[_0x7189('0x23')](respondWithFilteredResult(_0x2c7867,_0x3c43b5))[_0x7189('0x41')](handleError(_0x2c7867,null));};exports[_0x7189('0x42')]=function(_0x341949,_0x58a5fc){var _0x45991e={'raw':![],'where':{'id':_0x341949[_0x7189('0x43')]['id']}},_0x9de06e={};_0x9de06e['model']=_[_0x7189('0x44')](db[_0x7189('0x3e')][_0x7189('0x45')]);_0x9de06e[_0x7189('0x2f')]=_[_0x7189('0x44')](_0x341949[_0x7189('0x2f')]);_0x9de06e[_0x7189('0x2c')]=_['intersection'](_0x9de06e[_0x7189('0x2b')],_0x9de06e[_0x7189('0x2f')]);_0x45991e['attributes']=_['intersection'](_0x9de06e[_0x7189('0x2b')],qs['fields'](_0x341949[_0x7189('0x2f')][_0x7189('0x30')]));_0x45991e[_0x7189('0x2e')]=_0x45991e[_0x7189('0x2e')][_0x7189('0x31')]?_0x45991e[_0x7189('0x2e')]:_0x9de06e[_0x7189('0x2b')];if(_0x341949['query'][_0x7189('0x3c')]){_0x45991e[_0x7189('0x3d')]=[{'all':!![]}];}_0x45991e=_[_0x7189('0x39')]({},_0x45991e,_0x341949['options']);return db[_0x7189('0x3e')][_0x7189('0x46')](_0x45991e)[_0x7189('0x23')](handleEntityNotFound(_0x58a5fc,null))[_0x7189('0x23')](respondWithResult(_0x58a5fc,null))[_0x7189('0x41')](handleError(_0x58a5fc,null));};exports[_0x7189('0x47')]=function(_0x31ac23,_0x5ab907){return db[_0x7189('0x3e')][_0x7189('0x47')](_0x31ac23[_0x7189('0x48')],{})[_0x7189('0x23')](respondWithResult(_0x5ab907,0xc9))[_0x7189('0x41')](handleError(_0x5ab907,null));};exports[_0x7189('0x49')]=function(_0x124a63,_0x2bbd9b){if(_0x124a63[_0x7189('0x48')]['id']){delete _0x124a63[_0x7189('0x48')]['id'];}return db[_0x7189('0x3e')][_0x7189('0x46')]({'where':{'id':_0x124a63[_0x7189('0x43')]['id']}})['then'](handleEntityNotFound(_0x2bbd9b,null))['then'](saveUpdates(_0x124a63['body'],null))[_0x7189('0x23')](respondWithResult(_0x2bbd9b,null))['catch'](handleError(_0x2bbd9b,null));};exports[_0x7189('0x4a')]=function(_0x3caee0,_0x5c2375){return db['FreshdeskConfiguration'][_0x7189('0x46')]({'where':{'id':_0x3caee0[_0x7189('0x43')]['id']}})[_0x7189('0x23')](handleEntityNotFound(_0x5c2375,null))[_0x7189('0x23')](removeEntity(_0x5c2375,null))[_0x7189('0x41')](handleError(_0x5c2375,null));};exports[_0x7189('0x4b')]=function(_0x5529ba,_0x34ab44,_0x3fe4af){var _0xffc43b={};var _0x3ecee5={};var _0x4f9b20;var _0x570b0e;return db['FreshdeskConfiguration'][_0x7189('0x4c')]({'where':{'id':_0x5529ba['params']['id']}})['then'](handleEntityNotFound(_0x34ab44,null))['then'](function(_0x4300d3){if(_0x4300d3){_0x4f9b20=_0x4300d3;_0x3ecee5[_0x7189('0x2b')]=_['keys'](db[_0x7189('0x4d')][_0x7189('0x45')]);_0x3ecee5[_0x7189('0x2f')]=_[_0x7189('0x44')](_0x5529ba[_0x7189('0x2f')]);_0x3ecee5[_0x7189('0x2c')]=_['intersection'](_0x3ecee5['model'],_0x3ecee5[_0x7189('0x2f')]);_0xffc43b[_0x7189('0x2e')]=_[_0x7189('0x2d')](_0x3ecee5['model'],qs[_0x7189('0x30')](_0x5529ba[_0x7189('0x2f')]['fields']));_0xffc43b['attributes']=_0xffc43b['attributes']['length']?_0xffc43b[_0x7189('0x2e')]:_0x3ecee5['model'];_0xffc43b[_0x7189('0x34')]=qs[_0x7189('0x35')](_0x5529ba[_0x7189('0x2f')][_0x7189('0x35')]);_0xffc43b[_0x7189('0x36')]=qs[_0x7189('0x2c')](_['pick'](_0x5529ba[_0x7189('0x2f')],_0x3ecee5[_0x7189('0x2c')]));if(_0x5529ba[_0x7189('0x2f')][_0x7189('0x38')]){_0xffc43b['where']=_['merge'](_0xffc43b[_0x7189('0x36')],{'$or':_[_0x7189('0x27')](_0xffc43b[_0x7189('0x2e')],function(_0x58056c){var _0x1bed82={};_0x1bed82[_0x58056c]={'$like':'%'+_0x5529ba['query'][_0x7189('0x38')]+'%'};return _0x1bed82;})});}_0xffc43b=_[_0x7189('0x39')]({},_0xffc43b,_0x5529ba[_0x7189('0x3b')]);return _0x4f9b20[_0x7189('0x4b')](_0xffc43b);}})[_0x7189('0x23')](function(_0x226cea){if(_0x226cea){_0x570b0e=_0x226cea[_0x7189('0x31')];if(!_0x5529ba[_0x7189('0x2f')]['hasOwnProperty'](_0x7189('0x33'))){_0xffc43b[_0x7189('0x1d')]=qs[_0x7189('0x1d')](_0x5529ba[_0x7189('0x2f')]['limit']);_0xffc43b[_0x7189('0x1b')]=qs[_0x7189('0x1b')](_0x5529ba[_0x7189('0x2f')][_0x7189('0x1b')]);}return _0x4f9b20[_0x7189('0x4b')](_0xffc43b);}})[_0x7189('0x23')](function(_0x1d00c1){if(_0x1d00c1){return _0x1d00c1?{'count':_0x570b0e,'rows':_0x1d00c1}:null;}})[_0x7189('0x23')](respondWithResult(_0x34ab44,null))[_0x7189('0x41')](handleError(_0x34ab44,null));};exports[_0x7189('0x4e')]=function(_0x246384,_0x44e255,_0x45b1f0){var _0x4d0a9d={};var _0x1b1c73={};var _0x2cc217;var _0x14d3b4;return db[_0x7189('0x3e')][_0x7189('0x4c')]({'where':{'id':_0x246384[_0x7189('0x43')]['id']}})[_0x7189('0x23')](handleEntityNotFound(_0x44e255,null))[_0x7189('0x23')](function(_0x45a467){if(_0x45a467){_0x2cc217=_0x45a467;_0x1b1c73[_0x7189('0x2b')]=_['keys'](db[_0x7189('0x4d')][_0x7189('0x45')]);_0x1b1c73['query']=_[_0x7189('0x44')](_0x246384[_0x7189('0x2f')]);_0x1b1c73[_0x7189('0x2c')]=_[_0x7189('0x2d')](_0x1b1c73[_0x7189('0x2b')],_0x1b1c73['query']);_0x4d0a9d[_0x7189('0x2e')]=_[_0x7189('0x2d')](_0x1b1c73[_0x7189('0x2b')],qs[_0x7189('0x30')](_0x246384['query'][_0x7189('0x30')]));_0x4d0a9d['attributes']=_0x4d0a9d['attributes'][_0x7189('0x31')]?_0x4d0a9d[_0x7189('0x2e')]:_0x1b1c73[_0x7189('0x2b')];_0x4d0a9d[_0x7189('0x34')]=qs[_0x7189('0x35')](_0x246384[_0x7189('0x2f')]['sort']);_0x4d0a9d[_0x7189('0x36')]=qs[_0x7189('0x2c')](_[_0x7189('0x37')](_0x246384[_0x7189('0x2f')],_0x1b1c73[_0x7189('0x2c')]));if(_0x246384[_0x7189('0x2f')]['filter']){_0x4d0a9d[_0x7189('0x36')]=_['merge'](_0x4d0a9d['where'],{'$or':_['map'](_0x4d0a9d[_0x7189('0x2e')],function(_0x59aab9){var _0x53b8ca={};_0x53b8ca[_0x59aab9]={'$like':'%'+_0x246384[_0x7189('0x2f')][_0x7189('0x38')]+'%'};return _0x53b8ca;})});}_0x4d0a9d=_[_0x7189('0x39')]({},_0x4d0a9d,_0x246384[_0x7189('0x3b')]);return _0x2cc217[_0x7189('0x4e')](_0x4d0a9d);}})[_0x7189('0x23')](function(_0x29a80b){if(_0x29a80b){_0x14d3b4=_0x29a80b[_0x7189('0x31')];if(!_0x246384[_0x7189('0x2f')][_0x7189('0x32')](_0x7189('0x33'))){_0x4d0a9d[_0x7189('0x1d')]=qs[_0x7189('0x1d')](_0x246384[_0x7189('0x2f')][_0x7189('0x1d')]);_0x4d0a9d[_0x7189('0x1b')]=qs['offset'](_0x246384[_0x7189('0x2f')]['offset']);}return _0x2cc217[_0x7189('0x4e')](_0x4d0a9d);}})[_0x7189('0x23')](function(_0x1e2781){if(_0x1e2781){return _0x1e2781?{'count':_0x14d3b4,'rows':_0x1e2781}:null;}})[_0x7189('0x23')](respondWithResult(_0x44e255,null))['catch'](handleError(_0x44e255,null));};exports[_0x7189('0x4f')]=function(_0x27ba31,_0x209e30,_0x4811fe){var _0x3fff12={};var _0x24f819={};var _0x4fb23e;var _0x1cd7fe;return db[_0x7189('0x3e')][_0x7189('0x4c')]({'where':{'id':_0x27ba31[_0x7189('0x43')]['id']}})['then'](handleEntityNotFound(_0x209e30,null))['then'](function(_0x378f8a){if(_0x378f8a){_0x4fb23e=_0x378f8a;_0x24f819['model']=_[_0x7189('0x44')](db['FreshdeskField'][_0x7189('0x45')]);_0x24f819[_0x7189('0x2f')]=_['keys'](_0x27ba31[_0x7189('0x2f')]);_0x24f819[_0x7189('0x2c')]=_[_0x7189('0x2d')](_0x24f819[_0x7189('0x2b')],_0x24f819[_0x7189('0x2f')]);_0x3fff12['attributes']=_[_0x7189('0x2d')](_0x24f819[_0x7189('0x2b')],qs[_0x7189('0x30')](_0x27ba31[_0x7189('0x2f')]['fields']));_0x3fff12[_0x7189('0x2e')]=_0x3fff12[_0x7189('0x2e')][_0x7189('0x31')]?_0x3fff12[_0x7189('0x2e')]:_0x24f819[_0x7189('0x2b')];_0x3fff12[_0x7189('0x34')]=qs[_0x7189('0x35')](_0x27ba31[_0x7189('0x2f')][_0x7189('0x35')]);_0x3fff12[_0x7189('0x36')]=qs['filters'](_['pick'](_0x27ba31[_0x7189('0x2f')],_0x24f819[_0x7189('0x2c')]));if(_0x27ba31[_0x7189('0x2f')]['filter']){_0x3fff12[_0x7189('0x36')]=_['merge'](_0x3fff12[_0x7189('0x36')],{'$or':_[_0x7189('0x27')](_0x3fff12[_0x7189('0x2e')],function(_0x11f01f){var _0x535539={};_0x535539[_0x11f01f]={'$like':'%'+_0x27ba31[_0x7189('0x2f')][_0x7189('0x38')]+'%'};return _0x535539;})});}_0x3fff12=_[_0x7189('0x39')]({},_0x3fff12,_0x27ba31['options']);return _0x4fb23e[_0x7189('0x4f')](_0x3fff12);}})[_0x7189('0x23')](function(_0x328308){if(_0x328308){_0x1cd7fe=_0x328308[_0x7189('0x31')];if(!_0x27ba31[_0x7189('0x2f')][_0x7189('0x32')](_0x7189('0x33'))){_0x3fff12[_0x7189('0x1d')]=qs[_0x7189('0x1d')](_0x27ba31[_0x7189('0x2f')][_0x7189('0x1d')]);_0x3fff12[_0x7189('0x1b')]=qs[_0x7189('0x1b')](_0x27ba31[_0x7189('0x2f')][_0x7189('0x1b')]);}return _0x4fb23e[_0x7189('0x4f')](_0x3fff12);}})[_0x7189('0x23')](function(_0x1c9df4){if(_0x1c9df4){return _0x1c9df4?{'count':_0x1cd7fe,'rows':_0x1c9df4}:null;}})['then'](respondWithResult(_0x209e30,null))[_0x7189('0x41')](handleError(_0x209e30,null));};exports[_0x7189('0x50')]=function(_0x4cbff5,_0x352749,_0x41f499){var _0x320003={};var _0x3099ec={};var _0x1dde9d;var _0xfab59b;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4cbff5[_0x7189('0x43')]['id']}})['then'](handleEntityNotFound(_0x352749,null))[_0x7189('0x23')](function(_0x3d87b6){if(_0x3d87b6){_0x1dde9d=_0x3d87b6;_0x3099ec[_0x7189('0x2b')]=_[_0x7189('0x44')](db['Tag'][_0x7189('0x45')]);_0x3099ec[_0x7189('0x2f')]=_['keys'](_0x4cbff5[_0x7189('0x2f')]);_0x3099ec[_0x7189('0x2c')]=_[_0x7189('0x2d')](_0x3099ec['model'],_0x3099ec[_0x7189('0x2f')]);_0x320003['attributes']=_[_0x7189('0x2d')](_0x3099ec[_0x7189('0x2b')],qs[_0x7189('0x30')](_0x4cbff5[_0x7189('0x2f')][_0x7189('0x30')]));_0x320003[_0x7189('0x2e')]=_0x320003['attributes']['length']?_0x320003[_0x7189('0x2e')]:_0x3099ec[_0x7189('0x2b')];_0x320003[_0x7189('0x34')]=qs[_0x7189('0x35')](_0x4cbff5['query']['sort']);_0x320003[_0x7189('0x36')]=qs['filters'](_[_0x7189('0x37')](_0x4cbff5[_0x7189('0x2f')],_0x3099ec[_0x7189('0x2c')]));if(_0x4cbff5[_0x7189('0x2f')][_0x7189('0x38')]){_0x320003[_0x7189('0x36')]=_[_0x7189('0x39')](_0x320003['where'],{'$or':_[_0x7189('0x27')](_0x320003[_0x7189('0x2e')],function(_0x4603cf){var _0x3834de={};_0x3834de[_0x4603cf]={'$like':'%'+_0x4cbff5[_0x7189('0x2f')][_0x7189('0x38')]+'%'};return _0x3834de;})});}_0x320003=_[_0x7189('0x39')]({},_0x320003,_0x4cbff5['options']);return _0x1dde9d[_0x7189('0x50')](_0x320003);}})['then'](function(_0x38ec9c){if(_0x38ec9c){_0xfab59b=_0x38ec9c[_0x7189('0x31')];if(!_0x4cbff5[_0x7189('0x2f')]['hasOwnProperty'](_0x7189('0x33'))){_0x320003[_0x7189('0x1d')]=qs[_0x7189('0x1d')](_0x4cbff5[_0x7189('0x2f')][_0x7189('0x1d')]);_0x320003[_0x7189('0x1b')]=qs['offset'](_0x4cbff5[_0x7189('0x2f')][_0x7189('0x1b')]);}return _0x1dde9d[_0x7189('0x50')](_0x320003);}})[_0x7189('0x23')](function(_0x3be4e9){if(_0x3be4e9){return _0x3be4e9?{'count':_0xfab59b,'rows':_0x3be4e9}:null;}})[_0x7189('0x23')](respondWithResult(_0x352749,null))[_0x7189('0x41')](handleError(_0x352749,null));};exports[_0x7189('0x51')]=function(_0x1826c1,_0x3138f3,_0x18ad08){if(_0x1826c1['body']['id']){delete _0x1826c1[_0x7189('0x48')]['id'];}return db[_0x7189('0x3e')][_0x7189('0x4c')]({'where':{'id':_0x1826c1['params']['id']}})[_0x7189('0x23')](handleEntityNotFound(_0x3138f3,null))[_0x7189('0x23')](function(_0x431934){if(_0x431934){return _0x431934[_0x7189('0x51')](_0x1826c1[_0x7189('0x48')][_0x7189('0x52')]||[]);}return null;})[_0x7189('0x23')](respondWithResult(_0x3138f3,null))[_0x7189('0x41')](handleError(_0x3138f3,null));};
\ No newline at end of file
+var _0x1f98=['end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','keys','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','FreshdeskConfiguration','findAll','rows','catch','show','rawAttributes','length','find','create','body','params','getFields','FreshdeskField','options','getSubjects','nolimit','getDescriptions','getTags','Tag','setTags','findOne','ids','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x52451b,_0x2f8c1c){var _0x335fcd=function(_0x4bcb51){while(--_0x4bcb51){_0x52451b['push'](_0x52451b['shift']());}};_0x335fcd(++_0x2f8c1c);}(_0x1f98,0x130));var _0x81f9=function(_0x3a6474,_0x45a6da){_0x3a6474=_0x3a6474-0x0;var _0x49e783=_0x1f98[_0x3a6474];return _0x49e783;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x81f9('0x0'));var zipdir=require(_0x81f9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x81f9('0x2'));var BPromise=require(_0x81f9('0x3'));var Mustache=require(_0x81f9('0x4'));var util=require('util');var path=require(_0x81f9('0x5'));var sox=require('sox');var csv=require(_0x81f9('0x6'));var ejs=require(_0x81f9('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x81f9('0x8'));var crypto=require(_0x81f9('0x9'));var jsforce=require(_0x81f9('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x81f9('0x6'));var querystring=require(_0x81f9('0xb'));var Papa=require('papaparse');var Redis=require(_0x81f9('0xc'));var authService=require(_0x81f9('0xd'));var qs=require(_0x81f9('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x81f9('0xf'));var logger=require(_0x81f9('0x10'))(_0x81f9('0x11'));var utils=require(_0x81f9('0x12'));var config=require(_0x81f9('0x13'));var licenseUtil=require(_0x81f9('0x14'));var db=require(_0x81f9('0x15'))['db'];function respondWithStatusCode(_0x47e51f,_0x3502c7){_0x3502c7=_0x3502c7||0xcc;return function(_0x4f3665){if(_0x4f3665){return _0x47e51f[_0x81f9('0x16')](_0x3502c7);}return _0x47e51f[_0x81f9('0x17')](_0x3502c7)[_0x81f9('0x18')]();};}function respondWithResult(_0x3d12d2,_0x415bad){_0x415bad=_0x415bad||0xc8;return function(_0x327f7e){if(_0x327f7e){return _0x3d12d2[_0x81f9('0x17')](_0x415bad)[_0x81f9('0x19')](_0x327f7e);}};}function respondWithFilteredResult(_0x48ee07,_0x2fe5a1){return function(_0xa6af3b){if(_0xa6af3b){var _0x33b6fd=typeof _0x2fe5a1[_0x81f9('0x1a')]===_0x81f9('0x1b')&&typeof _0x2fe5a1[_0x81f9('0x1c')]==='undefined';var _0x23f5de=_0xa6af3b[_0x81f9('0x1d')];var _0x3edd1c=_0x33b6fd?0x0:_0x2fe5a1[_0x81f9('0x1a')];var _0x42a205=_0x33b6fd?_0xa6af3b[_0x81f9('0x1d')]:_0x2fe5a1[_0x81f9('0x1a')]+_0x2fe5a1[_0x81f9('0x1c')];var _0xb401c5;if(_0x42a205>=_0x23f5de){_0x42a205=_0x23f5de;_0xb401c5=0xc8;}else{_0xb401c5=0xce;}_0x48ee07[_0x81f9('0x17')](_0xb401c5);return _0x48ee07['set'](_0x81f9('0x1e'),_0x3edd1c+'-'+_0x42a205+'/'+_0x23f5de)[_0x81f9('0x19')](_0xa6af3b);}return null;};}function patchUpdates(_0x18e52e){return function(_0x136109){try{jsonpatch[_0x81f9('0x1f')](_0x136109,_0x18e52e,!![]);}catch(_0x38b057){return BPromise[_0x81f9('0x20')](_0x38b057);}return _0x136109[_0x81f9('0x21')]();};}function saveUpdates(_0x206515,_0x1a2cc6){return function(_0x216d92){if(_0x216d92){return _0x216d92[_0x81f9('0x22')](_0x206515)[_0x81f9('0x23')](function(_0x37a521){return _0x37a521;});}return null;};}function removeEntity(_0x4d9224,_0x1e2488){return function(_0x4e5b57){if(_0x4e5b57){return _0x4e5b57['destroy']()[_0x81f9('0x23')](function(){_0x4d9224[_0x81f9('0x17')](0xcc)[_0x81f9('0x18')]();});}};}function handleEntityNotFound(_0x345012,_0x42b3c7){return function(_0x2298b0){if(!_0x2298b0){_0x345012[_0x81f9('0x16')](0x194);}return _0x2298b0;};}function handleError(_0x1b5837,_0x5a1695){_0x5a1695=_0x5a1695||0x1f4;return function(_0xf7ccbd){logger[_0x81f9('0x24')](_0xf7ccbd[_0x81f9('0x25')]);if(_0xf7ccbd[_0x81f9('0x26')]){delete _0xf7ccbd[_0x81f9('0x26')];}_0x1b5837[_0x81f9('0x17')](_0x5a1695)[_0x81f9('0x27')](_0xf7ccbd);};}exports[_0x81f9('0x28')]=function(_0x37ed18,_0x2687ed){var _0x1210a8={},_0x3fe355={},_0x3430ce={'count':0x0,'rows':[]};var _0x4d228d=_['map'](db['FreshdeskConfiguration']['rawAttributes'],function(_0x5d2a23){return{'name':_0x5d2a23['fieldName'],'type':_0x5d2a23['type']['key']};});_0x3fe355['model']=_[_0x81f9('0x29')](_0x4d228d,_0x81f9('0x26'));_0x3fe355['query']=_[_0x81f9('0x2a')](_0x37ed18[_0x81f9('0x2b')]);_0x3fe355['filters']=_[_0x81f9('0x2c')](_0x3fe355[_0x81f9('0x2d')],_0x3fe355[_0x81f9('0x2b')]);_0x1210a8[_0x81f9('0x2e')]=_['intersection'](_0x3fe355[_0x81f9('0x2d')],qs[_0x81f9('0x2f')](_0x37ed18[_0x81f9('0x2b')][_0x81f9('0x2f')]));_0x1210a8[_0x81f9('0x2e')]=_0x1210a8['attributes']['length']?_0x1210a8[_0x81f9('0x2e')]:_0x3fe355[_0x81f9('0x2d')];if(!_0x37ed18[_0x81f9('0x2b')][_0x81f9('0x30')]('nolimit')){_0x1210a8[_0x81f9('0x1c')]=qs['limit'](_0x37ed18[_0x81f9('0x2b')][_0x81f9('0x1c')]);_0x1210a8[_0x81f9('0x1a')]=qs[_0x81f9('0x1a')](_0x37ed18[_0x81f9('0x2b')]['offset']);}_0x1210a8[_0x81f9('0x31')]=qs[_0x81f9('0x32')](_0x37ed18[_0x81f9('0x2b')][_0x81f9('0x32')]);_0x1210a8[_0x81f9('0x33')]=qs[_0x81f9('0x34')](_[_0x81f9('0x35')](_0x37ed18[_0x81f9('0x2b')],_0x3fe355[_0x81f9('0x34')]),_0x4d228d);if(_0x37ed18['query'][_0x81f9('0x36')]){_0x1210a8[_0x81f9('0x33')]=_[_0x81f9('0x37')](_0x1210a8[_0x81f9('0x33')],{'$or':_[_0x81f9('0x29')](_0x4d228d,function(_0x356709){if(_0x356709[_0x81f9('0x38')]!==_0x81f9('0x39')){var _0x5dcdea={};_0x5dcdea[_0x356709[_0x81f9('0x26')]]={'$like':'%'+_0x37ed18[_0x81f9('0x2b')][_0x81f9('0x36')]+'%'};return _0x5dcdea;}})});}_0x1210a8=_['merge']({},_0x1210a8,_0x37ed18['options']);var _0x1bd0f7={'where':_0x1210a8[_0x81f9('0x33')]};return db['FreshdeskConfiguration'][_0x81f9('0x1d')](_0x1bd0f7)[_0x81f9('0x23')](function(_0x414e05){_0x3430ce['count']=_0x414e05;if(_0x37ed18['query'][_0x81f9('0x3a')]){_0x1210a8[_0x81f9('0x3b')]=[{'all':!![]}];}return db[_0x81f9('0x3c')][_0x81f9('0x3d')](_0x1210a8);})[_0x81f9('0x23')](function(_0x9e3e17){_0x3430ce[_0x81f9('0x3e')]=_0x9e3e17;return _0x3430ce;})[_0x81f9('0x23')](respondWithFilteredResult(_0x2687ed,_0x1210a8))[_0x81f9('0x3f')](handleError(_0x2687ed,null));};exports[_0x81f9('0x40')]=function(_0x1a6ef4,_0x16ca4f){var _0x1c3856={'raw':![],'where':{'id':_0x1a6ef4['params']['id']}},_0x5bc366={};_0x5bc366[_0x81f9('0x2d')]=_[_0x81f9('0x2a')](db[_0x81f9('0x3c')][_0x81f9('0x41')]);_0x5bc366[_0x81f9('0x2b')]=_[_0x81f9('0x2a')](_0x1a6ef4[_0x81f9('0x2b')]);_0x5bc366['filters']=_[_0x81f9('0x2c')](_0x5bc366[_0x81f9('0x2d')],_0x5bc366[_0x81f9('0x2b')]);_0x1c3856[_0x81f9('0x2e')]=_[_0x81f9('0x2c')](_0x5bc366[_0x81f9('0x2d')],qs['fields'](_0x1a6ef4[_0x81f9('0x2b')][_0x81f9('0x2f')]));_0x1c3856[_0x81f9('0x2e')]=_0x1c3856[_0x81f9('0x2e')][_0x81f9('0x42')]?_0x1c3856[_0x81f9('0x2e')]:_0x5bc366[_0x81f9('0x2d')];if(_0x1a6ef4[_0x81f9('0x2b')][_0x81f9('0x3a')]){_0x1c3856[_0x81f9('0x3b')]=[{'all':!![]}];}_0x1c3856=_[_0x81f9('0x37')]({},_0x1c3856,_0x1a6ef4['options']);return db[_0x81f9('0x3c')][_0x81f9('0x43')](_0x1c3856)[_0x81f9('0x23')](handleEntityNotFound(_0x16ca4f,null))[_0x81f9('0x23')](respondWithResult(_0x16ca4f,null))['catch'](handleError(_0x16ca4f,null));};exports[_0x81f9('0x44')]=function(_0x19116d,_0x50911e){return db['FreshdeskConfiguration']['create'](_0x19116d[_0x81f9('0x45')],{})['then'](respondWithResult(_0x50911e,0xc9))[_0x81f9('0x3f')](handleError(_0x50911e,null));};exports[_0x81f9('0x22')]=function(_0x283885,_0x47cf73){if(_0x283885[_0x81f9('0x45')]['id']){delete _0x283885[_0x81f9('0x45')]['id'];}return db['FreshdeskConfiguration'][_0x81f9('0x43')]({'where':{'id':_0x283885[_0x81f9('0x46')]['id']}})['then'](handleEntityNotFound(_0x47cf73,null))[_0x81f9('0x23')](saveUpdates(_0x283885[_0x81f9('0x45')],null))['then'](respondWithResult(_0x47cf73,null))['catch'](handleError(_0x47cf73,null));};exports['destroy']=function(_0x484019,_0x3afb62){return db[_0x81f9('0x3c')][_0x81f9('0x43')]({'where':{'id':_0x484019[_0x81f9('0x46')]['id']}})['then'](handleEntityNotFound(_0x3afb62,null))[_0x81f9('0x23')](removeEntity(_0x3afb62,null))[_0x81f9('0x3f')](handleError(_0x3afb62,null));};exports[_0x81f9('0x47')]=function(_0x5ca29a,_0x43607d,_0x5bd0d9){var _0x1bc04e={};var _0x692316={};var _0x3ca711;var _0x23d25c;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x5ca29a['params']['id']}})['then'](handleEntityNotFound(_0x43607d,null))['then'](function(_0x51cdeb){if(_0x51cdeb){_0x3ca711=_0x51cdeb;_0x692316[_0x81f9('0x2d')]=_['keys'](db[_0x81f9('0x48')][_0x81f9('0x41')]);_0x692316[_0x81f9('0x2b')]=_['keys'](_0x5ca29a[_0x81f9('0x2b')]);_0x692316['filters']=_['intersection'](_0x692316['model'],_0x692316[_0x81f9('0x2b')]);_0x1bc04e[_0x81f9('0x2e')]=_[_0x81f9('0x2c')](_0x692316[_0x81f9('0x2d')],qs[_0x81f9('0x2f')](_0x5ca29a[_0x81f9('0x2b')][_0x81f9('0x2f')]));_0x1bc04e[_0x81f9('0x2e')]=_0x1bc04e[_0x81f9('0x2e')][_0x81f9('0x42')]?_0x1bc04e['attributes']:_0x692316[_0x81f9('0x2d')];_0x1bc04e[_0x81f9('0x31')]=qs['sort'](_0x5ca29a[_0x81f9('0x2b')][_0x81f9('0x32')]);_0x1bc04e['where']=qs[_0x81f9('0x34')](_[_0x81f9('0x35')](_0x5ca29a[_0x81f9('0x2b')],_0x692316[_0x81f9('0x34')]));if(_0x5ca29a[_0x81f9('0x2b')]['filter']){_0x1bc04e[_0x81f9('0x33')]=_[_0x81f9('0x37')](_0x1bc04e[_0x81f9('0x33')],{'$or':_[_0x81f9('0x29')](_0x1bc04e[_0x81f9('0x2e')],function(_0x105777){var _0x524408={};_0x524408[_0x105777]={'$like':'%'+_0x5ca29a[_0x81f9('0x2b')]['filter']+'%'};return _0x524408;})});}_0x1bc04e=_[_0x81f9('0x37')]({},_0x1bc04e,_0x5ca29a[_0x81f9('0x49')]);return _0x3ca711[_0x81f9('0x47')](_0x1bc04e);}})[_0x81f9('0x23')](function(_0x30d149){if(_0x30d149){_0x23d25c=_0x30d149[_0x81f9('0x42')];if(!_0x5ca29a[_0x81f9('0x2b')][_0x81f9('0x30')]('nolimit')){_0x1bc04e[_0x81f9('0x1c')]=qs[_0x81f9('0x1c')](_0x5ca29a[_0x81f9('0x2b')][_0x81f9('0x1c')]);_0x1bc04e[_0x81f9('0x1a')]=qs[_0x81f9('0x1a')](_0x5ca29a[_0x81f9('0x2b')]['offset']);}return _0x3ca711['getFields'](_0x1bc04e);}})['then'](function(_0xe47b0b){if(_0xe47b0b){return _0xe47b0b?{'count':_0x23d25c,'rows':_0xe47b0b}:null;}})[_0x81f9('0x23')](respondWithResult(_0x43607d,null))[_0x81f9('0x3f')](handleError(_0x43607d,null));};exports[_0x81f9('0x4a')]=function(_0x554eed,_0x41e1e2,_0x1aad43){var _0x10661d={};var _0x4b7230={};var _0x24b78b;var _0x22856f;return db[_0x81f9('0x3c')]['findOne']({'where':{'id':_0x554eed[_0x81f9('0x46')]['id']}})[_0x81f9('0x23')](handleEntityNotFound(_0x41e1e2,null))[_0x81f9('0x23')](function(_0x422a78){if(_0x422a78){_0x24b78b=_0x422a78;_0x4b7230['model']=_[_0x81f9('0x2a')](db[_0x81f9('0x48')][_0x81f9('0x41')]);_0x4b7230['query']=_[_0x81f9('0x2a')](_0x554eed[_0x81f9('0x2b')]);_0x4b7230[_0x81f9('0x34')]=_[_0x81f9('0x2c')](_0x4b7230['model'],_0x4b7230[_0x81f9('0x2b')]);_0x10661d[_0x81f9('0x2e')]=_['intersection'](_0x4b7230['model'],qs[_0x81f9('0x2f')](_0x554eed['query']['fields']));_0x10661d[_0x81f9('0x2e')]=_0x10661d[_0x81f9('0x2e')][_0x81f9('0x42')]?_0x10661d[_0x81f9('0x2e')]:_0x4b7230[_0x81f9('0x2d')];_0x10661d[_0x81f9('0x31')]=qs[_0x81f9('0x32')](_0x554eed['query'][_0x81f9('0x32')]);_0x10661d['where']=qs[_0x81f9('0x34')](_['pick'](_0x554eed[_0x81f9('0x2b')],_0x4b7230[_0x81f9('0x34')]));if(_0x554eed[_0x81f9('0x2b')][_0x81f9('0x36')]){_0x10661d['where']=_[_0x81f9('0x37')](_0x10661d['where'],{'$or':_[_0x81f9('0x29')](_0x10661d[_0x81f9('0x2e')],function(_0x5ce865){var _0x56cb33={};_0x56cb33[_0x5ce865]={'$like':'%'+_0x554eed[_0x81f9('0x2b')][_0x81f9('0x36')]+'%'};return _0x56cb33;})});}_0x10661d=_[_0x81f9('0x37')]({},_0x10661d,_0x554eed['options']);return _0x24b78b[_0x81f9('0x4a')](_0x10661d);}})[_0x81f9('0x23')](function(_0x490dde){if(_0x490dde){_0x22856f=_0x490dde['length'];if(!_0x554eed[_0x81f9('0x2b')][_0x81f9('0x30')](_0x81f9('0x4b'))){_0x10661d[_0x81f9('0x1c')]=qs[_0x81f9('0x1c')](_0x554eed[_0x81f9('0x2b')][_0x81f9('0x1c')]);_0x10661d[_0x81f9('0x1a')]=qs['offset'](_0x554eed['query'][_0x81f9('0x1a')]);}return _0x24b78b[_0x81f9('0x4a')](_0x10661d);}})[_0x81f9('0x23')](function(_0x1d35b){if(_0x1d35b){return _0x1d35b?{'count':_0x22856f,'rows':_0x1d35b}:null;}})[_0x81f9('0x23')](respondWithResult(_0x41e1e2,null))['catch'](handleError(_0x41e1e2,null));};exports[_0x81f9('0x4c')]=function(_0x5171fa,_0x3a0e9c,_0x3f8126){var _0x2d7800={};var _0xeb44f3={};var _0x367fd2;var _0x52db40;return db[_0x81f9('0x3c')]['findOne']({'where':{'id':_0x5171fa[_0x81f9('0x46')]['id']}})[_0x81f9('0x23')](handleEntityNotFound(_0x3a0e9c,null))['then'](function(_0x499316){if(_0x499316){_0x367fd2=_0x499316;_0xeb44f3[_0x81f9('0x2d')]=_[_0x81f9('0x2a')](db[_0x81f9('0x48')][_0x81f9('0x41')]);_0xeb44f3['query']=_[_0x81f9('0x2a')](_0x5171fa[_0x81f9('0x2b')]);_0xeb44f3[_0x81f9('0x34')]=_[_0x81f9('0x2c')](_0xeb44f3['model'],_0xeb44f3[_0x81f9('0x2b')]);_0x2d7800[_0x81f9('0x2e')]=_[_0x81f9('0x2c')](_0xeb44f3['model'],qs['fields'](_0x5171fa[_0x81f9('0x2b')][_0x81f9('0x2f')]));_0x2d7800['attributes']=_0x2d7800[_0x81f9('0x2e')]['length']?_0x2d7800[_0x81f9('0x2e')]:_0xeb44f3[_0x81f9('0x2d')];_0x2d7800[_0x81f9('0x31')]=qs['sort'](_0x5171fa[_0x81f9('0x2b')]['sort']);_0x2d7800[_0x81f9('0x33')]=qs[_0x81f9('0x34')](_['pick'](_0x5171fa[_0x81f9('0x2b')],_0xeb44f3[_0x81f9('0x34')]));if(_0x5171fa['query'][_0x81f9('0x36')]){_0x2d7800[_0x81f9('0x33')]=_[_0x81f9('0x37')](_0x2d7800[_0x81f9('0x33')],{'$or':_[_0x81f9('0x29')](_0x2d7800[_0x81f9('0x2e')],function(_0x43f0dd){var _0x3cab09={};_0x3cab09[_0x43f0dd]={'$like':'%'+_0x5171fa[_0x81f9('0x2b')]['filter']+'%'};return _0x3cab09;})});}_0x2d7800=_['merge']({},_0x2d7800,_0x5171fa[_0x81f9('0x49')]);return _0x367fd2[_0x81f9('0x4c')](_0x2d7800);}})[_0x81f9('0x23')](function(_0x10ec67){if(_0x10ec67){_0x52db40=_0x10ec67[_0x81f9('0x42')];if(!_0x5171fa[_0x81f9('0x2b')][_0x81f9('0x30')](_0x81f9('0x4b'))){_0x2d7800[_0x81f9('0x1c')]=qs[_0x81f9('0x1c')](_0x5171fa[_0x81f9('0x2b')][_0x81f9('0x1c')]);_0x2d7800[_0x81f9('0x1a')]=qs[_0x81f9('0x1a')](_0x5171fa[_0x81f9('0x2b')][_0x81f9('0x1a')]);}return _0x367fd2[_0x81f9('0x4c')](_0x2d7800);}})[_0x81f9('0x23')](function(_0x44d690){if(_0x44d690){return _0x44d690?{'count':_0x52db40,'rows':_0x44d690}:null;}})[_0x81f9('0x23')](respondWithResult(_0x3a0e9c,null))[_0x81f9('0x3f')](handleError(_0x3a0e9c,null));};exports[_0x81f9('0x4d')]=function(_0x5619db,_0x40552a,_0x26dd99){var _0x1d336c={};var _0x560f34={};var _0x1519d6;var _0x266109;return db[_0x81f9('0x3c')]['findOne']({'where':{'id':_0x5619db['params']['id']}})[_0x81f9('0x23')](handleEntityNotFound(_0x40552a,null))['then'](function(_0x3c638e){if(_0x3c638e){_0x1519d6=_0x3c638e;_0x560f34['model']=_[_0x81f9('0x2a')](db[_0x81f9('0x4e')][_0x81f9('0x41')]);_0x560f34[_0x81f9('0x2b')]=_['keys'](_0x5619db[_0x81f9('0x2b')]);_0x560f34[_0x81f9('0x34')]=_['intersection'](_0x560f34[_0x81f9('0x2d')],_0x560f34['query']);_0x1d336c[_0x81f9('0x2e')]=_[_0x81f9('0x2c')](_0x560f34[_0x81f9('0x2d')],qs['fields'](_0x5619db[_0x81f9('0x2b')]['fields']));_0x1d336c[_0x81f9('0x2e')]=_0x1d336c[_0x81f9('0x2e')][_0x81f9('0x42')]?_0x1d336c[_0x81f9('0x2e')]:_0x560f34['model'];_0x1d336c[_0x81f9('0x31')]=qs[_0x81f9('0x32')](_0x5619db[_0x81f9('0x2b')][_0x81f9('0x32')]);_0x1d336c[_0x81f9('0x33')]=qs[_0x81f9('0x34')](_[_0x81f9('0x35')](_0x5619db[_0x81f9('0x2b')],_0x560f34['filters']));if(_0x5619db['query']['filter']){_0x1d336c[_0x81f9('0x33')]=_[_0x81f9('0x37')](_0x1d336c[_0x81f9('0x33')],{'$or':_['map'](_0x1d336c[_0x81f9('0x2e')],function(_0x535680){var _0x1a0763={};_0x1a0763[_0x535680]={'$like':'%'+_0x5619db['query'][_0x81f9('0x36')]+'%'};return _0x1a0763;})});}_0x1d336c=_[_0x81f9('0x37')]({},_0x1d336c,_0x5619db['options']);return _0x1519d6['getTags'](_0x1d336c);}})[_0x81f9('0x23')](function(_0x3f6a1e){if(_0x3f6a1e){_0x266109=_0x3f6a1e[_0x81f9('0x42')];if(!_0x5619db[_0x81f9('0x2b')]['hasOwnProperty'](_0x81f9('0x4b'))){_0x1d336c['limit']=qs[_0x81f9('0x1c')](_0x5619db['query'][_0x81f9('0x1c')]);_0x1d336c[_0x81f9('0x1a')]=qs[_0x81f9('0x1a')](_0x5619db[_0x81f9('0x2b')][_0x81f9('0x1a')]);}return _0x1519d6[_0x81f9('0x4d')](_0x1d336c);}})[_0x81f9('0x23')](function(_0x1d0fd4){if(_0x1d0fd4){return _0x1d0fd4?{'count':_0x266109,'rows':_0x1d0fd4}:null;}})[_0x81f9('0x23')](respondWithResult(_0x40552a,null))[_0x81f9('0x3f')](handleError(_0x40552a,null));};exports[_0x81f9('0x4f')]=function(_0x372513,_0xd1983c,_0x3b3b55){if(_0x372513[_0x81f9('0x45')]['id']){delete _0x372513[_0x81f9('0x45')]['id'];}return db[_0x81f9('0x3c')][_0x81f9('0x50')]({'where':{'id':_0x372513[_0x81f9('0x46')]['id']}})[_0x81f9('0x23')](handleEntityNotFound(_0xd1983c,null))[_0x81f9('0x23')](function(_0x16dd3f){if(_0x16dd3f){return _0x16dd3f[_0x81f9('0x4f')](_0x372513[_0x81f9('0x45')][_0x81f9('0x51')]||[]);}return null;})[_0x81f9('0x23')](respondWithResult(_0xd1983c,null))[_0x81f9('0x3f')](handleError(_0xd1983c,null));};
\ No newline at end of file