Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / intZendeskConfiguration / intZendeskConfiguration.controller.js
index 2b46020..ea643b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1798=['rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','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/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','update','then','destroy','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','ZendeskConfiguration','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','getFields','findOne','ZendeskField','nolimit','getSubjects','order','getDescriptions','getTags','ids','eml-format'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x1798,0xa7));var _0x8179=function(_0x1af2c6,_0x3b0895){_0x1af2c6=_0x1af2c6-0x0;var _0x4e41d3=_0x1798[_0x1af2c6];return _0x4e41d3;};'use strict';var emlformat=require(_0x8179('0x0'));var rimraf=require(_0x8179('0x1'));var zipdir=require(_0x8179('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8179('0x3'));var BPromise=require(_0x8179('0x4'));var Mustache=require(_0x8179('0x5'));var util=require(_0x8179('0x6'));var path=require(_0x8179('0x7'));var sox=require(_0x8179('0x8'));var csv=require(_0x8179('0x9'));var ejs=require(_0x8179('0xa'));var fs=require('fs');var fs_extra=require(_0x8179('0xb'));var _=require(_0x8179('0xc'));var squel=require(_0x8179('0xd'));var crypto=require(_0x8179('0xe'));var jsforce=require(_0x8179('0xf'));var deskjs=require(_0x8179('0x10'));var toCsv=require(_0x8179('0x9'));var querystring=require(_0x8179('0x11'));var Papa=require(_0x8179('0x12'));var Redis=require(_0x8179('0x13'));var authService=require(_0x8179('0x14'));var qs=require(_0x8179('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8179('0x16'));var logger=require('../../config/logger')(_0x8179('0x17'));var utils=require(_0x8179('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8179('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x303ca4,_0x503756){_0x503756=_0x503756||0xcc;return function(_0xb9c896){if(_0xb9c896){return _0x303ca4[_0x8179('0x1a')](_0x503756);}return _0x303ca4[_0x8179('0x1b')](_0x503756)[_0x8179('0x1c')]();};}function respondWithResult(_0x11dc57,_0x4bdd66){_0x4bdd66=_0x4bdd66||0xc8;return function(_0x59a240){if(_0x59a240){return _0x11dc57['status'](_0x4bdd66)[_0x8179('0x1d')](_0x59a240);}};}function respondWithFilteredResult(_0x19d623,_0x89c9ef){return function(_0x1e1e8d){if(_0x1e1e8d){var _0x2c4e0f=typeof _0x89c9ef[_0x8179('0x1e')]===_0x8179('0x1f')&&typeof _0x89c9ef['limit']===_0x8179('0x1f');var _0x5f4ee3=_0x1e1e8d[_0x8179('0x20')];var _0x408093=_0x2c4e0f?0x0:_0x89c9ef['offset'];var _0x3ea362=_0x2c4e0f?_0x1e1e8d[_0x8179('0x20')]:_0x89c9ef[_0x8179('0x1e')]+_0x89c9ef[_0x8179('0x21')];var _0x504afc;if(_0x3ea362>=_0x5f4ee3){_0x3ea362=_0x5f4ee3;_0x504afc=0xc8;}else{_0x504afc=0xce;}_0x19d623['status'](_0x504afc);return _0x19d623[_0x8179('0x22')]('Content-Range',_0x408093+'-'+_0x3ea362+'/'+_0x5f4ee3)[_0x8179('0x1d')](_0x1e1e8d);}return null;};}function patchUpdates(_0x14602a){return function(_0xd49acb){try{jsonpatch[_0x8179('0x23')](_0xd49acb,_0x14602a,!![]);}catch(_0x47bf3a){return BPromise['reject'](_0x47bf3a);}return _0xd49acb['save']();};}function saveUpdates(_0x4ebdcb,_0x353438){return function(_0x20459d){if(_0x20459d){return _0x20459d[_0x8179('0x24')](_0x4ebdcb)[_0x8179('0x25')](function(_0x3427c8){return _0x3427c8;});}return null;};}function removeEntity(_0x3db45a,_0x563926){return function(_0xbeacd8){if(_0xbeacd8){return _0xbeacd8[_0x8179('0x26')]()[_0x8179('0x25')](function(){_0x3db45a[_0x8179('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x445897,_0x51c6f8){return function(_0x3c95b9){if(!_0x3c95b9){_0x445897[_0x8179('0x1a')](0x194);}return _0x3c95b9;};}function handleError(_0x194bcb,_0x4d734a){_0x4d734a=_0x4d734a||0x1f4;return function(_0x5445c0){logger[_0x8179('0x27')](_0x5445c0[_0x8179('0x28')]);if(_0x5445c0[_0x8179('0x29')]){delete _0x5445c0['name'];}_0x194bcb['status'](_0x4d734a)['send'](_0x5445c0);};}exports[_0x8179('0x2a')]=function(_0x306a88,_0x5db153){var _0x5b6de2={},_0x7a430e={},_0x4181c1={'count':0x0,'rows':[]};var _0x22de1c=_[_0x8179('0x2b')](db['ZendeskConfiguration']['rawAttributes'],function(_0x3a614a){return{'name':_0x3a614a[_0x8179('0x2c')],'type':_0x3a614a[_0x8179('0x2d')][_0x8179('0x2e')]};});_0x7a430e[_0x8179('0x2f')]=_[_0x8179('0x2b')](_0x22de1c,_0x8179('0x29'));_0x7a430e[_0x8179('0x30')]=_[_0x8179('0x31')](_0x306a88[_0x8179('0x30')]);_0x7a430e[_0x8179('0x32')]=_[_0x8179('0x33')](_0x7a430e[_0x8179('0x2f')],_0x7a430e[_0x8179('0x30')]);_0x5b6de2[_0x8179('0x34')]=_['intersection'](_0x7a430e['model'],qs[_0x8179('0x35')](_0x306a88[_0x8179('0x30')][_0x8179('0x35')]));_0x5b6de2[_0x8179('0x34')]=_0x5b6de2['attributes'][_0x8179('0x36')]?_0x5b6de2['attributes']:_0x7a430e[_0x8179('0x2f')];if(!_0x306a88[_0x8179('0x30')][_0x8179('0x37')]('nolimit')){_0x5b6de2['limit']=qs[_0x8179('0x21')](_0x306a88['query'][_0x8179('0x21')]);_0x5b6de2[_0x8179('0x1e')]=qs[_0x8179('0x1e')](_0x306a88['query'][_0x8179('0x1e')]);}_0x5b6de2['order']=qs['sort'](_0x306a88['query'][_0x8179('0x38')]);_0x5b6de2['where']=qs[_0x8179('0x32')](_[_0x8179('0x39')](_0x306a88[_0x8179('0x30')],_0x7a430e[_0x8179('0x32')]),_0x22de1c);if(_0x306a88[_0x8179('0x30')][_0x8179('0x3a')]){_0x5b6de2[_0x8179('0x3b')]=_[_0x8179('0x3c')](_0x5b6de2['where'],{'$or':_['map'](_0x22de1c,function(_0x46ef2d){if(_0x46ef2d[_0x8179('0x2d')]!==_0x8179('0x3d')){var _0x1b3308={};_0x1b3308[_0x46ef2d[_0x8179('0x29')]]={'$like':'%'+_0x306a88[_0x8179('0x30')]['filter']+'%'};return _0x1b3308;}})});}_0x5b6de2=_[_0x8179('0x3c')]({},_0x5b6de2,_0x306a88[_0x8179('0x3e')]);var _0x45d025={'where':_0x5b6de2[_0x8179('0x3b')]};return db[_0x8179('0x3f')]['count'](_0x45d025)[_0x8179('0x25')](function(_0x1f07b7){_0x4181c1[_0x8179('0x20')]=_0x1f07b7;if(_0x306a88['query']['includeAll']){_0x5b6de2[_0x8179('0x40')]=[{'all':!![]}];}return db[_0x8179('0x3f')][_0x8179('0x41')](_0x5b6de2);})[_0x8179('0x25')](function(_0x4567c6){_0x4181c1[_0x8179('0x42')]=_0x4567c6;return _0x4181c1;})['then'](respondWithFilteredResult(_0x5db153,_0x5b6de2))[_0x8179('0x43')](handleError(_0x5db153,null));};exports[_0x8179('0x44')]=function(_0x1ebc98,_0x27abb7){var _0x55fc1f={'raw':![],'where':{'id':_0x1ebc98[_0x8179('0x45')]['id']}},_0xae736f={};_0xae736f[_0x8179('0x2f')]=_[_0x8179('0x31')](db[_0x8179('0x3f')][_0x8179('0x46')]);_0xae736f['query']=_[_0x8179('0x31')](_0x1ebc98[_0x8179('0x30')]);_0xae736f['filters']=_['intersection'](_0xae736f['model'],_0xae736f[_0x8179('0x30')]);_0x55fc1f['attributes']=_[_0x8179('0x33')](_0xae736f[_0x8179('0x2f')],qs[_0x8179('0x35')](_0x1ebc98[_0x8179('0x30')][_0x8179('0x35')]));_0x55fc1f[_0x8179('0x34')]=_0x55fc1f['attributes']['length']?_0x55fc1f[_0x8179('0x34')]:_0xae736f['model'];if(_0x1ebc98['query'][_0x8179('0x47')]){_0x55fc1f[_0x8179('0x40')]=[{'all':!![]}];}_0x55fc1f=_[_0x8179('0x3c')]({},_0x55fc1f,_0x1ebc98[_0x8179('0x3e')]);return db[_0x8179('0x3f')][_0x8179('0x48')](_0x55fc1f)[_0x8179('0x25')](handleEntityNotFound(_0x27abb7,null))[_0x8179('0x25')](respondWithResult(_0x27abb7,null))[_0x8179('0x43')](handleError(_0x27abb7,null));};exports[_0x8179('0x49')]=function(_0xbad1e1,_0xd18068){return db[_0x8179('0x3f')][_0x8179('0x49')](_0xbad1e1[_0x8179('0x4a')],{})[_0x8179('0x25')](respondWithResult(_0xd18068,0xc9))[_0x8179('0x43')](handleError(_0xd18068,null));};exports[_0x8179('0x24')]=function(_0x4caecd,_0x1a481e){if(_0x4caecd[_0x8179('0x4a')]['id']){delete _0x4caecd[_0x8179('0x4a')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x4caecd[_0x8179('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a481e,null))[_0x8179('0x25')](saveUpdates(_0x4caecd[_0x8179('0x4a')],null))['then'](respondWithResult(_0x1a481e,null))[_0x8179('0x43')](handleError(_0x1a481e,null));};exports[_0x8179('0x26')]=function(_0x4b3527,_0x7a3fd2){return db[_0x8179('0x3f')][_0x8179('0x48')]({'where':{'id':_0x4b3527[_0x8179('0x45')]['id']}})[_0x8179('0x25')](handleEntityNotFound(_0x7a3fd2,null))[_0x8179('0x25')](removeEntity(_0x7a3fd2,null))['catch'](handleError(_0x7a3fd2,null));};exports[_0x8179('0x4b')]=function(_0x1693e5,_0x4ed1d7,_0x3538a2){var _0x7708a5={};var _0x539531={};var _0x3ef14d;var _0x58f5e9;return db[_0x8179('0x3f')][_0x8179('0x4c')]({'where':{'id':_0x1693e5[_0x8179('0x45')]['id']}})[_0x8179('0x25')](handleEntityNotFound(_0x4ed1d7,null))[_0x8179('0x25')](function(_0x2ad3fb){if(_0x2ad3fb){_0x3ef14d=_0x2ad3fb;_0x539531[_0x8179('0x2f')]=_[_0x8179('0x31')](db[_0x8179('0x4d')][_0x8179('0x46')]);_0x539531[_0x8179('0x30')]=_[_0x8179('0x31')](_0x1693e5[_0x8179('0x30')]);_0x539531[_0x8179('0x32')]=_[_0x8179('0x33')](_0x539531[_0x8179('0x2f')],_0x539531[_0x8179('0x30')]);_0x7708a5[_0x8179('0x34')]=_[_0x8179('0x33')](_0x539531[_0x8179('0x2f')],qs[_0x8179('0x35')](_0x1693e5[_0x8179('0x30')][_0x8179('0x35')]));_0x7708a5[_0x8179('0x34')]=_0x7708a5[_0x8179('0x34')][_0x8179('0x36')]?_0x7708a5[_0x8179('0x34')]:_0x539531[_0x8179('0x2f')];_0x7708a5['order']=qs[_0x8179('0x38')](_0x1693e5[_0x8179('0x30')][_0x8179('0x38')]);_0x7708a5[_0x8179('0x3b')]=qs[_0x8179('0x32')](_[_0x8179('0x39')](_0x1693e5[_0x8179('0x30')],_0x539531[_0x8179('0x32')]));if(_0x1693e5[_0x8179('0x30')][_0x8179('0x3a')]){_0x7708a5[_0x8179('0x3b')]=_[_0x8179('0x3c')](_0x7708a5['where'],{'$or':_[_0x8179('0x2b')](_0x7708a5['attributes'],function(_0x124a2f){var _0x47765e={};_0x47765e[_0x124a2f]={'$like':'%'+_0x1693e5[_0x8179('0x30')][_0x8179('0x3a')]+'%'};return _0x47765e;})});}_0x7708a5=_['merge']({},_0x7708a5,_0x1693e5[_0x8179('0x3e')]);return _0x3ef14d[_0x8179('0x4b')](_0x7708a5);}})[_0x8179('0x25')](function(_0x338a5b){if(_0x338a5b){_0x58f5e9=_0x338a5b['length'];if(!_0x1693e5[_0x8179('0x30')][_0x8179('0x37')](_0x8179('0x4e'))){_0x7708a5[_0x8179('0x21')]=qs[_0x8179('0x21')](_0x1693e5[_0x8179('0x30')][_0x8179('0x21')]);_0x7708a5['offset']=qs['offset'](_0x1693e5[_0x8179('0x30')][_0x8179('0x1e')]);}return _0x3ef14d[_0x8179('0x4b')](_0x7708a5);}})[_0x8179('0x25')](function(_0x1ccff3){if(_0x1ccff3){return _0x1ccff3?{'count':_0x58f5e9,'rows':_0x1ccff3}:null;}})[_0x8179('0x25')](respondWithResult(_0x4ed1d7,null))['catch'](handleError(_0x4ed1d7,null));};exports[_0x8179('0x4f')]=function(_0x578526,_0x51b687,_0x58b65a){var _0x4fea19={};var _0x3e498b={};var _0x20a652;var _0x4815e8;return db[_0x8179('0x3f')][_0x8179('0x4c')]({'where':{'id':_0x578526[_0x8179('0x45')]['id']}})[_0x8179('0x25')](handleEntityNotFound(_0x51b687,null))[_0x8179('0x25')](function(_0x1772f1){if(_0x1772f1){_0x20a652=_0x1772f1;_0x3e498b[_0x8179('0x2f')]=_[_0x8179('0x31')](db[_0x8179('0x4d')][_0x8179('0x46')]);_0x3e498b[_0x8179('0x30')]=_['keys'](_0x578526[_0x8179('0x30')]);_0x3e498b[_0x8179('0x32')]=_[_0x8179('0x33')](_0x3e498b[_0x8179('0x2f')],_0x3e498b[_0x8179('0x30')]);_0x4fea19[_0x8179('0x34')]=_['intersection'](_0x3e498b[_0x8179('0x2f')],qs[_0x8179('0x35')](_0x578526['query'][_0x8179('0x35')]));_0x4fea19[_0x8179('0x34')]=_0x4fea19[_0x8179('0x34')][_0x8179('0x36')]?_0x4fea19[_0x8179('0x34')]:_0x3e498b[_0x8179('0x2f')];_0x4fea19[_0x8179('0x50')]=qs[_0x8179('0x38')](_0x578526[_0x8179('0x30')][_0x8179('0x38')]);_0x4fea19[_0x8179('0x3b')]=qs['filters'](_['pick'](_0x578526[_0x8179('0x30')],_0x3e498b[_0x8179('0x32')]));if(_0x578526[_0x8179('0x30')][_0x8179('0x3a')]){_0x4fea19[_0x8179('0x3b')]=_[_0x8179('0x3c')](_0x4fea19['where'],{'$or':_[_0x8179('0x2b')](_0x4fea19[_0x8179('0x34')],function(_0xfefb9a){var _0x275cf4={};_0x275cf4[_0xfefb9a]={'$like':'%'+_0x578526[_0x8179('0x30')][_0x8179('0x3a')]+'%'};return _0x275cf4;})});}_0x4fea19=_[_0x8179('0x3c')]({},_0x4fea19,_0x578526[_0x8179('0x3e')]);return _0x20a652[_0x8179('0x4f')](_0x4fea19);}})[_0x8179('0x25')](function(_0x2971be){if(_0x2971be){_0x4815e8=_0x2971be[_0x8179('0x36')];if(!_0x578526[_0x8179('0x30')][_0x8179('0x37')](_0x8179('0x4e'))){_0x4fea19[_0x8179('0x21')]=qs[_0x8179('0x21')](_0x578526[_0x8179('0x30')][_0x8179('0x21')]);_0x4fea19['offset']=qs[_0x8179('0x1e')](_0x578526[_0x8179('0x30')][_0x8179('0x1e')]);}return _0x20a652[_0x8179('0x4f')](_0x4fea19);}})[_0x8179('0x25')](function(_0x237313){if(_0x237313){return _0x237313?{'count':_0x4815e8,'rows':_0x237313}:null;}})[_0x8179('0x25')](respondWithResult(_0x51b687,null))[_0x8179('0x43')](handleError(_0x51b687,null));};exports[_0x8179('0x51')]=function(_0x20790e,_0x469048,_0x552c8d){var _0x43be8a={};var _0x596e9b={};var _0x363746;var _0x5c5a5a;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x20790e[_0x8179('0x45')]['id']}})['then'](handleEntityNotFound(_0x469048,null))[_0x8179('0x25')](function(_0x291b83){if(_0x291b83){_0x363746=_0x291b83;_0x596e9b['model']=_[_0x8179('0x31')](db[_0x8179('0x4d')][_0x8179('0x46')]);_0x596e9b[_0x8179('0x30')]=_[_0x8179('0x31')](_0x20790e['query']);_0x596e9b[_0x8179('0x32')]=_[_0x8179('0x33')](_0x596e9b[_0x8179('0x2f')],_0x596e9b[_0x8179('0x30')]);_0x43be8a[_0x8179('0x34')]=_[_0x8179('0x33')](_0x596e9b['model'],qs[_0x8179('0x35')](_0x20790e[_0x8179('0x30')]['fields']));_0x43be8a[_0x8179('0x34')]=_0x43be8a[_0x8179('0x34')][_0x8179('0x36')]?_0x43be8a[_0x8179('0x34')]:_0x596e9b['model'];_0x43be8a[_0x8179('0x50')]=qs[_0x8179('0x38')](_0x20790e[_0x8179('0x30')][_0x8179('0x38')]);_0x43be8a[_0x8179('0x3b')]=qs[_0x8179('0x32')](_[_0x8179('0x39')](_0x20790e[_0x8179('0x30')],_0x596e9b[_0x8179('0x32')]));if(_0x20790e['query'][_0x8179('0x3a')]){_0x43be8a[_0x8179('0x3b')]=_[_0x8179('0x3c')](_0x43be8a[_0x8179('0x3b')],{'$or':_[_0x8179('0x2b')](_0x43be8a[_0x8179('0x34')],function(_0x9d8f32){var _0x361376={};_0x361376[_0x9d8f32]={'$like':'%'+_0x20790e['query']['filter']+'%'};return _0x361376;})});}_0x43be8a=_[_0x8179('0x3c')]({},_0x43be8a,_0x20790e['options']);return _0x363746[_0x8179('0x51')](_0x43be8a);}})[_0x8179('0x25')](function(_0xeafe){if(_0xeafe){_0x5c5a5a=_0xeafe[_0x8179('0x36')];if(!_0x20790e[_0x8179('0x30')][_0x8179('0x37')](_0x8179('0x4e'))){_0x43be8a['limit']=qs[_0x8179('0x21')](_0x20790e['query'][_0x8179('0x21')]);_0x43be8a[_0x8179('0x1e')]=qs['offset'](_0x20790e[_0x8179('0x30')][_0x8179('0x1e')]);}return _0x363746[_0x8179('0x51')](_0x43be8a);}})[_0x8179('0x25')](function(_0x6c053e){if(_0x6c053e){return _0x6c053e?{'count':_0x5c5a5a,'rows':_0x6c053e}:null;}})[_0x8179('0x25')](respondWithResult(_0x469048,null))[_0x8179('0x43')](handleError(_0x469048,null));};exports[_0x8179('0x52')]=function(_0x441038,_0x192efe,_0x35fbc0){var _0x98dca={};var _0x196d06={};var _0x496773;var _0x52da7b;return db[_0x8179('0x3f')][_0x8179('0x4c')]({'where':{'id':_0x441038['params']['id']}})[_0x8179('0x25')](handleEntityNotFound(_0x192efe,null))[_0x8179('0x25')](function(_0x1e549f){if(_0x1e549f){_0x496773=_0x1e549f;_0x196d06['model']=_[_0x8179('0x31')](db['Tag']['rawAttributes']);_0x196d06[_0x8179('0x30')]=_[_0x8179('0x31')](_0x441038[_0x8179('0x30')]);_0x196d06[_0x8179('0x32')]=_[_0x8179('0x33')](_0x196d06[_0x8179('0x2f')],_0x196d06[_0x8179('0x30')]);_0x98dca[_0x8179('0x34')]=_['intersection'](_0x196d06[_0x8179('0x2f')],qs['fields'](_0x441038[_0x8179('0x30')]['fields']));_0x98dca[_0x8179('0x34')]=_0x98dca['attributes'][_0x8179('0x36')]?_0x98dca[_0x8179('0x34')]:_0x196d06['model'];_0x98dca[_0x8179('0x50')]=qs[_0x8179('0x38')](_0x441038[_0x8179('0x30')]['sort']);_0x98dca[_0x8179('0x3b')]=qs[_0x8179('0x32')](_[_0x8179('0x39')](_0x441038[_0x8179('0x30')],_0x196d06['filters']));if(_0x441038[_0x8179('0x30')][_0x8179('0x3a')]){_0x98dca['where']=_[_0x8179('0x3c')](_0x98dca[_0x8179('0x3b')],{'$or':_[_0x8179('0x2b')](_0x98dca[_0x8179('0x34')],function(_0xc3caee){var _0x12626e={};_0x12626e[_0xc3caee]={'$like':'%'+_0x441038[_0x8179('0x30')]['filter']+'%'};return _0x12626e;})});}_0x98dca=_[_0x8179('0x3c')]({},_0x98dca,_0x441038[_0x8179('0x3e')]);return _0x496773['getTags'](_0x98dca);}})[_0x8179('0x25')](function(_0x1baba5){if(_0x1baba5){_0x52da7b=_0x1baba5[_0x8179('0x36')];if(!_0x441038[_0x8179('0x30')][_0x8179('0x37')](_0x8179('0x4e'))){_0x98dca[_0x8179('0x21')]=qs['limit'](_0x441038[_0x8179('0x30')][_0x8179('0x21')]);_0x98dca[_0x8179('0x1e')]=qs[_0x8179('0x1e')](_0x441038[_0x8179('0x30')][_0x8179('0x1e')]);}return _0x496773[_0x8179('0x52')](_0x98dca);}})['then'](function(_0x23537e){if(_0x23537e){return _0x23537e?{'count':_0x52da7b,'rows':_0x23537e}:null;}})['then'](respondWithResult(_0x192efe,null))[_0x8179('0x43')](handleError(_0x192efe,null));};exports['setTags']=function(_0x198d98,_0x3ec6a9,_0x5436c2){if(_0x198d98[_0x8179('0x4a')]['id']){delete _0x198d98[_0x8179('0x4a')]['id'];}return db[_0x8179('0x3f')][_0x8179('0x4c')]({'where':{'id':_0x198d98[_0x8179('0x45')]['id']}})[_0x8179('0x25')](handleEntityNotFound(_0x3ec6a9,null))[_0x8179('0x25')](function(_0x38b183){if(_0x38b183){return _0x38b183['setTags'](_0x198d98[_0x8179('0x4a')][_0x8179('0x53')]||[]);}return null;})[_0x8179('0x25')](respondWithResult(_0x3ec6a9,null))[_0x8179('0x43')](handleError(_0x3ec6a9,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