Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / intZendeskConfiguration / intZendeskConfiguration.controller.js
index 8c45850..ea643b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x541b=['end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','type','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','merge','find','create','body','getFields','findOne','ZendeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','fs-extra','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x586d12,_0x44383c){var _0x217a33=function(_0xc768c7){while(--_0xc768c7){_0x586d12['push'](_0x586d12['shift']());}};_0x217a33(++_0x44383c);}(_0x541b,0x189));var _0xb541=function(_0x5e8282,_0x1f2962){_0x5e8282=_0x5e8282-0x0;var _0x5cd37d=_0x541b[_0x5e8282];return _0x5cd37d;};'use strict';var emlformat=require(_0xb541('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb541('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb541('0x2'));var moment=require(_0xb541('0x3'));var BPromise=require(_0xb541('0x4'));var Mustache=require('mustache');var util=require(_0xb541('0x5'));var path=require('path');var sox=require(_0xb541('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb541('0x7'));var _=require('lodash');var squel=require(_0xb541('0x8'));var crypto=require(_0xb541('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb541('0xa'));var querystring=require(_0xb541('0xb'));var Papa=require(_0xb541('0xc'));var Redis=require(_0xb541('0xd'));var authService=require(_0xb541('0xe'));var qs=require(_0xb541('0xf'));var as=require(_0xb541('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb541('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xb541('0x12'));var licenseUtil=require(_0xb541('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a7b96,_0x3199f8){_0x3199f8=_0x3199f8||0xcc;return function(_0x52a45a){if(_0x52a45a){return _0x3a7b96[_0xb541('0x14')](_0x3199f8);}return _0x3a7b96[_0xb541('0x15')](_0x3199f8)[_0xb541('0x16')]();};}function respondWithResult(_0xf31458,_0x26b167){_0x26b167=_0x26b167||0xc8;return function(_0x4b2689){if(_0x4b2689){return _0xf31458[_0xb541('0x15')](_0x26b167)[_0xb541('0x17')](_0x4b2689);}};}function respondWithFilteredResult(_0x11a293,_0x14e2a2){return function(_0x6209c0){if(_0x6209c0){var _0x12c512=typeof _0x14e2a2[_0xb541('0x18')]===_0xb541('0x19')&&typeof _0x14e2a2['limit']===_0xb541('0x19');var _0x380d4d=_0x6209c0['count'];var _0x4bb85b=_0x12c512?0x0:_0x14e2a2['offset'];var _0x1faef0=_0x12c512?_0x6209c0[_0xb541('0x1a')]:_0x14e2a2['offset']+_0x14e2a2[_0xb541('0x1b')];var _0x45d83f;if(_0x1faef0>=_0x380d4d){_0x1faef0=_0x380d4d;_0x45d83f=0xc8;}else{_0x45d83f=0xce;}_0x11a293[_0xb541('0x15')](_0x45d83f);return _0x11a293[_0xb541('0x1c')](_0xb541('0x1d'),_0x4bb85b+'-'+_0x1faef0+'/'+_0x380d4d)[_0xb541('0x17')](_0x6209c0);}return null;};}function patchUpdates(_0x5b1d75){return function(_0x180f4d){try{jsonpatch[_0xb541('0x1e')](_0x180f4d,_0x5b1d75,!![]);}catch(_0x27080d){return BPromise[_0xb541('0x1f')](_0x27080d);}return _0x180f4d[_0xb541('0x20')]();};}function saveUpdates(_0x253b86,_0x1f7626){return function(_0x141741){if(_0x141741){return _0x141741[_0xb541('0x21')](_0x253b86)[_0xb541('0x22')](function(_0x1ba2a3){return _0x1ba2a3;});}return null;};}function removeEntity(_0x16f326,_0x221abd){return function(_0xb22cb9){if(_0xb22cb9){return _0xb22cb9[_0xb541('0x23')]()[_0xb541('0x22')](function(){_0x16f326[_0xb541('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x284cb1,_0x3ac509){return function(_0x1fb562){if(!_0x1fb562){_0x284cb1[_0xb541('0x14')](0x194);}return _0x1fb562;};}function handleError(_0x1bba60,_0xe00956){_0xe00956=_0xe00956||0x1f4;return function(_0x35de41){logger[_0xb541('0x24')](_0x35de41[_0xb541('0x25')]);if(_0x35de41[_0xb541('0x26')]){delete _0x35de41[_0xb541('0x26')];}_0x1bba60[_0xb541('0x15')](_0xe00956)['send'](_0x35de41);};}exports[_0xb541('0x27')]=function(_0x29c6cc,_0x46edad){var _0x58ec2b={},_0x79ca71={},_0x293223={'count':0x0,'rows':[]};var _0x4a90ac=_[_0xb541('0x28')](db[_0xb541('0x29')][_0xb541('0x2a')],function(_0x1c3021){return{'name':_0x1c3021[_0xb541('0x2b')],'type':_0x1c3021['type'][_0xb541('0x2c')]};});_0x79ca71[_0xb541('0x2d')]=_[_0xb541('0x28')](_0x4a90ac,'name');_0x79ca71[_0xb541('0x2e')]=_[_0xb541('0x2f')](_0x29c6cc[_0xb541('0x2e')]);_0x79ca71['filters']=_[_0xb541('0x30')](_0x79ca71[_0xb541('0x2d')],_0x79ca71[_0xb541('0x2e')]);_0x58ec2b[_0xb541('0x31')]=_['intersection'](_0x79ca71['model'],qs['fields'](_0x29c6cc[_0xb541('0x2e')][_0xb541('0x32')]));_0x58ec2b[_0xb541('0x31')]=_0x58ec2b[_0xb541('0x31')][_0xb541('0x33')]?_0x58ec2b[_0xb541('0x31')]:_0x79ca71[_0xb541('0x2d')];if(!_0x29c6cc[_0xb541('0x2e')][_0xb541('0x34')](_0xb541('0x35'))){_0x58ec2b[_0xb541('0x1b')]=qs['limit'](_0x29c6cc['query']['limit']);_0x58ec2b['offset']=qs[_0xb541('0x18')](_0x29c6cc[_0xb541('0x2e')][_0xb541('0x18')]);}_0x58ec2b[_0xb541('0x36')]=qs[_0xb541('0x37')](_0x29c6cc[_0xb541('0x2e')][_0xb541('0x37')]);_0x58ec2b['where']=qs[_0xb541('0x38')](_['pick'](_0x29c6cc[_0xb541('0x2e')],_0x79ca71['filters']),_0x4a90ac);if(_0x29c6cc[_0xb541('0x2e')][_0xb541('0x39')]){_0x58ec2b[_0xb541('0x3a')]=_['merge'](_0x58ec2b[_0xb541('0x3a')],{'$or':_[_0xb541('0x28')](_0x4a90ac,function(_0x5a0da2){if(_0x5a0da2[_0xb541('0x3b')]!==_0xb541('0x3c')){var _0x4e4d82={};_0x4e4d82[_0x5a0da2[_0xb541('0x26')]]={'$like':'%'+_0x29c6cc['query'][_0xb541('0x39')]+'%'};return _0x4e4d82;}})});}_0x58ec2b=_['merge']({},_0x58ec2b,_0x29c6cc[_0xb541('0x3d')]);var _0x36bd30={'where':_0x58ec2b['where']};return db['ZendeskConfiguration']['count'](_0x36bd30)['then'](function(_0x1b0b74){_0x293223[_0xb541('0x1a')]=_0x1b0b74;if(_0x29c6cc[_0xb541('0x2e')]['includeAll']){_0x58ec2b['include']=[{'all':!![]}];}return db[_0xb541('0x29')][_0xb541('0x3e')](_0x58ec2b);})[_0xb541('0x22')](function(_0x1252ea){_0x293223[_0xb541('0x3f')]=_0x1252ea;return _0x293223;})[_0xb541('0x22')](respondWithFilteredResult(_0x46edad,_0x58ec2b))[_0xb541('0x40')](handleError(_0x46edad,null));};exports[_0xb541('0x41')]=function(_0xba0bd,_0x5d72ac){var _0x28a3f0={'raw':![],'where':{'id':_0xba0bd[_0xb541('0x42')]['id']}},_0x3caa91={};_0x3caa91[_0xb541('0x2d')]=_['keys'](db[_0xb541('0x29')][_0xb541('0x2a')]);_0x3caa91['query']=_[_0xb541('0x2f')](_0xba0bd[_0xb541('0x2e')]);_0x3caa91[_0xb541('0x38')]=_[_0xb541('0x30')](_0x3caa91[_0xb541('0x2d')],_0x3caa91[_0xb541('0x2e')]);_0x28a3f0['attributes']=_[_0xb541('0x30')](_0x3caa91[_0xb541('0x2d')],qs['fields'](_0xba0bd[_0xb541('0x2e')][_0xb541('0x32')]));_0x28a3f0[_0xb541('0x31')]=_0x28a3f0[_0xb541('0x31')][_0xb541('0x33')]?_0x28a3f0[_0xb541('0x31')]:_0x3caa91[_0xb541('0x2d')];if(_0xba0bd[_0xb541('0x2e')][_0xb541('0x43')]){_0x28a3f0[_0xb541('0x44')]=[{'all':!![]}];}_0x28a3f0=_[_0xb541('0x45')]({},_0x28a3f0,_0xba0bd[_0xb541('0x3d')]);return db[_0xb541('0x29')][_0xb541('0x46')](_0x28a3f0)[_0xb541('0x22')](handleEntityNotFound(_0x5d72ac,null))['then'](respondWithResult(_0x5d72ac,null))[_0xb541('0x40')](handleError(_0x5d72ac,null));};exports['create']=function(_0x2bfa12,_0x1105ca){return db[_0xb541('0x29')][_0xb541('0x47')](_0x2bfa12[_0xb541('0x48')],{})[_0xb541('0x22')](respondWithResult(_0x1105ca,0xc9))[_0xb541('0x40')](handleError(_0x1105ca,null));};exports['update']=function(_0xb62ad8,_0x33ec1d){if(_0xb62ad8[_0xb541('0x48')]['id']){delete _0xb62ad8['body']['id'];}return db['ZendeskConfiguration'][_0xb541('0x46')]({'where':{'id':_0xb62ad8[_0xb541('0x42')]['id']}})[_0xb541('0x22')](handleEntityNotFound(_0x33ec1d,null))[_0xb541('0x22')](saveUpdates(_0xb62ad8[_0xb541('0x48')],null))[_0xb541('0x22')](respondWithResult(_0x33ec1d,null))['catch'](handleError(_0x33ec1d,null));};exports[_0xb541('0x23')]=function(_0x4b3403,_0x312a9e){return db[_0xb541('0x29')]['find']({'where':{'id':_0x4b3403['params']['id']}})['then'](handleEntityNotFound(_0x312a9e,null))[_0xb541('0x22')](removeEntity(_0x312a9e,null))['catch'](handleError(_0x312a9e,null));};exports[_0xb541('0x49')]=function(_0x47c2d9,_0x3d9c85,_0xd0ca6a){var _0x1edced={};var _0x90d2aa={};var _0x32d58a;var _0x36bccd;return db[_0xb541('0x29')][_0xb541('0x4a')]({'where':{'id':_0x47c2d9[_0xb541('0x42')]['id']}})[_0xb541('0x22')](handleEntityNotFound(_0x3d9c85,null))[_0xb541('0x22')](function(_0x5c0cdf){if(_0x5c0cdf){_0x32d58a=_0x5c0cdf;_0x90d2aa[_0xb541('0x2d')]=_[_0xb541('0x2f')](db[_0xb541('0x4b')]['rawAttributes']);_0x90d2aa['query']=_['keys'](_0x47c2d9[_0xb541('0x2e')]);_0x90d2aa[_0xb541('0x38')]=_[_0xb541('0x30')](_0x90d2aa['model'],_0x90d2aa[_0xb541('0x2e')]);_0x1edced[_0xb541('0x31')]=_[_0xb541('0x30')](_0x90d2aa[_0xb541('0x2d')],qs[_0xb541('0x32')](_0x47c2d9[_0xb541('0x2e')][_0xb541('0x32')]));_0x1edced['attributes']=_0x1edced[_0xb541('0x31')][_0xb541('0x33')]?_0x1edced[_0xb541('0x31')]:_0x90d2aa[_0xb541('0x2d')];_0x1edced[_0xb541('0x36')]=qs[_0xb541('0x37')](_0x47c2d9[_0xb541('0x2e')][_0xb541('0x37')]);_0x1edced[_0xb541('0x3a')]=qs['filters'](_['pick'](_0x47c2d9[_0xb541('0x2e')],_0x90d2aa[_0xb541('0x38')]));if(_0x47c2d9[_0xb541('0x2e')]['filter']){_0x1edced[_0xb541('0x3a')]=_['merge'](_0x1edced[_0xb541('0x3a')],{'$or':_['map'](_0x1edced[_0xb541('0x31')],function(_0x4c142f){var _0x14be17={};_0x14be17[_0x4c142f]={'$like':'%'+_0x47c2d9['query']['filter']+'%'};return _0x14be17;})});}_0x1edced=_['merge']({},_0x1edced,_0x47c2d9[_0xb541('0x3d')]);return _0x32d58a[_0xb541('0x49')](_0x1edced);}})['then'](function(_0x71a400){if(_0x71a400){_0x36bccd=_0x71a400[_0xb541('0x33')];if(!_0x47c2d9[_0xb541('0x2e')][_0xb541('0x34')](_0xb541('0x35'))){_0x1edced[_0xb541('0x1b')]=qs['limit'](_0x47c2d9['query'][_0xb541('0x1b')]);_0x1edced[_0xb541('0x18')]=qs['offset'](_0x47c2d9['query'][_0xb541('0x18')]);}return _0x32d58a[_0xb541('0x49')](_0x1edced);}})[_0xb541('0x22')](function(_0x279269){if(_0x279269){return _0x279269?{'count':_0x36bccd,'rows':_0x279269}:null;}})['then'](respondWithResult(_0x3d9c85,null))[_0xb541('0x40')](handleError(_0x3d9c85,null));};exports['getSubjects']=function(_0x52152a,_0x50950b,_0x144304){var _0x553302={};var _0x9f05ef={};var _0xfc5216;var _0x2c374f;return db[_0xb541('0x29')][_0xb541('0x4a')]({'where':{'id':_0x52152a['params']['id']}})[_0xb541('0x22')](handleEntityNotFound(_0x50950b,null))[_0xb541('0x22')](function(_0x1e15b0){if(_0x1e15b0){_0xfc5216=_0x1e15b0;_0x9f05ef[_0xb541('0x2d')]=_[_0xb541('0x2f')](db[_0xb541('0x4b')]['rawAttributes']);_0x9f05ef['query']=_['keys'](_0x52152a[_0xb541('0x2e')]);_0x9f05ef[_0xb541('0x38')]=_[_0xb541('0x30')](_0x9f05ef['model'],_0x9f05ef[_0xb541('0x2e')]);_0x553302['attributes']=_[_0xb541('0x30')](_0x9f05ef[_0xb541('0x2d')],qs['fields'](_0x52152a[_0xb541('0x2e')][_0xb541('0x32')]));_0x553302[_0xb541('0x31')]=_0x553302['attributes'][_0xb541('0x33')]?_0x553302['attributes']:_0x9f05ef[_0xb541('0x2d')];_0x553302['order']=qs[_0xb541('0x37')](_0x52152a[_0xb541('0x2e')][_0xb541('0x37')]);_0x553302[_0xb541('0x3a')]=qs['filters'](_[_0xb541('0x4c')](_0x52152a[_0xb541('0x2e')],_0x9f05ef['filters']));if(_0x52152a[_0xb541('0x2e')][_0xb541('0x39')]){_0x553302[_0xb541('0x3a')]=_[_0xb541('0x45')](_0x553302[_0xb541('0x3a')],{'$or':_[_0xb541('0x28')](_0x553302[_0xb541('0x31')],function(_0x421cfa){var _0x1beb96={};_0x1beb96[_0x421cfa]={'$like':'%'+_0x52152a[_0xb541('0x2e')][_0xb541('0x39')]+'%'};return _0x1beb96;})});}_0x553302=_[_0xb541('0x45')]({},_0x553302,_0x52152a['options']);return _0xfc5216[_0xb541('0x4d')](_0x553302);}})[_0xb541('0x22')](function(_0x5d0e44){if(_0x5d0e44){_0x2c374f=_0x5d0e44[_0xb541('0x33')];if(!_0x52152a[_0xb541('0x2e')]['hasOwnProperty'](_0xb541('0x35'))){_0x553302['limit']=qs[_0xb541('0x1b')](_0x52152a['query'][_0xb541('0x1b')]);_0x553302[_0xb541('0x18')]=qs[_0xb541('0x18')](_0x52152a['query']['offset']);}return _0xfc5216['getSubjects'](_0x553302);}})[_0xb541('0x22')](function(_0x177ef7){if(_0x177ef7){return _0x177ef7?{'count':_0x2c374f,'rows':_0x177ef7}:null;}})[_0xb541('0x22')](respondWithResult(_0x50950b,null))[_0xb541('0x40')](handleError(_0x50950b,null));};exports[_0xb541('0x4e')]=function(_0x3e1d1c,_0x92e9b9,_0x434163){var _0x53a0dc={};var _0x867e44={};var _0x1271f1;var _0x3d8348;return db[_0xb541('0x29')][_0xb541('0x4a')]({'where':{'id':_0x3e1d1c[_0xb541('0x42')]['id']}})[_0xb541('0x22')](handleEntityNotFound(_0x92e9b9,null))[_0xb541('0x22')](function(_0x32ae56){if(_0x32ae56){_0x1271f1=_0x32ae56;_0x867e44[_0xb541('0x2d')]=_[_0xb541('0x2f')](db['ZendeskField'][_0xb541('0x2a')]);_0x867e44[_0xb541('0x2e')]=_['keys'](_0x3e1d1c['query']);_0x867e44[_0xb541('0x38')]=_[_0xb541('0x30')](_0x867e44[_0xb541('0x2d')],_0x867e44['query']);_0x53a0dc[_0xb541('0x31')]=_[_0xb541('0x30')](_0x867e44[_0xb541('0x2d')],qs['fields'](_0x3e1d1c[_0xb541('0x2e')][_0xb541('0x32')]));_0x53a0dc[_0xb541('0x31')]=_0x53a0dc[_0xb541('0x31')]['length']?_0x53a0dc['attributes']:_0x867e44[_0xb541('0x2d')];_0x53a0dc['order']=qs['sort'](_0x3e1d1c[_0xb541('0x2e')]['sort']);_0x53a0dc[_0xb541('0x3a')]=qs[_0xb541('0x38')](_['pick'](_0x3e1d1c[_0xb541('0x2e')],_0x867e44[_0xb541('0x38')]));if(_0x3e1d1c['query']['filter']){_0x53a0dc[_0xb541('0x3a')]=_[_0xb541('0x45')](_0x53a0dc[_0xb541('0x3a')],{'$or':_[_0xb541('0x28')](_0x53a0dc[_0xb541('0x31')],function(_0x52194e){var _0x14d5bd={};_0x14d5bd[_0x52194e]={'$like':'%'+_0x3e1d1c[_0xb541('0x2e')][_0xb541('0x39')]+'%'};return _0x14d5bd;})});}_0x53a0dc=_[_0xb541('0x45')]({},_0x53a0dc,_0x3e1d1c[_0xb541('0x3d')]);return _0x1271f1[_0xb541('0x4e')](_0x53a0dc);}})[_0xb541('0x22')](function(_0x15001b){if(_0x15001b){_0x3d8348=_0x15001b[_0xb541('0x33')];if(!_0x3e1d1c['query']['hasOwnProperty'](_0xb541('0x35'))){_0x53a0dc['limit']=qs[_0xb541('0x1b')](_0x3e1d1c[_0xb541('0x2e')][_0xb541('0x1b')]);_0x53a0dc[_0xb541('0x18')]=qs['offset'](_0x3e1d1c[_0xb541('0x2e')][_0xb541('0x18')]);}return _0x1271f1[_0xb541('0x4e')](_0x53a0dc);}})['then'](function(_0x4d5357){if(_0x4d5357){return _0x4d5357?{'count':_0x3d8348,'rows':_0x4d5357}:null;}})[_0xb541('0x22')](respondWithResult(_0x92e9b9,null))[_0xb541('0x40')](handleError(_0x92e9b9,null));};exports[_0xb541('0x4f')]=function(_0x31f8d9,_0x55cf8f,_0x2da17a){var _0x5c6ddd={};var _0x1d243a={};var _0x22b3f2;var _0x257ebc;return db[_0xb541('0x29')]['findOne']({'where':{'id':_0x31f8d9['params']['id']}})[_0xb541('0x22')](handleEntityNotFound(_0x55cf8f,null))[_0xb541('0x22')](function(_0x548c3f){if(_0x548c3f){_0x22b3f2=_0x548c3f;_0x1d243a[_0xb541('0x2d')]=_[_0xb541('0x2f')](db[_0xb541('0x50')][_0xb541('0x2a')]);_0x1d243a['query']=_['keys'](_0x31f8d9[_0xb541('0x2e')]);_0x1d243a[_0xb541('0x38')]=_[_0xb541('0x30')](_0x1d243a[_0xb541('0x2d')],_0x1d243a['query']);_0x5c6ddd[_0xb541('0x31')]=_[_0xb541('0x30')](_0x1d243a[_0xb541('0x2d')],qs[_0xb541('0x32')](_0x31f8d9[_0xb541('0x2e')][_0xb541('0x32')]));_0x5c6ddd[_0xb541('0x31')]=_0x5c6ddd['attributes'][_0xb541('0x33')]?_0x5c6ddd[_0xb541('0x31')]:_0x1d243a['model'];_0x5c6ddd[_0xb541('0x36')]=qs[_0xb541('0x37')](_0x31f8d9['query'][_0xb541('0x37')]);_0x5c6ddd[_0xb541('0x3a')]=qs[_0xb541('0x38')](_['pick'](_0x31f8d9['query'],_0x1d243a[_0xb541('0x38')]));if(_0x31f8d9[_0xb541('0x2e')]['filter']){_0x5c6ddd[_0xb541('0x3a')]=_[_0xb541('0x45')](_0x5c6ddd[_0xb541('0x3a')],{'$or':_['map'](_0x5c6ddd[_0xb541('0x31')],function(_0x537a61){var _0x5d24dd={};_0x5d24dd[_0x537a61]={'$like':'%'+_0x31f8d9['query']['filter']+'%'};return _0x5d24dd;})});}_0x5c6ddd=_['merge']({},_0x5c6ddd,_0x31f8d9[_0xb541('0x3d')]);return _0x22b3f2[_0xb541('0x4f')](_0x5c6ddd);}})[_0xb541('0x22')](function(_0x227019){if(_0x227019){_0x257ebc=_0x227019['length'];if(!_0x31f8d9[_0xb541('0x2e')][_0xb541('0x34')](_0xb541('0x35'))){_0x5c6ddd[_0xb541('0x1b')]=qs[_0xb541('0x1b')](_0x31f8d9[_0xb541('0x2e')]['limit']);_0x5c6ddd[_0xb541('0x18')]=qs[_0xb541('0x18')](_0x31f8d9[_0xb541('0x2e')][_0xb541('0x18')]);}return _0x22b3f2[_0xb541('0x4f')](_0x5c6ddd);}})[_0xb541('0x22')](function(_0x1f13ab){if(_0x1f13ab){return _0x1f13ab?{'count':_0x257ebc,'rows':_0x1f13ab}:null;}})[_0xb541('0x22')](respondWithResult(_0x55cf8f,null))[_0xb541('0x40')](handleError(_0x55cf8f,null));};exports[_0xb541('0x51')]=function(_0x4736e8,_0x1ef9aa,_0xb88c2a){if(_0x4736e8[_0xb541('0x48')]['id']){delete _0x4736e8[_0xb541('0x48')]['id'];}return db[_0xb541('0x29')][_0xb541('0x4a')]({'where':{'id':_0x4736e8[_0xb541('0x42')]['id']}})['then'](handleEntityNotFound(_0x1ef9aa,null))[_0xb541('0x22')](function(_0x244c55){if(_0x244c55){return _0x244c55[_0xb541('0x51')](_0x4736e8[_0xb541('0x48')][_0xb541('0x52')]||[]);}return null;})[_0xb541('0x22')](respondWithResult(_0x1ef9aa,null))[_0xb541('0x40')](handleError(_0x1ef9aa,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