Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / intZendeskConfiguration / intZendeskConfiguration.controller.js
index a6a25f2..ea643b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x814b=['filters','pick','merge','type','VIRTUAL','filter','options','ZendeskConfiguration','count','includeAll','include','findAll','rows','show','params','keys','find','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','http','test','Sequelize','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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','error','ZendeskConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','Content-Range','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x1e4166,_0x25916a){var _0xf278ef=function(_0x249d6d){while(--_0x249d6d){_0x1e4166['push'](_0x1e4166['shift']());}};_0xf278ef(++_0x25916a);}(_0x814b,0x1a2));var _0xb814=function(_0x32e649,_0x228649){_0x32e649=_0x32e649-0x0;var _0x14d386=_0x814b[_0x32e649];return _0x14d386;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];var jayson=require(_0xb814('0x1a'));var client=jayson[_0xb814('0x1b')][_0xb814('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x2ce718,_0x3bde14,_0x1438e7){if(_0x1438e7){var _0x41ed7b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41ed7b[_0xb814('0x1d')](_0x3bde14)){return _0x2ce718;}else{throw new db[(_0xb814('0x1e'))][(_0xb814('0x1f'))](_0xb814('0x20'));}}else{return _0x2ce718;}}function respondWithRpcPromise(_0x17f5bd,_0x39bfcf,_0x303aca,_0x3a71d6){return new BPromise(function(_0x45e0d0,_0x265a83){var _0x125ce2=_0x3a71d6||client;return _0x125ce2[_0xb814('0x21')](_0x17f5bd,_0x303aca)[_0xb814('0x22')](function(_0x48c9df){logger[_0xb814('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0x39bfcf,_0xb814('0x24'));logger[_0xb814('0x25')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x39bfcf,'request\x20sent',JSON['stringify'](_0x48c9df));if(_0x48c9df[_0xb814('0x26')]){if(_0x48c9df['error']['code']===0x1f4){logger[_0xb814('0x26')](_0xb814('0x27'),_0x39bfcf,_0x48c9df[_0xb814('0x26')]['message']);return _0x265a83(_0x48c9df[_0xb814('0x26')]['message']);}logger[_0xb814('0x26')](_0xb814('0x27'),_0x39bfcf,_0x48c9df[_0xb814('0x26')][_0xb814('0x28')]);return _0x45e0d0(_0x48c9df[_0xb814('0x26')][_0xb814('0x28')]);}else{logger[_0xb814('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0x39bfcf,_0xb814('0x24'));_0x45e0d0(_0x48c9df['result'][_0xb814('0x28')]);}})[_0xb814('0x29')](function(_0x31c7ec){logger[_0xb814('0x26')](_0xb814('0x27'),_0x39bfcf,_0x31c7ec);_0x265a83(_0x31c7ec);});});}function respondWithStatusCode(_0xb9e57d,_0x3d836c){_0x3d836c=_0x3d836c||0xcc;return function(_0x5755ea){if(_0x5755ea){return _0xb9e57d[_0xb814('0x2a')](_0x3d836c);}return _0xb9e57d[_0xb814('0x2b')](_0x3d836c)[_0xb814('0x2c')]();};}function respondWithResult(_0x349394,_0x32ed56){_0x32ed56=_0x32ed56||0xc8;return function(_0x1d5965){if(_0x1d5965){return _0x349394[_0xb814('0x2b')](_0x32ed56)[_0xb814('0x2d')](_0x1d5965);}};}function respondWithFilteredResult(_0x5a6291,_0x271aa8){return function(_0x328a08){if(_0x328a08){var _0x52ed64=_0x328a08['count'],_0x9008b2=_0x271aa8[_0xb814('0x2e')],_0x37d24d=_0x271aa8[_0xb814('0x2e')]+_0x271aa8['limit'],_0x530744;if(_0x37d24d>=_0x52ed64){_0x37d24d=_0x52ed64;_0x530744=0xc8;}else{_0x530744=0xce;}_0x5a6291[_0xb814('0x2b')](_0x530744);return _0x5a6291['set'](_0xb814('0x2f'),_0x9008b2+'-'+_0x37d24d+'/'+_0x52ed64)['json'](_0x328a08);}return null;};}function patchUpdates(_0x4cfc58){return function(_0x419cd9){try{jsonpatch['apply'](_0x419cd9,_0x4cfc58,!![]);}catch(_0x2431e2){return BPromise[_0xb814('0x30')](_0x2431e2);}return _0x419cd9[_0xb814('0x31')]();};}function saveUpdates(_0x599f9f,_0x51d5ae){return function(_0x26d3a9){if(_0x26d3a9){return _0x26d3a9[_0xb814('0x32')](_0x599f9f)['then'](function(_0x2c8943){return _0x2c8943;});}return null;};}function removeEntity(_0xe558d5,_0x692c72){return function(_0x217b7e){if(_0x217b7e){return _0x217b7e[_0xb814('0x33')]()[_0xb814('0x22')](function(){_0xe558d5[_0xb814('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3207ec,_0x2263f6){return function(_0x30de5a){if(!_0x30de5a){_0x3207ec[_0xb814('0x2a')](0x194);}return _0x30de5a;};}function handleError(_0x14100d,_0x4ff31a){_0x4ff31a=_0x4ff31a||0x1f4;return function(_0x16ef82){logger['error'](_0x16ef82[_0xb814('0x34')]);if(_0x16ef82[_0xb814('0x35')]){delete _0x16ef82[_0xb814('0x35')];}_0x14100d['status'](_0x4ff31a)[_0xb814('0x36')](_0x16ef82);};}exports[_0xb814('0x37')]=function(_0x4ea6f8,_0x2fcd92){var _0x2d0e27={},_0x1a8bd0={},_0x1f7cd8={'count':0x0,'rows':[]};var _0xd77d96=_[_0xb814('0x38')](db['ZendeskConfiguration'][_0xb814('0x39')],function(_0x4e4684){return{'name':_0x4e4684[_0xb814('0x3a')],'type':_0x4e4684['type'][_0xb814('0x3b')]};});_0x1a8bd0['model']=_[_0xb814('0x38')](_0xd77d96,_0xb814('0x35'));_0x1a8bd0['query']=_['keys'](_0x4ea6f8['query']);_0x1a8bd0['filters']=_[_0xb814('0x3c')](_0x1a8bd0[_0xb814('0x3d')],_0x1a8bd0[_0xb814('0x3e')]);_0x2d0e27[_0xb814('0x3f')]=_['intersection'](_0x1a8bd0['model'],qs[_0xb814('0x40')](_0x4ea6f8['query'][_0xb814('0x40')]));_0x2d0e27[_0xb814('0x3f')]=_0x2d0e27[_0xb814('0x3f')][_0xb814('0x41')]?_0x2d0e27[_0xb814('0x3f')]:_0x1a8bd0[_0xb814('0x3d')];if(!_0x4ea6f8[_0xb814('0x3e')][_0xb814('0x42')](_0xb814('0x43'))){_0x2d0e27['limit']=qs['limit'](_0x4ea6f8['query'][_0xb814('0x44')]);_0x2d0e27['offset']=qs[_0xb814('0x2e')](_0x4ea6f8['query'][_0xb814('0x2e')]);}_0x2d0e27[_0xb814('0x45')]=qs[_0xb814('0x46')](_0x4ea6f8[_0xb814('0x3e')]['sort']);_0x2d0e27[_0xb814('0x47')]=qs[_0xb814('0x48')](_[_0xb814('0x49')](_0x4ea6f8[_0xb814('0x3e')],_0x1a8bd0[_0xb814('0x48')]));if(_0x4ea6f8[_0xb814('0x3e')]['filter']){_0x2d0e27[_0xb814('0x47')]=_[_0xb814('0x4a')](_0x2d0e27[_0xb814('0x47')],{'$or':_[_0xb814('0x38')](_0xd77d96,function(_0x46408b){if(_0x46408b[_0xb814('0x4b')]!==_0xb814('0x4c')){var _0x519545={};_0x519545[_0x46408b['name']]={'$like':'%'+_0x4ea6f8[_0xb814('0x3e')][_0xb814('0x4d')]+'%'};return _0x519545;}})});}_0x2d0e27=_[_0xb814('0x4a')]({},_0x2d0e27,_0x4ea6f8[_0xb814('0x4e')]);var _0x43f1b={'where':_0x2d0e27[_0xb814('0x47')]};return db[_0xb814('0x4f')][_0xb814('0x50')](_0x43f1b)[_0xb814('0x22')](function(_0x344198){_0x1f7cd8[_0xb814('0x50')]=_0x344198;if(_0x4ea6f8['query'][_0xb814('0x51')]){_0x2d0e27[_0xb814('0x52')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xb814('0x53')](_0x2d0e27);})['then'](function(_0x2fb0f7){_0x1f7cd8[_0xb814('0x54')]=_0x2fb0f7;return _0x1f7cd8;})[_0xb814('0x22')](respondWithFilteredResult(_0x2fcd92,_0x2d0e27))[_0xb814('0x29')](handleError(_0x2fcd92,null));};exports[_0xb814('0x55')]=function(_0x4096d4,_0x2cc806){var _0x45480e={'raw':![],'where':{'id':_0x4096d4[_0xb814('0x56')]['id']}},_0x32a397={};_0x32a397['model']=_['keys'](db[_0xb814('0x4f')][_0xb814('0x39')]);_0x32a397[_0xb814('0x3e')]=_[_0xb814('0x57')](_0x4096d4[_0xb814('0x3e')]);_0x32a397[_0xb814('0x48')]=_[_0xb814('0x3c')](_0x32a397['model'],_0x32a397[_0xb814('0x3e')]);_0x45480e[_0xb814('0x3f')]=_[_0xb814('0x3c')](_0x32a397['model'],qs[_0xb814('0x40')](_0x4096d4['query'][_0xb814('0x40')]));_0x45480e['attributes']=_0x45480e[_0xb814('0x3f')][_0xb814('0x41')]?_0x45480e['attributes']:_0x32a397[_0xb814('0x3d')];if(_0x4096d4[_0xb814('0x3e')][_0xb814('0x51')]){_0x45480e['include']=[{'all':!![]}];}_0x45480e=_[_0xb814('0x4a')]({},_0x45480e,_0x4096d4['options']);return db[_0xb814('0x4f')][_0xb814('0x58')](_0x45480e)['then'](handleEntityNotFound(_0x2cc806,null))[_0xb814('0x22')](respondWithResult(_0x2cc806,null))['catch'](handleError(_0x2cc806,null));};exports['create']=function(_0x3b9709,_0x35f59a){return db[_0xb814('0x4f')]['create'](_0x3b9709[_0xb814('0x59')],{})['then'](respondWithResult(_0x35f59a,0xc9))[_0xb814('0x29')](handleError(_0x35f59a,null));};exports[_0xb814('0x32')]=function(_0x58d6e5,_0x2db5a6){if(_0x58d6e5['body']['id']){delete _0x58d6e5[_0xb814('0x59')]['id'];}return db[_0xb814('0x4f')][_0xb814('0x58')]({'where':{'id':_0x58d6e5[_0xb814('0x56')]['id']}})[_0xb814('0x22')](handleEntityNotFound(_0x2db5a6,null))[_0xb814('0x22')](saveUpdates(_0x58d6e5[_0xb814('0x59')],null))[_0xb814('0x22')](respondWithResult(_0x2db5a6,null))['catch'](handleError(_0x2db5a6,null));};exports[_0xb814('0x33')]=function(_0x5441c5,_0x5d71d5){return db[_0xb814('0x4f')][_0xb814('0x58')]({'where':{'id':_0x5441c5['params']['id']}})[_0xb814('0x22')](handleEntityNotFound(_0x5d71d5,null))['then'](removeEntity(_0x5d71d5,null))['catch'](handleError(_0x5d71d5,null));};exports[_0xb814('0x5a')]=function(_0x5257be,_0x3ff213,_0xd1cd8b){var _0x2dec52={};var _0x586957={};var _0x1a0ef4;var _0x4df65c;return db[_0xb814('0x4f')][_0xb814('0x5b')]({'where':{'id':_0x5257be[_0xb814('0x56')]['id']}})[_0xb814('0x22')](handleEntityNotFound(_0x3ff213,null))[_0xb814('0x22')](function(_0x3b374b){if(_0x3b374b){_0x1a0ef4=_0x3b374b;_0x586957[_0xb814('0x3d')]=_[_0xb814('0x57')](db[_0xb814('0x5c')]['rawAttributes']);_0x586957[_0xb814('0x3e')]=_[_0xb814('0x57')](_0x5257be[_0xb814('0x3e')]);_0x586957[_0xb814('0x48')]=_[_0xb814('0x3c')](_0x586957[_0xb814('0x3d')],_0x586957['query']);_0x2dec52[_0xb814('0x3f')]=_['intersection'](_0x586957[_0xb814('0x3d')],qs[_0xb814('0x40')](_0x5257be[_0xb814('0x3e')]['fields']));_0x2dec52[_0xb814('0x3f')]=_0x2dec52['attributes'][_0xb814('0x41')]?_0x2dec52['attributes']:_0x586957[_0xb814('0x3d')];_0x2dec52[_0xb814('0x45')]=qs[_0xb814('0x46')](_0x5257be[_0xb814('0x3e')][_0xb814('0x46')]);_0x2dec52[_0xb814('0x47')]=qs[_0xb814('0x48')](_['pick'](_0x5257be[_0xb814('0x3e')],_0x586957['filters']));if(_0x5257be[_0xb814('0x3e')][_0xb814('0x4d')]){_0x2dec52[_0xb814('0x47')]=_[_0xb814('0x4a')](_0x2dec52[_0xb814('0x47')],{'$or':_[_0xb814('0x38')](_0x2dec52['attributes'],function(_0x12882a){var _0x1a2603={};_0x1a2603[_0x12882a]={'$like':'%'+_0x5257be['query'][_0xb814('0x4d')]+'%'};return _0x1a2603;})});}_0x2dec52=_[_0xb814('0x4a')]({},_0x2dec52,_0x5257be[_0xb814('0x4e')]);return _0x1a0ef4[_0xb814('0x5a')](_0x2dec52);}})[_0xb814('0x22')](function(_0x51d834){if(_0x51d834){_0x4df65c=_0x51d834[_0xb814('0x41')];if(!_0x5257be['query'][_0xb814('0x42')](_0xb814('0x43'))){_0x2dec52[_0xb814('0x44')]=qs[_0xb814('0x44')](_0x5257be[_0xb814('0x3e')][_0xb814('0x44')]);_0x2dec52['offset']=qs['offset'](_0x5257be['query'][_0xb814('0x2e')]);}return _0x1a0ef4['getFields'](_0x2dec52);}})[_0xb814('0x22')](function(_0x1d3954){if(_0x1d3954){return _0x1d3954?{'count':_0x4df65c,'rows':_0x1d3954}:null;}})[_0xb814('0x22')](respondWithResult(_0x3ff213,null))['catch'](handleError(_0x3ff213,null));};exports[_0xb814('0x5d')]=function(_0x3e5ce8,_0xee204,_0x5aabbe){var _0x30f717={};var _0x1bf0b7={};var _0x1f39c0;var _0x3564e0;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x3e5ce8[_0xb814('0x56')]['id']}})[_0xb814('0x22')](handleEntityNotFound(_0xee204,null))[_0xb814('0x22')](function(_0x408870){if(_0x408870){_0x1f39c0=_0x408870;_0x1bf0b7[_0xb814('0x3d')]=_[_0xb814('0x57')](db[_0xb814('0x5c')][_0xb814('0x39')]);_0x1bf0b7[_0xb814('0x3e')]=_[_0xb814('0x57')](_0x3e5ce8[_0xb814('0x3e')]);_0x1bf0b7[_0xb814('0x48')]=_[_0xb814('0x3c')](_0x1bf0b7[_0xb814('0x3d')],_0x1bf0b7[_0xb814('0x3e')]);_0x30f717['attributes']=_[_0xb814('0x3c')](_0x1bf0b7[_0xb814('0x3d')],qs[_0xb814('0x40')](_0x3e5ce8[_0xb814('0x3e')][_0xb814('0x40')]));_0x30f717[_0xb814('0x3f')]=_0x30f717['attributes'][_0xb814('0x41')]?_0x30f717['attributes']:_0x1bf0b7[_0xb814('0x3d')];_0x30f717[_0xb814('0x45')]=qs[_0xb814('0x46')](_0x3e5ce8[_0xb814('0x3e')][_0xb814('0x46')]);_0x30f717['where']=qs['filters'](_[_0xb814('0x49')](_0x3e5ce8[_0xb814('0x3e')],_0x1bf0b7[_0xb814('0x48')]));if(_0x3e5ce8[_0xb814('0x3e')]['filter']){_0x30f717[_0xb814('0x47')]=_['merge'](_0x30f717[_0xb814('0x47')],{'$or':_[_0xb814('0x38')](_0x30f717['attributes'],function(_0x58b016){var _0x2fa6b7={};_0x2fa6b7[_0x58b016]={'$like':'%'+_0x3e5ce8['query'][_0xb814('0x4d')]+'%'};return _0x2fa6b7;})});}_0x30f717=_[_0xb814('0x4a')]({},_0x30f717,_0x3e5ce8[_0xb814('0x4e')]);return _0x1f39c0[_0xb814('0x5d')](_0x30f717);}})[_0xb814('0x22')](function(_0x420bde){if(_0x420bde){_0x3564e0=_0x420bde[_0xb814('0x41')];if(!_0x3e5ce8['query'][_0xb814('0x42')]('nolimit')){_0x30f717[_0xb814('0x44')]=qs['limit'](_0x3e5ce8[_0xb814('0x3e')][_0xb814('0x44')]);_0x30f717['offset']=qs[_0xb814('0x2e')](_0x3e5ce8['query'][_0xb814('0x2e')]);}return _0x1f39c0[_0xb814('0x5d')](_0x30f717);}})['then'](function(_0x5a0c4a){if(_0x5a0c4a){return _0x5a0c4a?{'count':_0x3564e0,'rows':_0x5a0c4a}:null;}})[_0xb814('0x22')](respondWithResult(_0xee204,null))[_0xb814('0x29')](handleError(_0xee204,null));};exports[_0xb814('0x5e')]=function(_0x6f5e6a,_0x220f8b,_0x4394da){var _0x2b12a9={};var _0x314600={};var _0x8cb107;var _0x34f49c;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x6f5e6a['params']['id']}})['then'](handleEntityNotFound(_0x220f8b,null))['then'](function(_0x45a202){if(_0x45a202){_0x8cb107=_0x45a202;_0x314600[_0xb814('0x3d')]=_[_0xb814('0x57')](db['ZendeskField'][_0xb814('0x39')]);_0x314600[_0xb814('0x3e')]=_[_0xb814('0x57')](_0x6f5e6a[_0xb814('0x3e')]);_0x314600[_0xb814('0x48')]=_[_0xb814('0x3c')](_0x314600[_0xb814('0x3d')],_0x314600[_0xb814('0x3e')]);_0x2b12a9['attributes']=_[_0xb814('0x3c')](_0x314600[_0xb814('0x3d')],qs[_0xb814('0x40')](_0x6f5e6a[_0xb814('0x3e')]['fields']));_0x2b12a9[_0xb814('0x3f')]=_0x2b12a9[_0xb814('0x3f')][_0xb814('0x41')]?_0x2b12a9[_0xb814('0x3f')]:_0x314600[_0xb814('0x3d')];_0x2b12a9['order']=qs['sort'](_0x6f5e6a[_0xb814('0x3e')]['sort']);_0x2b12a9[_0xb814('0x47')]=qs[_0xb814('0x48')](_['pick'](_0x6f5e6a[_0xb814('0x3e')],_0x314600['filters']));if(_0x6f5e6a[_0xb814('0x3e')]['filter']){_0x2b12a9[_0xb814('0x47')]=_[_0xb814('0x4a')](_0x2b12a9[_0xb814('0x47')],{'$or':_[_0xb814('0x38')](_0x2b12a9[_0xb814('0x3f')],function(_0x1ae812){var _0x455b22={};_0x455b22[_0x1ae812]={'$like':'%'+_0x6f5e6a['query']['filter']+'%'};return _0x455b22;})});}_0x2b12a9=_[_0xb814('0x4a')]({},_0x2b12a9,_0x6f5e6a['options']);return _0x8cb107['getDescriptions'](_0x2b12a9);}})[_0xb814('0x22')](function(_0x8fbda1){if(_0x8fbda1){_0x34f49c=_0x8fbda1[_0xb814('0x41')];if(!_0x6f5e6a['query'][_0xb814('0x42')]('nolimit')){_0x2b12a9[_0xb814('0x44')]=qs[_0xb814('0x44')](_0x6f5e6a[_0xb814('0x3e')][_0xb814('0x44')]);_0x2b12a9['offset']=qs[_0xb814('0x2e')](_0x6f5e6a[_0xb814('0x3e')][_0xb814('0x2e')]);}return _0x8cb107['getDescriptions'](_0x2b12a9);}})[_0xb814('0x22')](function(_0x3fc77d){if(_0x3fc77d){return _0x3fc77d?{'count':_0x34f49c,'rows':_0x3fc77d}:null;}})[_0xb814('0x22')](respondWithResult(_0x220f8b,null))['catch'](handleError(_0x220f8b,null));};exports[_0xb814('0x5f')]=function(_0x2d0651,_0x9dc06b,_0x216d67){var _0x40b3c5={};var _0x1ae8e8={};var _0x37a7ab;var _0x472c38;return db[_0xb814('0x4f')][_0xb814('0x5b')]({'where':{'id':_0x2d0651[_0xb814('0x56')]['id']}})[_0xb814('0x22')](handleEntityNotFound(_0x9dc06b,null))[_0xb814('0x22')](function(_0x5b8d2e){if(_0x5b8d2e){_0x37a7ab=_0x5b8d2e;_0x1ae8e8['model']=_[_0xb814('0x57')](db['Tag'][_0xb814('0x39')]);_0x1ae8e8[_0xb814('0x3e')]=_[_0xb814('0x57')](_0x2d0651[_0xb814('0x3e')]);_0x1ae8e8[_0xb814('0x48')]=_[_0xb814('0x3c')](_0x1ae8e8[_0xb814('0x3d')],_0x1ae8e8['query']);_0x40b3c5['attributes']=_[_0xb814('0x3c')](_0x1ae8e8['model'],qs[_0xb814('0x40')](_0x2d0651[_0xb814('0x3e')][_0xb814('0x40')]));_0x40b3c5['attributes']=_0x40b3c5[_0xb814('0x3f')][_0xb814('0x41')]?_0x40b3c5[_0xb814('0x3f')]:_0x1ae8e8[_0xb814('0x3d')];_0x40b3c5[_0xb814('0x45')]=qs['sort'](_0x2d0651[_0xb814('0x3e')][_0xb814('0x46')]);_0x40b3c5['where']=qs[_0xb814('0x48')](_[_0xb814('0x49')](_0x2d0651[_0xb814('0x3e')],_0x1ae8e8['filters']));if(_0x2d0651[_0xb814('0x3e')][_0xb814('0x4d')]){_0x40b3c5['where']=_[_0xb814('0x4a')](_0x40b3c5[_0xb814('0x47')],{'$or':_['map'](_0x40b3c5[_0xb814('0x3f')],function(_0x269832){var _0x3f4cbf={};_0x3f4cbf[_0x269832]={'$like':'%'+_0x2d0651[_0xb814('0x3e')][_0xb814('0x4d')]+'%'};return _0x3f4cbf;})});}_0x40b3c5=_[_0xb814('0x4a')]({},_0x40b3c5,_0x2d0651[_0xb814('0x4e')]);return _0x37a7ab[_0xb814('0x5f')](_0x40b3c5);}})[_0xb814('0x22')](function(_0x1f8c7a){if(_0x1f8c7a){_0x472c38=_0x1f8c7a[_0xb814('0x41')];if(!_0x2d0651[_0xb814('0x3e')]['hasOwnProperty']('nolimit')){_0x40b3c5[_0xb814('0x44')]=qs['limit'](_0x2d0651['query'][_0xb814('0x44')]);_0x40b3c5['offset']=qs['offset'](_0x2d0651['query'][_0xb814('0x2e')]);}return _0x37a7ab[_0xb814('0x5f')](_0x40b3c5);}})[_0xb814('0x22')](function(_0x5eb4b1){if(_0x5eb4b1){return _0x5eb4b1?{'count':_0x472c38,'rows':_0x5eb4b1}:null;}})[_0xb814('0x22')](respondWithResult(_0x9dc06b,null))['catch'](handleError(_0x9dc06b,null));};exports[_0xb814('0x60')]=function(_0x2e6660,_0x49a8de,_0x3c6a59){if(_0x2e6660['body']['id']){delete _0x2e6660[_0xb814('0x59')]['id'];}return db[_0xb814('0x4f')][_0xb814('0x5b')]({'where':{'id':_0x2e6660[_0xb814('0x56')]['id']}})[_0xb814('0x22')](handleEntityNotFound(_0x49a8de,null))[_0xb814('0x22')](function(_0x1f2ef8){if(_0x1f2ef8){return _0x1f2ef8[_0xb814('0x60')](_0x2e6660[_0xb814('0x59')][_0xb814('0x61')]||[]);}return null;})[_0xb814('0x22')](respondWithResult(_0x49a8de,null))[_0xb814('0x29')](handleError(_0x49a8de,null));};
\ No newline at end of file
+var _0xff86=['stack','name','send','index','map','ZendeskConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','include','merge','find','create','body','ZendeskField','order','pick','getFields','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus'];(function(_0x5dff0c,_0x2bdeb4){var _0x15615f=function(_0x22956e){while(--_0x22956e){_0x5dff0c['push'](_0x5dff0c['shift']());}};_0x15615f(++_0x2bdeb4);}(_0xff86,0x129));var _0x6ff8=function(_0x16b606,_0x49f3ab){_0x16b606=_0x16b606-0x0;var _0xbd122c=_0xff86[_0x16b606];return _0xbd122c;};'use strict';var emlformat=require(_0x6ff8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ff8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6ff8('0x2'));var Mustache=require(_0x6ff8('0x3'));var util=require(_0x6ff8('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x6ff8('0x5'));var ejs=require(_0x6ff8('0x6'));var fs=require('fs');var fs_extra=require(_0x6ff8('0x7'));var _=require(_0x6ff8('0x8'));var squel=require(_0x6ff8('0x9'));var crypto=require(_0x6ff8('0xa'));var jsforce=require(_0x6ff8('0xb'));var deskjs=require(_0x6ff8('0xc'));var toCsv=require(_0x6ff8('0x5'));var querystring=require(_0x6ff8('0xd'));var Papa=require(_0x6ff8('0xe'));var Redis=require(_0x6ff8('0xf'));var authService=require(_0x6ff8('0x10'));var qs=require(_0x6ff8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ff8('0x12'));var logger=require('../../config/logger')(_0x6ff8('0x13'));var utils=require(_0x6ff8('0x14'));var config=require(_0x6ff8('0x15'));var licenseUtil=require(_0x6ff8('0x16'));var db=require(_0x6ff8('0x17'))['db'];function respondWithStatusCode(_0x303cc8,_0x5191b7){_0x5191b7=_0x5191b7||0xcc;return function(_0x304495){if(_0x304495){return _0x303cc8['sendStatus'](_0x5191b7);}return _0x303cc8[_0x6ff8('0x18')](_0x5191b7)[_0x6ff8('0x19')]();};}function respondWithResult(_0xf4afa3,_0x42da82){_0x42da82=_0x42da82||0xc8;return function(_0x4b2a99){if(_0x4b2a99){return _0xf4afa3[_0x6ff8('0x18')](_0x42da82)[_0x6ff8('0x1a')](_0x4b2a99);}};}function respondWithFilteredResult(_0x4b1c68,_0x13ed0c){return function(_0x331456){if(_0x331456){var _0x3bfc39=typeof _0x13ed0c[_0x6ff8('0x1b')]===_0x6ff8('0x1c')&&typeof _0x13ed0c['limit']===_0x6ff8('0x1c');var _0xb5c285=_0x331456[_0x6ff8('0x1d')];var _0x58b05e=_0x3bfc39?0x0:_0x13ed0c[_0x6ff8('0x1b')];var _0x337333=_0x3bfc39?_0x331456[_0x6ff8('0x1d')]:_0x13ed0c[_0x6ff8('0x1b')]+_0x13ed0c[_0x6ff8('0x1e')];var _0x6cb150;if(_0x337333>=_0xb5c285){_0x337333=_0xb5c285;_0x6cb150=0xc8;}else{_0x6cb150=0xce;}_0x4b1c68[_0x6ff8('0x18')](_0x6cb150);return _0x4b1c68[_0x6ff8('0x1f')](_0x6ff8('0x20'),_0x58b05e+'-'+_0x337333+'/'+_0xb5c285)['json'](_0x331456);}return null;};}function patchUpdates(_0x3ce5ab){return function(_0x38f58c){try{jsonpatch['apply'](_0x38f58c,_0x3ce5ab,!![]);}catch(_0x48323d){return BPromise[_0x6ff8('0x21')](_0x48323d);}return _0x38f58c[_0x6ff8('0x22')]();};}function saveUpdates(_0x53ffe7,_0x10c0a4){return function(_0xbcd13e){if(_0xbcd13e){return _0xbcd13e[_0x6ff8('0x23')](_0x53ffe7)[_0x6ff8('0x24')](function(_0x359b63){return _0x359b63;});}return null;};}function removeEntity(_0x3dd12f,_0x572e4e){return function(_0x5e366a){if(_0x5e366a){return _0x5e366a[_0x6ff8('0x25')]()['then'](function(){_0x3dd12f[_0x6ff8('0x18')](0xcc)[_0x6ff8('0x19')]();});}};}function handleEntityNotFound(_0x20163c,_0x48c336){return function(_0x31dbd0){if(!_0x31dbd0){_0x20163c[_0x6ff8('0x26')](0x194);}return _0x31dbd0;};}function handleError(_0x168279,_0x10a468){_0x10a468=_0x10a468||0x1f4;return function(_0xea1003){logger['error'](_0xea1003[_0x6ff8('0x27')]);if(_0xea1003[_0x6ff8('0x28')]){delete _0xea1003[_0x6ff8('0x28')];}_0x168279['status'](_0x10a468)[_0x6ff8('0x29')](_0xea1003);};}exports[_0x6ff8('0x2a')]=function(_0x84d93,_0x28fb94){var _0xf8f9c5={},_0xe9163={},_0x3057d8={'count':0x0,'rows':[]};var _0x3fdfdc=_[_0x6ff8('0x2b')](db[_0x6ff8('0x2c')][_0x6ff8('0x2d')],function(_0x19315e){return{'name':_0x19315e['fieldName'],'type':_0x19315e[_0x6ff8('0x2e')][_0x6ff8('0x2f')]};});_0xe9163[_0x6ff8('0x30')]=_[_0x6ff8('0x2b')](_0x3fdfdc,_0x6ff8('0x28'));_0xe9163['query']=_[_0x6ff8('0x31')](_0x84d93[_0x6ff8('0x32')]);_0xe9163[_0x6ff8('0x33')]=_[_0x6ff8('0x34')](_0xe9163['model'],_0xe9163[_0x6ff8('0x32')]);_0xf8f9c5[_0x6ff8('0x35')]=_[_0x6ff8('0x34')](_0xe9163[_0x6ff8('0x30')],qs['fields'](_0x84d93[_0x6ff8('0x32')]['fields']));_0xf8f9c5['attributes']=_0xf8f9c5['attributes'][_0x6ff8('0x36')]?_0xf8f9c5[_0x6ff8('0x35')]:_0xe9163[_0x6ff8('0x30')];if(!_0x84d93[_0x6ff8('0x32')][_0x6ff8('0x37')](_0x6ff8('0x38'))){_0xf8f9c5[_0x6ff8('0x1e')]=qs['limit'](_0x84d93[_0x6ff8('0x32')]['limit']);_0xf8f9c5[_0x6ff8('0x1b')]=qs[_0x6ff8('0x1b')](_0x84d93[_0x6ff8('0x32')]['offset']);}_0xf8f9c5['order']=qs[_0x6ff8('0x39')](_0x84d93[_0x6ff8('0x32')]['sort']);_0xf8f9c5[_0x6ff8('0x3a')]=qs[_0x6ff8('0x33')](_['pick'](_0x84d93[_0x6ff8('0x32')],_0xe9163['filters']),_0x3fdfdc);if(_0x84d93[_0x6ff8('0x32')][_0x6ff8('0x3b')]){_0xf8f9c5[_0x6ff8('0x3a')]=_['merge'](_0xf8f9c5['where'],{'$or':_[_0x6ff8('0x2b')](_0x3fdfdc,function(_0x34541f){if(_0x34541f[_0x6ff8('0x2e')]!==_0x6ff8('0x3c')){var _0x5ac535={};_0x5ac535[_0x34541f[_0x6ff8('0x28')]]={'$like':'%'+_0x84d93[_0x6ff8('0x32')]['filter']+'%'};return _0x5ac535;}})});}_0xf8f9c5=_['merge']({},_0xf8f9c5,_0x84d93[_0x6ff8('0x3d')]);var _0x19144e={'where':_0xf8f9c5[_0x6ff8('0x3a')]};return db[_0x6ff8('0x2c')][_0x6ff8('0x1d')](_0x19144e)['then'](function(_0x3cb535){_0x3057d8[_0x6ff8('0x1d')]=_0x3cb535;if(_0x84d93[_0x6ff8('0x32')][_0x6ff8('0x3e')]){_0xf8f9c5['include']=[{'all':!![]}];}return db[_0x6ff8('0x2c')][_0x6ff8('0x3f')](_0xf8f9c5);})[_0x6ff8('0x24')](function(_0x476390){_0x3057d8[_0x6ff8('0x40')]=_0x476390;return _0x3057d8;})['then'](respondWithFilteredResult(_0x28fb94,_0xf8f9c5))[_0x6ff8('0x41')](handleError(_0x28fb94,null));};exports[_0x6ff8('0x42')]=function(_0x41c8ad,_0x26badd){var _0x57767b={'raw':![],'where':{'id':_0x41c8ad[_0x6ff8('0x43')]['id']}},_0x4f2208={};_0x4f2208[_0x6ff8('0x30')]=_[_0x6ff8('0x31')](db[_0x6ff8('0x2c')][_0x6ff8('0x2d')]);_0x4f2208[_0x6ff8('0x32')]=_[_0x6ff8('0x31')](_0x41c8ad[_0x6ff8('0x32')]);_0x4f2208[_0x6ff8('0x33')]=_[_0x6ff8('0x34')](_0x4f2208[_0x6ff8('0x30')],_0x4f2208[_0x6ff8('0x32')]);_0x57767b[_0x6ff8('0x35')]=_['intersection'](_0x4f2208[_0x6ff8('0x30')],qs[_0x6ff8('0x44')](_0x41c8ad[_0x6ff8('0x32')][_0x6ff8('0x44')]));_0x57767b[_0x6ff8('0x35')]=_0x57767b[_0x6ff8('0x35')][_0x6ff8('0x36')]?_0x57767b[_0x6ff8('0x35')]:_0x4f2208[_0x6ff8('0x30')];if(_0x41c8ad[_0x6ff8('0x32')][_0x6ff8('0x3e')]){_0x57767b[_0x6ff8('0x45')]=[{'all':!![]}];}_0x57767b=_[_0x6ff8('0x46')]({},_0x57767b,_0x41c8ad[_0x6ff8('0x3d')]);return db[_0x6ff8('0x2c')][_0x6ff8('0x47')](_0x57767b)[_0x6ff8('0x24')](handleEntityNotFound(_0x26badd,null))['then'](respondWithResult(_0x26badd,null))[_0x6ff8('0x41')](handleError(_0x26badd,null));};exports[_0x6ff8('0x48')]=function(_0xbf46c4,_0x5be820){return db['ZendeskConfiguration'][_0x6ff8('0x48')](_0xbf46c4[_0x6ff8('0x49')],{})[_0x6ff8('0x24')](respondWithResult(_0x5be820,0xc9))[_0x6ff8('0x41')](handleError(_0x5be820,null));};exports[_0x6ff8('0x23')]=function(_0x6b89be,_0x30969b){if(_0x6b89be[_0x6ff8('0x49')]['id']){delete _0x6b89be['body']['id'];}return db['ZendeskConfiguration'][_0x6ff8('0x47')]({'where':{'id':_0x6b89be[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x30969b,null))[_0x6ff8('0x24')](saveUpdates(_0x6b89be['body'],null))['then'](respondWithResult(_0x30969b,null))['catch'](handleError(_0x30969b,null));};exports['destroy']=function(_0x1dada7,_0x5158c5){return db[_0x6ff8('0x2c')]['find']({'where':{'id':_0x1dada7[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x5158c5,null))['then'](removeEntity(_0x5158c5,null))[_0x6ff8('0x41')](handleError(_0x5158c5,null));};exports['getFields']=function(_0x4980fc,_0x55d229,_0x555347){var _0x13a9af={};var _0x2c3c84={};var _0x5ec69d;var _0x13b9eb;return db[_0x6ff8('0x2c')]['findOne']({'where':{'id':_0x4980fc[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x55d229,null))[_0x6ff8('0x24')](function(_0x534f5c){if(_0x534f5c){_0x5ec69d=_0x534f5c;_0x2c3c84['model']=_[_0x6ff8('0x31')](db[_0x6ff8('0x4a')][_0x6ff8('0x2d')]);_0x2c3c84[_0x6ff8('0x32')]=_['keys'](_0x4980fc['query']);_0x2c3c84[_0x6ff8('0x33')]=_[_0x6ff8('0x34')](_0x2c3c84['model'],_0x2c3c84[_0x6ff8('0x32')]);_0x13a9af[_0x6ff8('0x35')]=_[_0x6ff8('0x34')](_0x2c3c84[_0x6ff8('0x30')],qs[_0x6ff8('0x44')](_0x4980fc[_0x6ff8('0x32')]['fields']));_0x13a9af[_0x6ff8('0x35')]=_0x13a9af['attributes']['length']?_0x13a9af['attributes']:_0x2c3c84['model'];_0x13a9af[_0x6ff8('0x4b')]=qs[_0x6ff8('0x39')](_0x4980fc['query'][_0x6ff8('0x39')]);_0x13a9af[_0x6ff8('0x3a')]=qs[_0x6ff8('0x33')](_[_0x6ff8('0x4c')](_0x4980fc[_0x6ff8('0x32')],_0x2c3c84[_0x6ff8('0x33')]));if(_0x4980fc[_0x6ff8('0x32')]['filter']){_0x13a9af[_0x6ff8('0x3a')]=_['merge'](_0x13a9af['where'],{'$or':_['map'](_0x13a9af[_0x6ff8('0x35')],function(_0x50d735){var _0x3829cd={};_0x3829cd[_0x50d735]={'$like':'%'+_0x4980fc['query']['filter']+'%'};return _0x3829cd;})});}_0x13a9af=_[_0x6ff8('0x46')]({},_0x13a9af,_0x4980fc['options']);return _0x5ec69d[_0x6ff8('0x4d')](_0x13a9af);}})[_0x6ff8('0x24')](function(_0x51ae7c){if(_0x51ae7c){_0x13b9eb=_0x51ae7c['length'];if(!_0x4980fc[_0x6ff8('0x32')][_0x6ff8('0x37')](_0x6ff8('0x38'))){_0x13a9af[_0x6ff8('0x1e')]=qs[_0x6ff8('0x1e')](_0x4980fc[_0x6ff8('0x32')][_0x6ff8('0x1e')]);_0x13a9af[_0x6ff8('0x1b')]=qs['offset'](_0x4980fc['query'][_0x6ff8('0x1b')]);}return _0x5ec69d['getFields'](_0x13a9af);}})['then'](function(_0x39f170){if(_0x39f170){return _0x39f170?{'count':_0x13b9eb,'rows':_0x39f170}:null;}})[_0x6ff8('0x24')](respondWithResult(_0x55d229,null))['catch'](handleError(_0x55d229,null));};exports['getSubjects']=function(_0x2516b3,_0x3db2a8,_0x4679bf){var _0x22fc49={};var _0x12540e={};var _0x14c2f1;var _0x523c84;return db['ZendeskConfiguration'][_0x6ff8('0x4e')]({'where':{'id':_0x2516b3[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x3db2a8,null))[_0x6ff8('0x24')](function(_0x106321){if(_0x106321){_0x14c2f1=_0x106321;_0x12540e[_0x6ff8('0x30')]=_[_0x6ff8('0x31')](db[_0x6ff8('0x4a')][_0x6ff8('0x2d')]);_0x12540e[_0x6ff8('0x32')]=_[_0x6ff8('0x31')](_0x2516b3[_0x6ff8('0x32')]);_0x12540e[_0x6ff8('0x33')]=_[_0x6ff8('0x34')](_0x12540e[_0x6ff8('0x30')],_0x12540e[_0x6ff8('0x32')]);_0x22fc49[_0x6ff8('0x35')]=_['intersection'](_0x12540e[_0x6ff8('0x30')],qs[_0x6ff8('0x44')](_0x2516b3[_0x6ff8('0x32')][_0x6ff8('0x44')]));_0x22fc49['attributes']=_0x22fc49[_0x6ff8('0x35')][_0x6ff8('0x36')]?_0x22fc49['attributes']:_0x12540e[_0x6ff8('0x30')];_0x22fc49[_0x6ff8('0x4b')]=qs[_0x6ff8('0x39')](_0x2516b3['query'][_0x6ff8('0x39')]);_0x22fc49['where']=qs[_0x6ff8('0x33')](_[_0x6ff8('0x4c')](_0x2516b3[_0x6ff8('0x32')],_0x12540e[_0x6ff8('0x33')]));if(_0x2516b3[_0x6ff8('0x32')][_0x6ff8('0x3b')]){_0x22fc49['where']=_[_0x6ff8('0x46')](_0x22fc49[_0x6ff8('0x3a')],{'$or':_['map'](_0x22fc49[_0x6ff8('0x35')],function(_0x40fb02){var _0x581090={};_0x581090[_0x40fb02]={'$like':'%'+_0x2516b3[_0x6ff8('0x32')]['filter']+'%'};return _0x581090;})});}_0x22fc49=_[_0x6ff8('0x46')]({},_0x22fc49,_0x2516b3[_0x6ff8('0x3d')]);return _0x14c2f1[_0x6ff8('0x4f')](_0x22fc49);}})[_0x6ff8('0x24')](function(_0x25c074){if(_0x25c074){_0x523c84=_0x25c074[_0x6ff8('0x36')];if(!_0x2516b3[_0x6ff8('0x32')][_0x6ff8('0x37')](_0x6ff8('0x38'))){_0x22fc49['limit']=qs[_0x6ff8('0x1e')](_0x2516b3[_0x6ff8('0x32')][_0x6ff8('0x1e')]);_0x22fc49[_0x6ff8('0x1b')]=qs[_0x6ff8('0x1b')](_0x2516b3[_0x6ff8('0x32')][_0x6ff8('0x1b')]);}return _0x14c2f1[_0x6ff8('0x4f')](_0x22fc49);}})[_0x6ff8('0x24')](function(_0x42008a){if(_0x42008a){return _0x42008a?{'count':_0x523c84,'rows':_0x42008a}:null;}})[_0x6ff8('0x24')](respondWithResult(_0x3db2a8,null))[_0x6ff8('0x41')](handleError(_0x3db2a8,null));};exports[_0x6ff8('0x50')]=function(_0x3ebf15,_0x21b45b,_0x13dda2){var _0x4677cc={};var _0x5cb687={};var _0x2857b8;var _0x129dc3;return db[_0x6ff8('0x2c')][_0x6ff8('0x4e')]({'where':{'id':_0x3ebf15[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x21b45b,null))['then'](function(_0x4d56f7){if(_0x4d56f7){_0x2857b8=_0x4d56f7;_0x5cb687['model']=_[_0x6ff8('0x31')](db[_0x6ff8('0x4a')]['rawAttributes']);_0x5cb687[_0x6ff8('0x32')]=_['keys'](_0x3ebf15['query']);_0x5cb687[_0x6ff8('0x33')]=_[_0x6ff8('0x34')](_0x5cb687[_0x6ff8('0x30')],_0x5cb687['query']);_0x4677cc[_0x6ff8('0x35')]=_[_0x6ff8('0x34')](_0x5cb687[_0x6ff8('0x30')],qs[_0x6ff8('0x44')](_0x3ebf15[_0x6ff8('0x32')]['fields']));_0x4677cc[_0x6ff8('0x35')]=_0x4677cc[_0x6ff8('0x35')]['length']?_0x4677cc['attributes']:_0x5cb687[_0x6ff8('0x30')];_0x4677cc[_0x6ff8('0x4b')]=qs[_0x6ff8('0x39')](_0x3ebf15['query']['sort']);_0x4677cc[_0x6ff8('0x3a')]=qs[_0x6ff8('0x33')](_[_0x6ff8('0x4c')](_0x3ebf15[_0x6ff8('0x32')],_0x5cb687[_0x6ff8('0x33')]));if(_0x3ebf15[_0x6ff8('0x32')][_0x6ff8('0x3b')]){_0x4677cc[_0x6ff8('0x3a')]=_[_0x6ff8('0x46')](_0x4677cc[_0x6ff8('0x3a')],{'$or':_[_0x6ff8('0x2b')](_0x4677cc[_0x6ff8('0x35')],function(_0x4b47a5){var _0x4549c8={};_0x4549c8[_0x4b47a5]={'$like':'%'+_0x3ebf15[_0x6ff8('0x32')][_0x6ff8('0x3b')]+'%'};return _0x4549c8;})});}_0x4677cc=_['merge']({},_0x4677cc,_0x3ebf15[_0x6ff8('0x3d')]);return _0x2857b8['getDescriptions'](_0x4677cc);}})['then'](function(_0x437ba3){if(_0x437ba3){_0x129dc3=_0x437ba3[_0x6ff8('0x36')];if(!_0x3ebf15[_0x6ff8('0x32')][_0x6ff8('0x37')](_0x6ff8('0x38'))){_0x4677cc[_0x6ff8('0x1e')]=qs[_0x6ff8('0x1e')](_0x3ebf15[_0x6ff8('0x32')]['limit']);_0x4677cc[_0x6ff8('0x1b')]=qs[_0x6ff8('0x1b')](_0x3ebf15[_0x6ff8('0x32')]['offset']);}return _0x2857b8[_0x6ff8('0x50')](_0x4677cc);}})['then'](function(_0x796cc){if(_0x796cc){return _0x796cc?{'count':_0x129dc3,'rows':_0x796cc}:null;}})[_0x6ff8('0x24')](respondWithResult(_0x21b45b,null))['catch'](handleError(_0x21b45b,null));};exports[_0x6ff8('0x51')]=function(_0x457610,_0x14c1e3,_0x1cd55a){var _0x3db244={};var _0x4003a5={};var _0x2c46b5;var _0x3baae6;return db['ZendeskConfiguration'][_0x6ff8('0x4e')]({'where':{'id':_0x457610[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x14c1e3,null))[_0x6ff8('0x24')](function(_0x179000){if(_0x179000){_0x2c46b5=_0x179000;_0x4003a5[_0x6ff8('0x30')]=_['keys'](db[_0x6ff8('0x52')][_0x6ff8('0x2d')]);_0x4003a5[_0x6ff8('0x32')]=_[_0x6ff8('0x31')](_0x457610[_0x6ff8('0x32')]);_0x4003a5[_0x6ff8('0x33')]=_[_0x6ff8('0x34')](_0x4003a5['model'],_0x4003a5['query']);_0x3db244['attributes']=_[_0x6ff8('0x34')](_0x4003a5[_0x6ff8('0x30')],qs[_0x6ff8('0x44')](_0x457610[_0x6ff8('0x32')][_0x6ff8('0x44')]));_0x3db244[_0x6ff8('0x35')]=_0x3db244[_0x6ff8('0x35')]['length']?_0x3db244[_0x6ff8('0x35')]:_0x4003a5[_0x6ff8('0x30')];_0x3db244['order']=qs['sort'](_0x457610['query'][_0x6ff8('0x39')]);_0x3db244[_0x6ff8('0x3a')]=qs[_0x6ff8('0x33')](_[_0x6ff8('0x4c')](_0x457610[_0x6ff8('0x32')],_0x4003a5['filters']));if(_0x457610['query'][_0x6ff8('0x3b')]){_0x3db244[_0x6ff8('0x3a')]=_[_0x6ff8('0x46')](_0x3db244['where'],{'$or':_[_0x6ff8('0x2b')](_0x3db244[_0x6ff8('0x35')],function(_0x3e568f){var _0x30f6b1={};_0x30f6b1[_0x3e568f]={'$like':'%'+_0x457610[_0x6ff8('0x32')][_0x6ff8('0x3b')]+'%'};return _0x30f6b1;})});}_0x3db244=_['merge']({},_0x3db244,_0x457610[_0x6ff8('0x3d')]);return _0x2c46b5[_0x6ff8('0x51')](_0x3db244);}})[_0x6ff8('0x24')](function(_0x2ec373){if(_0x2ec373){_0x3baae6=_0x2ec373['length'];if(!_0x457610['query'][_0x6ff8('0x37')](_0x6ff8('0x38'))){_0x3db244[_0x6ff8('0x1e')]=qs[_0x6ff8('0x1e')](_0x457610[_0x6ff8('0x32')][_0x6ff8('0x1e')]);_0x3db244[_0x6ff8('0x1b')]=qs[_0x6ff8('0x1b')](_0x457610[_0x6ff8('0x32')][_0x6ff8('0x1b')]);}return _0x2c46b5['getTags'](_0x3db244);}})[_0x6ff8('0x24')](function(_0x406a6f){if(_0x406a6f){return _0x406a6f?{'count':_0x3baae6,'rows':_0x406a6f}:null;}})['then'](respondWithResult(_0x14c1e3,null))[_0x6ff8('0x41')](handleError(_0x14c1e3,null));};exports[_0x6ff8('0x53')]=function(_0x4f32e3,_0x3ca94d,_0x1e5b10){if(_0x4f32e3[_0x6ff8('0x49')]['id']){delete _0x4f32e3[_0x6ff8('0x49')]['id'];}return db[_0x6ff8('0x2c')][_0x6ff8('0x4e')]({'where':{'id':_0x4f32e3[_0x6ff8('0x43')]['id']}})[_0x6ff8('0x24')](handleEntityNotFound(_0x3ca94d,null))[_0x6ff8('0x24')](function(_0x5a596f){if(_0x5a596f){return _0x5a596f[_0x6ff8('0x53')](_0x4f32e3[_0x6ff8('0x49')]['ids']||[]);}return null;})[_0x6ff8('0x24')](respondWithResult(_0x3ca94d,null))['catch'](handleError(_0x3ca94d,null));};
\ No newline at end of file