Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / api / intZendeskConfiguration / intZendeskConfiguration.controller.js
index 2510380..d833ac7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x50fb=['type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','length','includeAll','options','find','create','body','params','ZendeskField','getFields','nolimit','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName'];(function(_0x4f766a,_0x89cf4f){var _0x35dd21=function(_0x59d95b){while(--_0x59d95b){_0x4f766a['push'](_0x4f766a['shift']());}};_0x35dd21(++_0x89cf4f);}(_0x50fb,0x78));var _0xb50f=function(_0x3d9ad5,_0x2f2153){_0x3d9ad5=_0x3d9ad5-0x0;var _0x3577b7=_0x50fb[_0x3d9ad5];return _0x3577b7;};'use strict';var emlformat=require(_0xb50f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb50f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb50f('0x2'));var moment=require(_0xb50f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb50f('0x4'));var util=require(_0xb50f('0x5'));var path=require(_0xb50f('0x6'));var sox=require('sox');var csv=require(_0xb50f('0x7'));var ejs=require(_0xb50f('0x8'));var fs=require('fs');var fs_extra=require(_0xb50f('0x9'));var _=require(_0xb50f('0xa'));var squel=require(_0xb50f('0xb'));var crypto=require('crypto');var jsforce=require(_0xb50f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb50f('0x7'));var querystring=require(_0xb50f('0xd'));var Papa=require(_0xb50f('0xe'));var Redis=require(_0xb50f('0xf'));var authService=require(_0xb50f('0x10'));var qs=require(_0xb50f('0x11'));var as=require(_0xb50f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb50f('0x13'))(_0xb50f('0x14'));var utils=require('../../config/utils');var config=require(_0xb50f('0x15'));var licenseUtil=require(_0xb50f('0x16'));var db=require(_0xb50f('0x17'))['db'];function respondWithStatusCode(_0x1e6c15,_0x8629c4){_0x8629c4=_0x8629c4||0xcc;return function(_0x4913c0){if(_0x4913c0){return _0x1e6c15['sendStatus'](_0x8629c4);}return _0x1e6c15[_0xb50f('0x18')](_0x8629c4)[_0xb50f('0x19')]();};}function respondWithResult(_0x4e9381,_0x3210a5){_0x3210a5=_0x3210a5||0xc8;return function(_0x1139f9){if(_0x1139f9){return _0x4e9381[_0xb50f('0x18')](_0x3210a5)[_0xb50f('0x1a')](_0x1139f9);}};}function respondWithFilteredResult(_0x4667d4,_0x4423df){return function(_0x3f7756){if(_0x3f7756){var _0x48398a=typeof _0x4423df[_0xb50f('0x1b')]===_0xb50f('0x1c')&&typeof _0x4423df['limit']===_0xb50f('0x1c');var _0x25c42b=_0x3f7756['count'];var _0x47ca41=_0x48398a?0x0:_0x4423df[_0xb50f('0x1b')];var _0x3d2292=_0x48398a?_0x3f7756[_0xb50f('0x1d')]:_0x4423df[_0xb50f('0x1b')]+_0x4423df[_0xb50f('0x1e')];var _0x423c89;if(_0x3d2292>=_0x25c42b){_0x3d2292=_0x25c42b;_0x423c89=0xc8;}else{_0x423c89=0xce;}_0x4667d4[_0xb50f('0x18')](_0x423c89);return _0x4667d4['set']('Content-Range',_0x47ca41+'-'+_0x3d2292+'/'+_0x25c42b)['json'](_0x3f7756);}return null;};}function patchUpdates(_0x1fc26b){return function(_0x57e131){try{jsonpatch[_0xb50f('0x1f')](_0x57e131,_0x1fc26b,!![]);}catch(_0x2017c9){return BPromise['reject'](_0x2017c9);}return _0x57e131[_0xb50f('0x20')]();};}function saveUpdates(_0x40feb7,_0x4d413e){return function(_0xdff06f){if(_0xdff06f){return _0xdff06f[_0xb50f('0x21')](_0x40feb7)[_0xb50f('0x22')](function(_0x2a6070){return _0x2a6070;});}return null;};}function removeEntity(_0x4f00dc,_0x592c36){return function(_0x59a452){if(_0x59a452){return _0x59a452[_0xb50f('0x23')]()[_0xb50f('0x22')](function(){_0x4f00dc[_0xb50f('0x18')](0xcc)[_0xb50f('0x19')]();});}};}function handleEntityNotFound(_0x1a3fcd,_0xe1bd3f){return function(_0x5024b1){if(!_0x5024b1){_0x1a3fcd[_0xb50f('0x24')](0x194);}return _0x5024b1;};}function handleError(_0x18be53,_0x280ece){_0x280ece=_0x280ece||0x1f4;return function(_0x1a89cd){logger[_0xb50f('0x25')](_0x1a89cd[_0xb50f('0x26')]);if(_0x1a89cd[_0xb50f('0x27')]){delete _0x1a89cd[_0xb50f('0x27')];}_0x18be53['status'](_0x280ece)[_0xb50f('0x28')](_0x1a89cd);};}exports[_0xb50f('0x29')]=function(_0x268345,_0x1485ac){var _0x44995d={},_0x29c902={},_0x2ea350={'count':0x0,'rows':[]};var _0xda3230=_[_0xb50f('0x2a')](db[_0xb50f('0x2b')][_0xb50f('0x2c')],function(_0x1082ae){return{'name':_0x1082ae[_0xb50f('0x2d')],'type':_0x1082ae[_0xb50f('0x2e')][_0xb50f('0x2f')]};});_0x29c902[_0xb50f('0x30')]=_[_0xb50f('0x2a')](_0xda3230,_0xb50f('0x27'));_0x29c902[_0xb50f('0x31')]=_[_0xb50f('0x32')](_0x268345[_0xb50f('0x31')]);_0x29c902['filters']=_[_0xb50f('0x33')](_0x29c902['model'],_0x29c902[_0xb50f('0x31')]);_0x44995d[_0xb50f('0x34')]=_[_0xb50f('0x33')](_0x29c902['model'],qs[_0xb50f('0x35')](_0x268345['query'][_0xb50f('0x35')]));_0x44995d[_0xb50f('0x34')]=_0x44995d[_0xb50f('0x34')]['length']?_0x44995d[_0xb50f('0x34')]:_0x29c902['model'];if(!_0x268345[_0xb50f('0x31')][_0xb50f('0x36')]('nolimit')){_0x44995d[_0xb50f('0x1e')]=qs['limit'](_0x268345[_0xb50f('0x31')][_0xb50f('0x1e')]);_0x44995d[_0xb50f('0x1b')]=qs['offset'](_0x268345[_0xb50f('0x31')][_0xb50f('0x1b')]);}_0x44995d[_0xb50f('0x37')]=qs['sort'](_0x268345[_0xb50f('0x31')][_0xb50f('0x38')]);_0x44995d[_0xb50f('0x39')]=qs[_0xb50f('0x3a')](_[_0xb50f('0x3b')](_0x268345[_0xb50f('0x31')],_0x29c902[_0xb50f('0x3a')]),_0xda3230);if(_0x268345[_0xb50f('0x31')][_0xb50f('0x3c')]){_0x44995d[_0xb50f('0x39')]=_['merge'](_0x44995d[_0xb50f('0x39')],{'$or':_[_0xb50f('0x2a')](_0xda3230,function(_0x29f5f5){if(_0x29f5f5[_0xb50f('0x2e')]!==_0xb50f('0x3d')){var _0x37bf5f={};_0x37bf5f[_0x29f5f5['name']]={'$like':'%'+_0x268345[_0xb50f('0x31')][_0xb50f('0x3c')]+'%'};return _0x37bf5f;}})});}_0x44995d=_[_0xb50f('0x3e')]({},_0x44995d,_0x268345['options']);var _0xd16f02={'where':_0x44995d[_0xb50f('0x39')]};return db[_0xb50f('0x2b')][_0xb50f('0x1d')](_0xd16f02)[_0xb50f('0x22')](function(_0x168daf){_0x2ea350[_0xb50f('0x1d')]=_0x168daf;if(_0x268345[_0xb50f('0x31')]['includeAll']){_0x44995d[_0xb50f('0x3f')]=[{'all':!![]}];}return db[_0xb50f('0x2b')][_0xb50f('0x40')](_0x44995d);})[_0xb50f('0x22')](function(_0x35835c){_0x2ea350[_0xb50f('0x41')]=_0x35835c;return _0x2ea350;})[_0xb50f('0x22')](respondWithFilteredResult(_0x1485ac,_0x44995d))[_0xb50f('0x42')](handleError(_0x1485ac,null));};exports['show']=function(_0x45671a,_0x38ed22){var _0x4ece87={'raw':![],'where':{'id':_0x45671a['params']['id']}},_0x3ae4ba={};_0x3ae4ba['model']=_[_0xb50f('0x32')](db[_0xb50f('0x2b')][_0xb50f('0x2c')]);_0x3ae4ba['query']=_[_0xb50f('0x32')](_0x45671a[_0xb50f('0x31')]);_0x3ae4ba[_0xb50f('0x3a')]=_[_0xb50f('0x33')](_0x3ae4ba[_0xb50f('0x30')],_0x3ae4ba[_0xb50f('0x31')]);_0x4ece87[_0xb50f('0x34')]=_['intersection'](_0x3ae4ba[_0xb50f('0x30')],qs[_0xb50f('0x35')](_0x45671a[_0xb50f('0x31')][_0xb50f('0x35')]));_0x4ece87[_0xb50f('0x34')]=_0x4ece87[_0xb50f('0x34')][_0xb50f('0x43')]?_0x4ece87[_0xb50f('0x34')]:_0x3ae4ba['model'];if(_0x45671a[_0xb50f('0x31')][_0xb50f('0x44')]){_0x4ece87['include']=[{'all':!![]}];}_0x4ece87=_[_0xb50f('0x3e')]({},_0x4ece87,_0x45671a[_0xb50f('0x45')]);return db[_0xb50f('0x2b')][_0xb50f('0x46')](_0x4ece87)[_0xb50f('0x22')](handleEntityNotFound(_0x38ed22,null))[_0xb50f('0x22')](respondWithResult(_0x38ed22,null))[_0xb50f('0x42')](handleError(_0x38ed22,null));};exports[_0xb50f('0x47')]=function(_0x407f60,_0x19ecff){return db[_0xb50f('0x2b')]['create'](_0x407f60['body'],{})[_0xb50f('0x22')](respondWithResult(_0x19ecff,0xc9))[_0xb50f('0x42')](handleError(_0x19ecff,null));};exports[_0xb50f('0x21')]=function(_0x1e8c9a,_0x4e6e73){if(_0x1e8c9a[_0xb50f('0x48')]['id']){delete _0x1e8c9a[_0xb50f('0x48')]['id'];}return db[_0xb50f('0x2b')][_0xb50f('0x46')]({'where':{'id':_0x1e8c9a[_0xb50f('0x49')]['id']}})[_0xb50f('0x22')](handleEntityNotFound(_0x4e6e73,null))['then'](saveUpdates(_0x1e8c9a[_0xb50f('0x48')],null))[_0xb50f('0x22')](respondWithResult(_0x4e6e73,null))[_0xb50f('0x42')](handleError(_0x4e6e73,null));};exports[_0xb50f('0x23')]=function(_0x34126b,_0x33d355){return db[_0xb50f('0x2b')][_0xb50f('0x46')]({'where':{'id':_0x34126b[_0xb50f('0x49')]['id']}})[_0xb50f('0x22')](handleEntityNotFound(_0x33d355,null))['then'](removeEntity(_0x33d355,null))[_0xb50f('0x42')](handleError(_0x33d355,null));};exports['getFields']=function(_0x58c01b,_0x2f12e9,_0x9956b6){var _0x3b9ae4={};var _0x5e0222={};var _0x2dc621;var _0x4685b7;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x58c01b[_0xb50f('0x49')]['id']}})[_0xb50f('0x22')](handleEntityNotFound(_0x2f12e9,null))[_0xb50f('0x22')](function(_0x3a05cd){if(_0x3a05cd){_0x2dc621=_0x3a05cd;_0x5e0222['model']=_['keys'](db[_0xb50f('0x4a')][_0xb50f('0x2c')]);_0x5e0222['query']=_[_0xb50f('0x32')](_0x58c01b[_0xb50f('0x31')]);_0x5e0222[_0xb50f('0x3a')]=_[_0xb50f('0x33')](_0x5e0222[_0xb50f('0x30')],_0x5e0222[_0xb50f('0x31')]);_0x3b9ae4[_0xb50f('0x34')]=_[_0xb50f('0x33')](_0x5e0222[_0xb50f('0x30')],qs[_0xb50f('0x35')](_0x58c01b['query'][_0xb50f('0x35')]));_0x3b9ae4[_0xb50f('0x34')]=_0x3b9ae4[_0xb50f('0x34')][_0xb50f('0x43')]?_0x3b9ae4[_0xb50f('0x34')]:_0x5e0222[_0xb50f('0x30')];_0x3b9ae4[_0xb50f('0x37')]=qs[_0xb50f('0x38')](_0x58c01b[_0xb50f('0x31')][_0xb50f('0x38')]);_0x3b9ae4[_0xb50f('0x39')]=qs[_0xb50f('0x3a')](_[_0xb50f('0x3b')](_0x58c01b[_0xb50f('0x31')],_0x5e0222['filters']));if(_0x58c01b[_0xb50f('0x31')][_0xb50f('0x3c')]){_0x3b9ae4[_0xb50f('0x39')]=_[_0xb50f('0x3e')](_0x3b9ae4[_0xb50f('0x39')],{'$or':_[_0xb50f('0x2a')](_0x3b9ae4[_0xb50f('0x34')],function(_0x112786){var _0x40e8d1={};_0x40e8d1[_0x112786]={'$like':'%'+_0x58c01b[_0xb50f('0x31')][_0xb50f('0x3c')]+'%'};return _0x40e8d1;})});}_0x3b9ae4=_['merge']({},_0x3b9ae4,_0x58c01b[_0xb50f('0x45')]);return _0x2dc621[_0xb50f('0x4b')](_0x3b9ae4);}})['then'](function(_0x28ba06){if(_0x28ba06){_0x4685b7=_0x28ba06['length'];if(!_0x58c01b['query'][_0xb50f('0x36')](_0xb50f('0x4c'))){_0x3b9ae4[_0xb50f('0x1e')]=qs[_0xb50f('0x1e')](_0x58c01b[_0xb50f('0x31')][_0xb50f('0x1e')]);_0x3b9ae4['offset']=qs['offset'](_0x58c01b[_0xb50f('0x31')][_0xb50f('0x1b')]);}return _0x2dc621[_0xb50f('0x4b')](_0x3b9ae4);}})[_0xb50f('0x22')](function(_0x352ff4){if(_0x352ff4){return _0x352ff4?{'count':_0x4685b7,'rows':_0x352ff4}:null;}})[_0xb50f('0x22')](respondWithResult(_0x2f12e9,null))[_0xb50f('0x42')](handleError(_0x2f12e9,null));};exports[_0xb50f('0x4d')]=function(_0x33d8de,_0x4f8988,_0x3d982b){var _0x42c547={};var _0x359011={};var _0x1c1043;var _0x5667ca;return db[_0xb50f('0x2b')][_0xb50f('0x4e')]({'where':{'id':_0x33d8de[_0xb50f('0x49')]['id']}})[_0xb50f('0x22')](handleEntityNotFound(_0x4f8988,null))[_0xb50f('0x22')](function(_0x4da5b9){if(_0x4da5b9){_0x1c1043=_0x4da5b9;_0x359011[_0xb50f('0x30')]=_[_0xb50f('0x32')](db[_0xb50f('0x4a')][_0xb50f('0x2c')]);_0x359011[_0xb50f('0x31')]=_[_0xb50f('0x32')](_0x33d8de[_0xb50f('0x31')]);_0x359011[_0xb50f('0x3a')]=_[_0xb50f('0x33')](_0x359011['model'],_0x359011[_0xb50f('0x31')]);_0x42c547['attributes']=_[_0xb50f('0x33')](_0x359011[_0xb50f('0x30')],qs[_0xb50f('0x35')](_0x33d8de[_0xb50f('0x31')][_0xb50f('0x35')]));_0x42c547[_0xb50f('0x34')]=_0x42c547[_0xb50f('0x34')][_0xb50f('0x43')]?_0x42c547[_0xb50f('0x34')]:_0x359011[_0xb50f('0x30')];_0x42c547['order']=qs[_0xb50f('0x38')](_0x33d8de[_0xb50f('0x31')][_0xb50f('0x38')]);_0x42c547[_0xb50f('0x39')]=qs[_0xb50f('0x3a')](_[_0xb50f('0x3b')](_0x33d8de[_0xb50f('0x31')],_0x359011[_0xb50f('0x3a')]));if(_0x33d8de[_0xb50f('0x31')][_0xb50f('0x3c')]){_0x42c547['where']=_[_0xb50f('0x3e')](_0x42c547[_0xb50f('0x39')],{'$or':_['map'](_0x42c547[_0xb50f('0x34')],function(_0x4a7f3a){var _0x2aec63={};_0x2aec63[_0x4a7f3a]={'$like':'%'+_0x33d8de['query'][_0xb50f('0x3c')]+'%'};return _0x2aec63;})});}_0x42c547=_[_0xb50f('0x3e')]({},_0x42c547,_0x33d8de[_0xb50f('0x45')]);return _0x1c1043[_0xb50f('0x4d')](_0x42c547);}})[_0xb50f('0x22')](function(_0x17d122){if(_0x17d122){_0x5667ca=_0x17d122['length'];if(!_0x33d8de['query'][_0xb50f('0x36')]('nolimit')){_0x42c547[_0xb50f('0x1e')]=qs[_0xb50f('0x1e')](_0x33d8de[_0xb50f('0x31')][_0xb50f('0x1e')]);_0x42c547[_0xb50f('0x1b')]=qs[_0xb50f('0x1b')](_0x33d8de[_0xb50f('0x31')][_0xb50f('0x1b')]);}return _0x1c1043[_0xb50f('0x4d')](_0x42c547);}})['then'](function(_0x4c8645){if(_0x4c8645){return _0x4c8645?{'count':_0x5667ca,'rows':_0x4c8645}:null;}})['then'](respondWithResult(_0x4f8988,null))[_0xb50f('0x42')](handleError(_0x4f8988,null));};exports['getDescriptions']=function(_0x2baeab,_0x17e704,_0x11f03c){var _0x5b6ed8={};var _0x3a8e86={};var _0x1af481;var _0x4c2bd1;return db['ZendeskConfiguration'][_0xb50f('0x4e')]({'where':{'id':_0x2baeab[_0xb50f('0x49')]['id']}})[_0xb50f('0x22')](handleEntityNotFound(_0x17e704,null))[_0xb50f('0x22')](function(_0x45e780){if(_0x45e780){_0x1af481=_0x45e780;_0x3a8e86['model']=_['keys'](db['ZendeskField']['rawAttributes']);_0x3a8e86['query']=_[_0xb50f('0x32')](_0x2baeab[_0xb50f('0x31')]);_0x3a8e86[_0xb50f('0x3a')]=_[_0xb50f('0x33')](_0x3a8e86[_0xb50f('0x30')],_0x3a8e86[_0xb50f('0x31')]);_0x5b6ed8[_0xb50f('0x34')]=_[_0xb50f('0x33')](_0x3a8e86[_0xb50f('0x30')],qs['fields'](_0x2baeab[_0xb50f('0x31')]['fields']));_0x5b6ed8['attributes']=_0x5b6ed8[_0xb50f('0x34')][_0xb50f('0x43')]?_0x5b6ed8[_0xb50f('0x34')]:_0x3a8e86['model'];_0x5b6ed8[_0xb50f('0x37')]=qs[_0xb50f('0x38')](_0x2baeab[_0xb50f('0x31')]['sort']);_0x5b6ed8['where']=qs[_0xb50f('0x3a')](_['pick'](_0x2baeab[_0xb50f('0x31')],_0x3a8e86[_0xb50f('0x3a')]));if(_0x2baeab[_0xb50f('0x31')]['filter']){_0x5b6ed8['where']=_[_0xb50f('0x3e')](_0x5b6ed8[_0xb50f('0x39')],{'$or':_[_0xb50f('0x2a')](_0x5b6ed8[_0xb50f('0x34')],function(_0x2958c0){var _0x4c2277={};_0x4c2277[_0x2958c0]={'$like':'%'+_0x2baeab[_0xb50f('0x31')]['filter']+'%'};return _0x4c2277;})});}_0x5b6ed8=_[_0xb50f('0x3e')]({},_0x5b6ed8,_0x2baeab['options']);return _0x1af481[_0xb50f('0x4f')](_0x5b6ed8);}})[_0xb50f('0x22')](function(_0x46908a){if(_0x46908a){_0x4c2bd1=_0x46908a['length'];if(!_0x2baeab[_0xb50f('0x31')][_0xb50f('0x36')]('nolimit')){_0x5b6ed8[_0xb50f('0x1e')]=qs[_0xb50f('0x1e')](_0x2baeab[_0xb50f('0x31')][_0xb50f('0x1e')]);_0x5b6ed8[_0xb50f('0x1b')]=qs[_0xb50f('0x1b')](_0x2baeab[_0xb50f('0x31')][_0xb50f('0x1b')]);}return _0x1af481[_0xb50f('0x4f')](_0x5b6ed8);}})[_0xb50f('0x22')](function(_0x25f34){if(_0x25f34){return _0x25f34?{'count':_0x4c2bd1,'rows':_0x25f34}:null;}})[_0xb50f('0x22')](respondWithResult(_0x17e704,null))[_0xb50f('0x42')](handleError(_0x17e704,null));};exports[_0xb50f('0x50')]=function(_0x1b6db5,_0x33195a,_0x29883b){var _0x1c894e={};var _0x57fc58={};var _0x5cdbe2;var _0x252ccc;return db[_0xb50f('0x2b')][_0xb50f('0x4e')]({'where':{'id':_0x1b6db5[_0xb50f('0x49')]['id']}})[_0xb50f('0x22')](handleEntityNotFound(_0x33195a,null))[_0xb50f('0x22')](function(_0x52541c){if(_0x52541c){_0x5cdbe2=_0x52541c;_0x57fc58[_0xb50f('0x30')]=_[_0xb50f('0x32')](db[_0xb50f('0x51')]['rawAttributes']);_0x57fc58[_0xb50f('0x31')]=_[_0xb50f('0x32')](_0x1b6db5['query']);_0x57fc58[_0xb50f('0x3a')]=_[_0xb50f('0x33')](_0x57fc58[_0xb50f('0x30')],_0x57fc58[_0xb50f('0x31')]);_0x1c894e[_0xb50f('0x34')]=_['intersection'](_0x57fc58[_0xb50f('0x30')],qs['fields'](_0x1b6db5[_0xb50f('0x31')]['fields']));_0x1c894e['attributes']=_0x1c894e[_0xb50f('0x34')][_0xb50f('0x43')]?_0x1c894e['attributes']:_0x57fc58[_0xb50f('0x30')];_0x1c894e[_0xb50f('0x37')]=qs[_0xb50f('0x38')](_0x1b6db5[_0xb50f('0x31')]['sort']);_0x1c894e[_0xb50f('0x39')]=qs[_0xb50f('0x3a')](_[_0xb50f('0x3b')](_0x1b6db5[_0xb50f('0x31')],_0x57fc58[_0xb50f('0x3a')]));if(_0x1b6db5[_0xb50f('0x31')][_0xb50f('0x3c')]){_0x1c894e[_0xb50f('0x39')]=_[_0xb50f('0x3e')](_0x1c894e[_0xb50f('0x39')],{'$or':_[_0xb50f('0x2a')](_0x1c894e[_0xb50f('0x34')],function(_0x102667){var _0x1c4117={};_0x1c4117[_0x102667]={'$like':'%'+_0x1b6db5['query'][_0xb50f('0x3c')]+'%'};return _0x1c4117;})});}_0x1c894e=_['merge']({},_0x1c894e,_0x1b6db5[_0xb50f('0x45')]);return _0x5cdbe2[_0xb50f('0x50')](_0x1c894e);}})[_0xb50f('0x22')](function(_0x407966){if(_0x407966){_0x252ccc=_0x407966[_0xb50f('0x43')];if(!_0x1b6db5[_0xb50f('0x31')][_0xb50f('0x36')](_0xb50f('0x4c'))){_0x1c894e[_0xb50f('0x1e')]=qs['limit'](_0x1b6db5['query'][_0xb50f('0x1e')]);_0x1c894e[_0xb50f('0x1b')]=qs[_0xb50f('0x1b')](_0x1b6db5[_0xb50f('0x31')][_0xb50f('0x1b')]);}return _0x5cdbe2[_0xb50f('0x50')](_0x1c894e);}})[_0xb50f('0x22')](function(_0xc12114){if(_0xc12114){return _0xc12114?{'count':_0x252ccc,'rows':_0xc12114}:null;}})[_0xb50f('0x22')](respondWithResult(_0x33195a,null))[_0xb50f('0x42')](handleError(_0x33195a,null));};exports[_0xb50f('0x52')]=function(_0x593cc0,_0x19203e,_0x2e8b5a){if(_0x593cc0['body']['id']){delete _0x593cc0[_0xb50f('0x48')]['id'];}return db['ZendeskConfiguration'][_0xb50f('0x4e')]({'where':{'id':_0x593cc0[_0xb50f('0x49')]['id']}})['then'](handleEntityNotFound(_0x19203e,null))['then'](function(_0x22bc43){if(_0x22bc43){return _0x22bc43[_0xb50f('0x52')](_0x593cc0[_0xb50f('0x48')]['ids']||[]);}return null;})[_0xb50f('0x22')](respondWithResult(_0x19203e,null))[_0xb50f('0x42')](handleError(_0x19203e,null));};
\ No newline at end of file
+var _0x08a9=['body','update','find','getFields','ZendeskField','order','getSubjects','getDescriptions','findOne','pick','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','then','destroy','sendStatus','stack','name','index','ZendeskConfiguration','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','type','VIRTUAL','options','includeAll','include','rows','show','params','merge','catch','create'];(function(_0x39ff8b,_0x34145){var _0x252988=function(_0x1d2c4c){while(--_0x1d2c4c){_0x39ff8b['push'](_0x39ff8b['shift']());}};_0x252988(++_0x34145);}(_0x08a9,0x10c));var _0x908a=function(_0xf105c1,_0x30dd5e){_0xf105c1=_0xf105c1-0x0;var _0x450364=_0x08a9[_0xf105c1];return _0x450364;};'use strict';var emlformat=require(_0x908a('0x0'));var rimraf=require(_0x908a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x908a('0x2'));var rp=require(_0x908a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x908a('0x4'));var util=require(_0x908a('0x5'));var path=require(_0x908a('0x6'));var sox=require('sox');var csv=require(_0x908a('0x7'));var ejs=require(_0x908a('0x8'));var fs=require('fs');var fs_extra=require(_0x908a('0x9'));var _=require(_0x908a('0xa'));var squel=require(_0x908a('0xb'));var crypto=require(_0x908a('0xc'));var jsforce=require(_0x908a('0xd'));var deskjs=require(_0x908a('0xe'));var toCsv=require(_0x908a('0x7'));var querystring=require(_0x908a('0xf'));var Papa=require(_0x908a('0x10'));var Redis=require(_0x908a('0x11'));var authService=require(_0x908a('0x12'));var qs=require(_0x908a('0x13'));var as=require(_0x908a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x908a('0x15'))(_0x908a('0x16'));var utils=require(_0x908a('0x17'));var config=require(_0x908a('0x18'));var licenseUtil=require(_0x908a('0x19'));var db=require(_0x908a('0x1a'))['db'];function respondWithStatusCode(_0x54a0f6,_0x35e2c5){_0x35e2c5=_0x35e2c5||0xcc;return function(_0x1d4cd9){if(_0x1d4cd9){return _0x54a0f6['sendStatus'](_0x35e2c5);}return _0x54a0f6[_0x908a('0x1b')](_0x35e2c5)[_0x908a('0x1c')]();};}function respondWithResult(_0x3c47d0,_0x2fbc3f){_0x2fbc3f=_0x2fbc3f||0xc8;return function(_0x8b977c){if(_0x8b977c){return _0x3c47d0[_0x908a('0x1b')](_0x2fbc3f)[_0x908a('0x1d')](_0x8b977c);}};}function respondWithFilteredResult(_0x1e6493,_0x3f9c91){return function(_0x4bd966){if(_0x4bd966){var _0x500721=typeof _0x3f9c91[_0x908a('0x1e')]===_0x908a('0x1f')&&typeof _0x3f9c91['limit']==='undefined';var _0x46dd75=_0x4bd966[_0x908a('0x20')];var _0x3dafa2=_0x500721?0x0:_0x3f9c91[_0x908a('0x1e')];var _0x41b27a=_0x500721?_0x4bd966[_0x908a('0x20')]:_0x3f9c91[_0x908a('0x1e')]+_0x3f9c91[_0x908a('0x21')];var _0x9bd9f2;if(_0x41b27a>=_0x46dd75){_0x41b27a=_0x46dd75;_0x9bd9f2=0xc8;}else{_0x9bd9f2=0xce;}_0x1e6493[_0x908a('0x1b')](_0x9bd9f2);return _0x1e6493[_0x908a('0x22')]('Content-Range',_0x3dafa2+'-'+_0x41b27a+'/'+_0x46dd75)[_0x908a('0x1d')](_0x4bd966);}return null;};}function patchUpdates(_0x1dcc97){return function(_0x59e935){try{jsonpatch[_0x908a('0x23')](_0x59e935,_0x1dcc97,!![]);}catch(_0x52adf3){return BPromise['reject'](_0x52adf3);}return _0x59e935[_0x908a('0x24')]();};}function saveUpdates(_0x4bca32,_0x649106){return function(_0x5d3d9d){if(_0x5d3d9d){return _0x5d3d9d['update'](_0x4bca32)[_0x908a('0x25')](function(_0x2d5d51){return _0x2d5d51;});}return null;};}function removeEntity(_0x1624e9,_0x504c0d){return function(_0x130a13){if(_0x130a13){return _0x130a13[_0x908a('0x26')]()[_0x908a('0x25')](function(){_0x1624e9[_0x908a('0x1b')](0xcc)[_0x908a('0x1c')]();});}};}function handleEntityNotFound(_0x2cf9c7,_0x3ffd77){return function(_0x1004e5){if(!_0x1004e5){_0x2cf9c7[_0x908a('0x27')](0x194);}return _0x1004e5;};}function handleError(_0x896b6,_0x1fa587){_0x1fa587=_0x1fa587||0x1f4;return function(_0x2b5af0){logger['error'](_0x2b5af0[_0x908a('0x28')]);if(_0x2b5af0[_0x908a('0x29')]){delete _0x2b5af0[_0x908a('0x29')];}_0x896b6['status'](_0x1fa587)['send'](_0x2b5af0);};}exports[_0x908a('0x2a')]=function(_0xc64033,_0x36a544){var _0x455af3={},_0x27d37c={},_0x11043e={'count':0x0,'rows':[]};var _0x2c5518=_['map'](db[_0x908a('0x2b')][_0x908a('0x2c')],function(_0x43521c){return{'name':_0x43521c[_0x908a('0x2d')],'type':_0x43521c['type'][_0x908a('0x2e')]};});_0x27d37c[_0x908a('0x2f')]=_[_0x908a('0x30')](_0x2c5518,_0x908a('0x29'));_0x27d37c['query']=_[_0x908a('0x31')](_0xc64033[_0x908a('0x32')]);_0x27d37c[_0x908a('0x33')]=_[_0x908a('0x34')](_0x27d37c[_0x908a('0x2f')],_0x27d37c['query']);_0x455af3[_0x908a('0x35')]=_[_0x908a('0x34')](_0x27d37c[_0x908a('0x2f')],qs[_0x908a('0x36')](_0xc64033[_0x908a('0x32')][_0x908a('0x36')]));_0x455af3[_0x908a('0x35')]=_0x455af3[_0x908a('0x35')][_0x908a('0x37')]?_0x455af3['attributes']:_0x27d37c[_0x908a('0x2f')];if(!_0xc64033[_0x908a('0x32')][_0x908a('0x38')](_0x908a('0x39'))){_0x455af3[_0x908a('0x21')]=qs['limit'](_0xc64033['query']['limit']);_0x455af3[_0x908a('0x1e')]=qs['offset'](_0xc64033[_0x908a('0x32')]['offset']);}_0x455af3['order']=qs[_0x908a('0x3a')](_0xc64033['query'][_0x908a('0x3a')]);_0x455af3['where']=qs['filters'](_['pick'](_0xc64033['query'],_0x27d37c[_0x908a('0x33')]),_0x2c5518);if(_0xc64033['query'][_0x908a('0x3b')]){_0x455af3[_0x908a('0x3c')]=_['merge'](_0x455af3[_0x908a('0x3c')],{'$or':_[_0x908a('0x30')](_0x2c5518,function(_0x3cf855){if(_0x3cf855[_0x908a('0x3d')]!==_0x908a('0x3e')){var _0x171d97={};_0x171d97[_0x3cf855['name']]={'$like':'%'+_0xc64033[_0x908a('0x32')][_0x908a('0x3b')]+'%'};return _0x171d97;}})});}_0x455af3=_['merge']({},_0x455af3,_0xc64033[_0x908a('0x3f')]);var _0x2f325b={'where':_0x455af3[_0x908a('0x3c')]};return db[_0x908a('0x2b')]['count'](_0x2f325b)[_0x908a('0x25')](function(_0x3f17c9){_0x11043e[_0x908a('0x20')]=_0x3f17c9;if(_0xc64033[_0x908a('0x32')][_0x908a('0x40')]){_0x455af3[_0x908a('0x41')]=[{'all':!![]}];}return db[_0x908a('0x2b')]['findAll'](_0x455af3);})[_0x908a('0x25')](function(_0x126456){_0x11043e[_0x908a('0x42')]=_0x126456;return _0x11043e;})[_0x908a('0x25')](respondWithFilteredResult(_0x36a544,_0x455af3))['catch'](handleError(_0x36a544,null));};exports[_0x908a('0x43')]=function(_0xe3ca82,_0xb52974){var _0x671dcb={'raw':![],'where':{'id':_0xe3ca82[_0x908a('0x44')]['id']}},_0x4c39f5={};_0x4c39f5[_0x908a('0x2f')]=_[_0x908a('0x31')](db[_0x908a('0x2b')]['rawAttributes']);_0x4c39f5[_0x908a('0x32')]=_[_0x908a('0x31')](_0xe3ca82[_0x908a('0x32')]);_0x4c39f5[_0x908a('0x33')]=_[_0x908a('0x34')](_0x4c39f5[_0x908a('0x2f')],_0x4c39f5[_0x908a('0x32')]);_0x671dcb[_0x908a('0x35')]=_[_0x908a('0x34')](_0x4c39f5[_0x908a('0x2f')],qs[_0x908a('0x36')](_0xe3ca82[_0x908a('0x32')][_0x908a('0x36')]));_0x671dcb[_0x908a('0x35')]=_0x671dcb['attributes'][_0x908a('0x37')]?_0x671dcb['attributes']:_0x4c39f5[_0x908a('0x2f')];if(_0xe3ca82[_0x908a('0x32')][_0x908a('0x40')]){_0x671dcb[_0x908a('0x41')]=[{'all':!![]}];}_0x671dcb=_[_0x908a('0x45')]({},_0x671dcb,_0xe3ca82[_0x908a('0x3f')]);return db['ZendeskConfiguration']['find'](_0x671dcb)[_0x908a('0x25')](handleEntityNotFound(_0xb52974,null))[_0x908a('0x25')](respondWithResult(_0xb52974,null))[_0x908a('0x46')](handleError(_0xb52974,null));};exports['create']=function(_0xa25f1e,_0x4a3963){return db[_0x908a('0x2b')][_0x908a('0x47')](_0xa25f1e[_0x908a('0x48')],{})[_0x908a('0x25')](respondWithResult(_0x4a3963,0xc9))['catch'](handleError(_0x4a3963,null));};exports[_0x908a('0x49')]=function(_0x37387b,_0x406706){if(_0x37387b[_0x908a('0x48')]['id']){delete _0x37387b[_0x908a('0x48')]['id'];}return db[_0x908a('0x2b')][_0x908a('0x4a')]({'where':{'id':_0x37387b[_0x908a('0x44')]['id']}})[_0x908a('0x25')](handleEntityNotFound(_0x406706,null))['then'](saveUpdates(_0x37387b[_0x908a('0x48')],null))[_0x908a('0x25')](respondWithResult(_0x406706,null))['catch'](handleError(_0x406706,null));};exports[_0x908a('0x26')]=function(_0x3db67f,_0x3ddbcc){return db[_0x908a('0x2b')][_0x908a('0x4a')]({'where':{'id':_0x3db67f[_0x908a('0x44')]['id']}})[_0x908a('0x25')](handleEntityNotFound(_0x3ddbcc,null))[_0x908a('0x25')](removeEntity(_0x3ddbcc,null))['catch'](handleError(_0x3ddbcc,null));};exports[_0x908a('0x4b')]=function(_0x30ebee,_0x4ae123,_0x241dd5){var _0x58af67={};var _0x4542c9={};var _0x1341a5;var _0x548886;return db[_0x908a('0x2b')]['findOne']({'where':{'id':_0x30ebee[_0x908a('0x44')]['id']}})[_0x908a('0x25')](handleEntityNotFound(_0x4ae123,null))[_0x908a('0x25')](function(_0x289256){if(_0x289256){_0x1341a5=_0x289256;_0x4542c9[_0x908a('0x2f')]=_['keys'](db[_0x908a('0x4c')][_0x908a('0x2c')]);_0x4542c9[_0x908a('0x32')]=_[_0x908a('0x31')](_0x30ebee[_0x908a('0x32')]);_0x4542c9[_0x908a('0x33')]=_['intersection'](_0x4542c9[_0x908a('0x2f')],_0x4542c9[_0x908a('0x32')]);_0x58af67[_0x908a('0x35')]=_[_0x908a('0x34')](_0x4542c9[_0x908a('0x2f')],qs['fields'](_0x30ebee[_0x908a('0x32')][_0x908a('0x36')]));_0x58af67[_0x908a('0x35')]=_0x58af67['attributes']['length']?_0x58af67[_0x908a('0x35')]:_0x4542c9[_0x908a('0x2f')];_0x58af67[_0x908a('0x4d')]=qs[_0x908a('0x3a')](_0x30ebee[_0x908a('0x32')][_0x908a('0x3a')]);_0x58af67[_0x908a('0x3c')]=qs[_0x908a('0x33')](_['pick'](_0x30ebee['query'],_0x4542c9[_0x908a('0x33')]));if(_0x30ebee[_0x908a('0x32')][_0x908a('0x3b')]){_0x58af67[_0x908a('0x3c')]=_[_0x908a('0x45')](_0x58af67[_0x908a('0x3c')],{'$or':_[_0x908a('0x30')](_0x58af67[_0x908a('0x35')],function(_0x1db873){var _0x43a18b={};_0x43a18b[_0x1db873]={'$like':'%'+_0x30ebee[_0x908a('0x32')][_0x908a('0x3b')]+'%'};return _0x43a18b;})});}_0x58af67=_[_0x908a('0x45')]({},_0x58af67,_0x30ebee[_0x908a('0x3f')]);return _0x1341a5[_0x908a('0x4b')](_0x58af67);}})[_0x908a('0x25')](function(_0x1cb297){if(_0x1cb297){_0x548886=_0x1cb297[_0x908a('0x37')];if(!_0x30ebee[_0x908a('0x32')]['hasOwnProperty']('nolimit')){_0x58af67[_0x908a('0x21')]=qs['limit'](_0x30ebee[_0x908a('0x32')][_0x908a('0x21')]);_0x58af67[_0x908a('0x1e')]=qs[_0x908a('0x1e')](_0x30ebee[_0x908a('0x32')][_0x908a('0x1e')]);}return _0x1341a5[_0x908a('0x4b')](_0x58af67);}})[_0x908a('0x25')](function(_0x4bd7f5){if(_0x4bd7f5){return _0x4bd7f5?{'count':_0x548886,'rows':_0x4bd7f5}:null;}})[_0x908a('0x25')](respondWithResult(_0x4ae123,null))[_0x908a('0x46')](handleError(_0x4ae123,null));};exports[_0x908a('0x4e')]=function(_0x2edb11,_0x52c359,_0x57d53d){var _0x25a5e2={};var _0x3180df={};var _0x56b973;var _0x150b0b;return db[_0x908a('0x2b')]['findOne']({'where':{'id':_0x2edb11[_0x908a('0x44')]['id']}})[_0x908a('0x25')](handleEntityNotFound(_0x52c359,null))[_0x908a('0x25')](function(_0x1b06ce){if(_0x1b06ce){_0x56b973=_0x1b06ce;_0x3180df['model']=_[_0x908a('0x31')](db[_0x908a('0x4c')][_0x908a('0x2c')]);_0x3180df[_0x908a('0x32')]=_['keys'](_0x2edb11['query']);_0x3180df['filters']=_[_0x908a('0x34')](_0x3180df[_0x908a('0x2f')],_0x3180df['query']);_0x25a5e2[_0x908a('0x35')]=_[_0x908a('0x34')](_0x3180df[_0x908a('0x2f')],qs[_0x908a('0x36')](_0x2edb11['query'][_0x908a('0x36')]));_0x25a5e2[_0x908a('0x35')]=_0x25a5e2[_0x908a('0x35')][_0x908a('0x37')]?_0x25a5e2['attributes']:_0x3180df['model'];_0x25a5e2['order']=qs[_0x908a('0x3a')](_0x2edb11[_0x908a('0x32')][_0x908a('0x3a')]);_0x25a5e2[_0x908a('0x3c')]=qs[_0x908a('0x33')](_['pick'](_0x2edb11['query'],_0x3180df[_0x908a('0x33')]));if(_0x2edb11[_0x908a('0x32')][_0x908a('0x3b')]){_0x25a5e2[_0x908a('0x3c')]=_[_0x908a('0x45')](_0x25a5e2[_0x908a('0x3c')],{'$or':_[_0x908a('0x30')](_0x25a5e2[_0x908a('0x35')],function(_0x3497ce){var _0x15c42f={};_0x15c42f[_0x3497ce]={'$like':'%'+_0x2edb11[_0x908a('0x32')][_0x908a('0x3b')]+'%'};return _0x15c42f;})});}_0x25a5e2=_['merge']({},_0x25a5e2,_0x2edb11['options']);return _0x56b973[_0x908a('0x4e')](_0x25a5e2);}})['then'](function(_0x3763d6){if(_0x3763d6){_0x150b0b=_0x3763d6[_0x908a('0x37')];if(!_0x2edb11[_0x908a('0x32')][_0x908a('0x38')](_0x908a('0x39'))){_0x25a5e2[_0x908a('0x21')]=qs[_0x908a('0x21')](_0x2edb11[_0x908a('0x32')][_0x908a('0x21')]);_0x25a5e2[_0x908a('0x1e')]=qs[_0x908a('0x1e')](_0x2edb11['query']['offset']);}return _0x56b973[_0x908a('0x4e')](_0x25a5e2);}})['then'](function(_0xa4e574){if(_0xa4e574){return _0xa4e574?{'count':_0x150b0b,'rows':_0xa4e574}:null;}})['then'](respondWithResult(_0x52c359,null))[_0x908a('0x46')](handleError(_0x52c359,null));};exports[_0x908a('0x4f')]=function(_0x294888,_0x334a76,_0x4963e3){var _0x4896dd={};var _0x298aef={};var _0x18a288;var _0x31ea0e;return db[_0x908a('0x2b')][_0x908a('0x50')]({'where':{'id':_0x294888[_0x908a('0x44')]['id']}})[_0x908a('0x25')](handleEntityNotFound(_0x334a76,null))[_0x908a('0x25')](function(_0x34c343){if(_0x34c343){_0x18a288=_0x34c343;_0x298aef[_0x908a('0x2f')]=_[_0x908a('0x31')](db['ZendeskField'][_0x908a('0x2c')]);_0x298aef[_0x908a('0x32')]=_[_0x908a('0x31')](_0x294888[_0x908a('0x32')]);_0x298aef[_0x908a('0x33')]=_[_0x908a('0x34')](_0x298aef[_0x908a('0x2f')],_0x298aef[_0x908a('0x32')]);_0x4896dd['attributes']=_[_0x908a('0x34')](_0x298aef[_0x908a('0x2f')],qs[_0x908a('0x36')](_0x294888[_0x908a('0x32')]['fields']));_0x4896dd[_0x908a('0x35')]=_0x4896dd[_0x908a('0x35')]['length']?_0x4896dd[_0x908a('0x35')]:_0x298aef['model'];_0x4896dd[_0x908a('0x4d')]=qs[_0x908a('0x3a')](_0x294888['query'][_0x908a('0x3a')]);_0x4896dd[_0x908a('0x3c')]=qs[_0x908a('0x33')](_[_0x908a('0x51')](_0x294888[_0x908a('0x32')],_0x298aef['filters']));if(_0x294888[_0x908a('0x32')]['filter']){_0x4896dd[_0x908a('0x3c')]=_[_0x908a('0x45')](_0x4896dd['where'],{'$or':_[_0x908a('0x30')](_0x4896dd[_0x908a('0x35')],function(_0x239fcb){var _0x39dae1={};_0x39dae1[_0x239fcb]={'$like':'%'+_0x294888[_0x908a('0x32')]['filter']+'%'};return _0x39dae1;})});}_0x4896dd=_['merge']({},_0x4896dd,_0x294888[_0x908a('0x3f')]);return _0x18a288[_0x908a('0x4f')](_0x4896dd);}})['then'](function(_0xb372cc){if(_0xb372cc){_0x31ea0e=_0xb372cc['length'];if(!_0x294888[_0x908a('0x32')][_0x908a('0x38')](_0x908a('0x39'))){_0x4896dd[_0x908a('0x21')]=qs[_0x908a('0x21')](_0x294888[_0x908a('0x32')][_0x908a('0x21')]);_0x4896dd[_0x908a('0x1e')]=qs[_0x908a('0x1e')](_0x294888['query'][_0x908a('0x1e')]);}return _0x18a288[_0x908a('0x4f')](_0x4896dd);}})[_0x908a('0x25')](function(_0x3e08ed){if(_0x3e08ed){return _0x3e08ed?{'count':_0x31ea0e,'rows':_0x3e08ed}:null;}})[_0x908a('0x25')](respondWithResult(_0x334a76,null))['catch'](handleError(_0x334a76,null));};exports[_0x908a('0x52')]=function(_0x4f1da2,_0x2c237a,_0x29b0f2){var _0x491cd4={};var _0x1c1347={};var _0x1e6dbc;var _0xa1150;return db['ZendeskConfiguration'][_0x908a('0x50')]({'where':{'id':_0x4f1da2[_0x908a('0x44')]['id']}})[_0x908a('0x25')](handleEntityNotFound(_0x2c237a,null))[_0x908a('0x25')](function(_0x3d3b5a){if(_0x3d3b5a){_0x1e6dbc=_0x3d3b5a;_0x1c1347['model']=_[_0x908a('0x31')](db['Tag']['rawAttributes']);_0x1c1347[_0x908a('0x32')]=_[_0x908a('0x31')](_0x4f1da2[_0x908a('0x32')]);_0x1c1347[_0x908a('0x33')]=_['intersection'](_0x1c1347[_0x908a('0x2f')],_0x1c1347[_0x908a('0x32')]);_0x491cd4[_0x908a('0x35')]=_[_0x908a('0x34')](_0x1c1347[_0x908a('0x2f')],qs[_0x908a('0x36')](_0x4f1da2[_0x908a('0x32')][_0x908a('0x36')]));_0x491cd4[_0x908a('0x35')]=_0x491cd4[_0x908a('0x35')][_0x908a('0x37')]?_0x491cd4[_0x908a('0x35')]:_0x1c1347['model'];_0x491cd4[_0x908a('0x4d')]=qs[_0x908a('0x3a')](_0x4f1da2[_0x908a('0x32')][_0x908a('0x3a')]);_0x491cd4[_0x908a('0x3c')]=qs[_0x908a('0x33')](_[_0x908a('0x51')](_0x4f1da2[_0x908a('0x32')],_0x1c1347[_0x908a('0x33')]));if(_0x4f1da2[_0x908a('0x32')][_0x908a('0x3b')]){_0x491cd4['where']=_[_0x908a('0x45')](_0x491cd4[_0x908a('0x3c')],{'$or':_['map'](_0x491cd4[_0x908a('0x35')],function(_0x4c3302){var _0x59ba57={};_0x59ba57[_0x4c3302]={'$like':'%'+_0x4f1da2[_0x908a('0x32')][_0x908a('0x3b')]+'%'};return _0x59ba57;})});}_0x491cd4=_[_0x908a('0x45')]({},_0x491cd4,_0x4f1da2[_0x908a('0x3f')]);return _0x1e6dbc[_0x908a('0x52')](_0x491cd4);}})[_0x908a('0x25')](function(_0x1bc5c8){if(_0x1bc5c8){_0xa1150=_0x1bc5c8['length'];if(!_0x4f1da2[_0x908a('0x32')][_0x908a('0x38')]('nolimit')){_0x491cd4[_0x908a('0x21')]=qs[_0x908a('0x21')](_0x4f1da2['query']['limit']);_0x491cd4[_0x908a('0x1e')]=qs[_0x908a('0x1e')](_0x4f1da2['query']['offset']);}return _0x1e6dbc[_0x908a('0x52')](_0x491cd4);}})['then'](function(_0x525cad){if(_0x525cad){return _0x525cad?{'count':_0xa1150,'rows':_0x525cad}:null;}})[_0x908a('0x25')](respondWithResult(_0x2c237a,null))[_0x908a('0x46')](handleError(_0x2c237a,null));};exports[_0x908a('0x53')]=function(_0x5d91e0,_0x2f6a2b,_0x5c073f){if(_0x5d91e0[_0x908a('0x48')]['id']){delete _0x5d91e0[_0x908a('0x48')]['id'];}return db[_0x908a('0x2b')][_0x908a('0x50')]({'where':{'id':_0x5d91e0['params']['id']}})[_0x908a('0x25')](handleEntityNotFound(_0x2f6a2b,null))[_0x908a('0x25')](function(_0x19fc10){if(_0x19fc10){return _0x19fc10['setTags'](_0x5d91e0[_0x908a('0x48')][_0x908a('0x54')]||[]);}return null;})[_0x908a('0x25')](respondWithResult(_0x2f6a2b,null))[_0x908a('0x46')](handleError(_0x2f6a2b,null));};
\ No newline at end of file