Built motion from commit 5b761a7b.|2.5.36
[motion2.git] / server / api / intZendeskConfiguration / intZendeskConfiguration.controller.js
index 38e0c04..46ae2f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf75a=['keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','includeAll','include','findAll','rows','show','params','options','find','create','body','getFields','findOne','ZendeskField','order','pick','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','destroy','name','index','map','ZendeskConfiguration','rawAttributes','type','key','model','query'];(function(_0x38cd9d,_0x13b695){var _0x4f827f=function(_0x22d1af){while(--_0x22d1af){_0x38cd9d['push'](_0x38cd9d['shift']());}};_0x4f827f(++_0x13b695);}(_0xf75a,0x194));var _0xaf75=function(_0x41f745,_0x4b5c4a){_0x41f745=_0x41f745-0x0;var _0x2cbbcb=_0xf75a[_0x41f745];return _0x2cbbcb;};'use strict';var emlformat=require(_0xaf75('0x0'));var rimraf=require(_0xaf75('0x1'));var zipdir=require(_0xaf75('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf75('0x3'));var moment=require('moment');var BPromise=require(_0xaf75('0x4'));var Mustache=require(_0xaf75('0x5'));var util=require('util');var path=require(_0xaf75('0x6'));var sox=require('sox');var csv=require(_0xaf75('0x7'));var ejs=require(_0xaf75('0x8'));var fs=require('fs');var fs_extra=require(_0xaf75('0x9'));var _=require(_0xaf75('0xa'));var squel=require(_0xaf75('0xb'));var crypto=require(_0xaf75('0xc'));var jsforce=require(_0xaf75('0xd'));var deskjs=require(_0xaf75('0xe'));var toCsv=require(_0xaf75('0x7'));var querystring=require(_0xaf75('0xf'));var Papa=require(_0xaf75('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaf75('0x11'));var as=require(_0xaf75('0x12'));var hardwareService=require(_0xaf75('0x13'));var logger=require(_0xaf75('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaf75('0x15'));var db=require(_0xaf75('0x16'))['db'];var jayson=require(_0xaf75('0x17'));var client=jayson[_0xaf75('0x18')][_0xaf75('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x56ca00,_0x41b767,_0x1a3074,_0x2323ba){return new BPromise(function(_0x5e0b2e,_0x575fe9){var _0x2459ba=_0x2323ba||client;return _0x2459ba[_0xaf75('0x1a')](_0x56ca00,_0x1a3074)[_0xaf75('0x1b')](function(_0x5d4f2b){logger[_0xaf75('0x1c')](_0xaf75('0x1d'),_0x41b767,_0xaf75('0x1e'));logger[_0xaf75('0x1f')](_0xaf75('0x20'),_0x41b767,'request\x20sent',JSON[_0xaf75('0x21')](_0x5d4f2b));if(_0x5d4f2b[_0xaf75('0x22')]){if(_0x5d4f2b['error'][_0xaf75('0x23')]===0x1f4){logger[_0xaf75('0x22')]('ZendeskConfiguration,\x20%s,\x20%s',_0x41b767,_0x5d4f2b[_0xaf75('0x22')][_0xaf75('0x24')]);return _0x575fe9(_0x5d4f2b[_0xaf75('0x22')][_0xaf75('0x24')]);}logger[_0xaf75('0x22')](_0xaf75('0x1d'),_0x41b767,_0x5d4f2b[_0xaf75('0x22')]['message']);return _0x5e0b2e(_0x5d4f2b[_0xaf75('0x22')][_0xaf75('0x24')]);}else{logger[_0xaf75('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s',_0x41b767,_0xaf75('0x1e'));_0x5e0b2e(_0x5d4f2b[_0xaf75('0x25')][_0xaf75('0x24')]);}})[_0xaf75('0x26')](function(_0x24d3c5){logger[_0xaf75('0x22')]('ZendeskConfiguration,\x20%s,\x20%s',_0x41b767,_0x24d3c5);_0x575fe9(_0x24d3c5);});});}function respondWithStatusCode(_0x5efdba,_0x45300a){_0x45300a=_0x45300a||0xcc;return function(_0x5126d8){if(_0x5126d8){return _0x5efdba[_0xaf75('0x27')](_0x45300a);}return _0x5efdba[_0xaf75('0x28')](_0x45300a)[_0xaf75('0x29')]();};}function respondWithResult(_0x3eeca7,_0x29e073){_0x29e073=_0x29e073||0xc8;return function(_0x14f8b8){if(_0x14f8b8){return _0x3eeca7[_0xaf75('0x28')](_0x29e073)[_0xaf75('0x2a')](_0x14f8b8);}};}function respondWithFilteredResult(_0x38fb4b,_0x36a222){return function(_0x1731ee){if(_0x1731ee){var _0x2a783b=typeof _0x36a222['offset']===_0xaf75('0x2b')&&typeof _0x36a222[_0xaf75('0x2c')]===_0xaf75('0x2b');var _0x136232=_0x1731ee[_0xaf75('0x2d')];var _0x1013ff=_0x2a783b?0x0:_0x36a222[_0xaf75('0x2e')];var _0x4884e1=_0x2a783b?_0x1731ee[_0xaf75('0x2d')]:_0x36a222['offset']+_0x36a222[_0xaf75('0x2c')];var _0x5e55a1;if(_0x4884e1>=_0x136232){_0x4884e1=_0x136232;_0x5e55a1=0xc8;}else{_0x5e55a1=0xce;}_0x38fb4b[_0xaf75('0x28')](_0x5e55a1);return _0x38fb4b[_0xaf75('0x2f')](_0xaf75('0x30'),_0x1013ff+'-'+_0x4884e1+'/'+_0x136232)['json'](_0x1731ee);}return null;};}function patchUpdates(_0x5d70b9){return function(_0x491add){try{jsonpatch[_0xaf75('0x31')](_0x491add,_0x5d70b9,!![]);}catch(_0x7dff30){return BPromise['reject'](_0x7dff30);}return _0x491add['save']();};}function saveUpdates(_0x2bdb9a,_0x51af18){return function(_0x2715dd){if(_0x2715dd){return _0x2715dd[_0xaf75('0x32')](_0x2bdb9a)[_0xaf75('0x1b')](function(_0x218eba){return _0x218eba;});}return null;};}function removeEntity(_0x46ec35,_0x53436f){return function(_0x21e0ce){if(_0x21e0ce){return _0x21e0ce[_0xaf75('0x33')]()[_0xaf75('0x1b')](function(){_0x46ec35[_0xaf75('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ebbec,_0x21d1ae){return function(_0x28daed){if(!_0x28daed){_0x2ebbec[_0xaf75('0x27')](0x194);}return _0x28daed;};}function handleError(_0x18092d,_0x3633d8){_0x3633d8=_0x3633d8||0x1f4;return function(_0xea1d84){logger['error'](_0xea1d84['stack']);if(_0xea1d84['name']){delete _0xea1d84[_0xaf75('0x34')];}_0x18092d[_0xaf75('0x28')](_0x3633d8)['send'](_0xea1d84);};}exports[_0xaf75('0x35')]=function(_0x16e48a,_0x467dd4){var _0xc3180f={},_0x2bce22={},_0x36a106={'count':0x0,'rows':[]};var _0x4f4b71=_[_0xaf75('0x36')](db[_0xaf75('0x37')][_0xaf75('0x38')],function(_0x5122c6){return{'name':_0x5122c6['fieldName'],'type':_0x5122c6[_0xaf75('0x39')][_0xaf75('0x3a')]};});_0x2bce22[_0xaf75('0x3b')]=_[_0xaf75('0x36')](_0x4f4b71,'name');_0x2bce22[_0xaf75('0x3c')]=_[_0xaf75('0x3d')](_0x16e48a['query']);_0x2bce22['filters']=_[_0xaf75('0x3e')](_0x2bce22[_0xaf75('0x3b')],_0x2bce22[_0xaf75('0x3c')]);_0xc3180f[_0xaf75('0x3f')]=_[_0xaf75('0x3e')](_0x2bce22[_0xaf75('0x3b')],qs[_0xaf75('0x40')](_0x16e48a['query'][_0xaf75('0x40')]));_0xc3180f[_0xaf75('0x3f')]=_0xc3180f[_0xaf75('0x3f')][_0xaf75('0x41')]?_0xc3180f['attributes']:_0x2bce22[_0xaf75('0x3b')];if(!_0x16e48a[_0xaf75('0x3c')][_0xaf75('0x42')](_0xaf75('0x43'))){_0xc3180f[_0xaf75('0x2c')]=qs[_0xaf75('0x2c')](_0x16e48a[_0xaf75('0x3c')][_0xaf75('0x2c')]);_0xc3180f[_0xaf75('0x2e')]=qs[_0xaf75('0x2e')](_0x16e48a[_0xaf75('0x3c')]['offset']);}_0xc3180f['order']=qs[_0xaf75('0x44')](_0x16e48a[_0xaf75('0x3c')]['sort']);_0xc3180f[_0xaf75('0x45')]=qs[_0xaf75('0x46')](_['pick'](_0x16e48a[_0xaf75('0x3c')],_0x2bce22['filters']),_0x4f4b71);if(_0x16e48a[_0xaf75('0x3c')][_0xaf75('0x47')]){_0xc3180f[_0xaf75('0x45')]=_[_0xaf75('0x48')](_0xc3180f['where'],{'$or':_[_0xaf75('0x36')](_0x4f4b71,function(_0x4b252f){if(_0x4b252f['type']!=='VIRTUAL'){var _0x26f698={};_0x26f698[_0x4b252f[_0xaf75('0x34')]]={'$like':'%'+_0x16e48a[_0xaf75('0x3c')][_0xaf75('0x47')]+'%'};return _0x26f698;}})});}_0xc3180f=_['merge']({},_0xc3180f,_0x16e48a['options']);var _0x39c26a={'where':_0xc3180f[_0xaf75('0x45')]};return db['ZendeskConfiguration'][_0xaf75('0x2d')](_0x39c26a)[_0xaf75('0x1b')](function(_0x171b9d){_0x36a106['count']=_0x171b9d;if(_0x16e48a[_0xaf75('0x3c')][_0xaf75('0x49')]){_0xc3180f[_0xaf75('0x4a')]=[{'all':!![]}];}return db[_0xaf75('0x37')][_0xaf75('0x4b')](_0xc3180f);})[_0xaf75('0x1b')](function(_0x244d97){_0x36a106[_0xaf75('0x4c')]=_0x244d97;return _0x36a106;})['then'](respondWithFilteredResult(_0x467dd4,_0xc3180f))[_0xaf75('0x26')](handleError(_0x467dd4,null));};exports[_0xaf75('0x4d')]=function(_0x3a09a6,_0x13a4c3){var _0x47c602={'raw':![],'where':{'id':_0x3a09a6[_0xaf75('0x4e')]['id']}},_0x4aa39c={};_0x4aa39c[_0xaf75('0x3b')]=_['keys'](db['ZendeskConfiguration'][_0xaf75('0x38')]);_0x4aa39c[_0xaf75('0x3c')]=_[_0xaf75('0x3d')](_0x3a09a6[_0xaf75('0x3c')]);_0x4aa39c[_0xaf75('0x46')]=_[_0xaf75('0x3e')](_0x4aa39c[_0xaf75('0x3b')],_0x4aa39c['query']);_0x47c602['attributes']=_['intersection'](_0x4aa39c[_0xaf75('0x3b')],qs[_0xaf75('0x40')](_0x3a09a6['query']['fields']));_0x47c602[_0xaf75('0x3f')]=_0x47c602['attributes'][_0xaf75('0x41')]?_0x47c602[_0xaf75('0x3f')]:_0x4aa39c[_0xaf75('0x3b')];if(_0x3a09a6[_0xaf75('0x3c')][_0xaf75('0x49')]){_0x47c602[_0xaf75('0x4a')]=[{'all':!![]}];}_0x47c602=_[_0xaf75('0x48')]({},_0x47c602,_0x3a09a6[_0xaf75('0x4f')]);return db[_0xaf75('0x37')][_0xaf75('0x50')](_0x47c602)[_0xaf75('0x1b')](handleEntityNotFound(_0x13a4c3,null))[_0xaf75('0x1b')](respondWithResult(_0x13a4c3,null))[_0xaf75('0x26')](handleError(_0x13a4c3,null));};exports[_0xaf75('0x51')]=function(_0x2b2945,_0x3881cf){return db[_0xaf75('0x37')]['create'](_0x2b2945[_0xaf75('0x52')],{})[_0xaf75('0x1b')](respondWithResult(_0x3881cf,0xc9))['catch'](handleError(_0x3881cf,null));};exports[_0xaf75('0x32')]=function(_0x402001,_0x126f12){if(_0x402001[_0xaf75('0x52')]['id']){delete _0x402001['body']['id'];}return db[_0xaf75('0x37')][_0xaf75('0x50')]({'where':{'id':_0x402001[_0xaf75('0x4e')]['id']}})[_0xaf75('0x1b')](handleEntityNotFound(_0x126f12,null))[_0xaf75('0x1b')](saveUpdates(_0x402001['body'],null))[_0xaf75('0x1b')](respondWithResult(_0x126f12,null))[_0xaf75('0x26')](handleError(_0x126f12,null));};exports[_0xaf75('0x33')]=function(_0x3acc78,_0x3aa6c2){return db[_0xaf75('0x37')]['find']({'where':{'id':_0x3acc78[_0xaf75('0x4e')]['id']}})[_0xaf75('0x1b')](handleEntityNotFound(_0x3aa6c2,null))[_0xaf75('0x1b')](removeEntity(_0x3aa6c2,null))[_0xaf75('0x26')](handleError(_0x3aa6c2,null));};exports[_0xaf75('0x53')]=function(_0x2561fa,_0x3b8a10,_0x1dbdb3){var _0x32f999={};var _0x814393={};var _0x5262ab;var _0x1a904e;return db['ZendeskConfiguration'][_0xaf75('0x54')]({'where':{'id':_0x2561fa[_0xaf75('0x4e')]['id']}})[_0xaf75('0x1b')](handleEntityNotFound(_0x3b8a10,null))[_0xaf75('0x1b')](function(_0x74d29d){if(_0x74d29d){_0x5262ab=_0x74d29d;_0x814393['model']=_[_0xaf75('0x3d')](db[_0xaf75('0x55')]['rawAttributes']);_0x814393['query']=_[_0xaf75('0x3d')](_0x2561fa[_0xaf75('0x3c')]);_0x814393[_0xaf75('0x46')]=_[_0xaf75('0x3e')](_0x814393['model'],_0x814393[_0xaf75('0x3c')]);_0x32f999[_0xaf75('0x3f')]=_[_0xaf75('0x3e')](_0x814393['model'],qs[_0xaf75('0x40')](_0x2561fa['query'][_0xaf75('0x40')]));_0x32f999['attributes']=_0x32f999[_0xaf75('0x3f')][_0xaf75('0x41')]?_0x32f999[_0xaf75('0x3f')]:_0x814393[_0xaf75('0x3b')];_0x32f999[_0xaf75('0x56')]=qs[_0xaf75('0x44')](_0x2561fa[_0xaf75('0x3c')][_0xaf75('0x44')]);_0x32f999[_0xaf75('0x45')]=qs[_0xaf75('0x46')](_[_0xaf75('0x57')](_0x2561fa['query'],_0x814393[_0xaf75('0x46')]));if(_0x2561fa[_0xaf75('0x3c')][_0xaf75('0x47')]){_0x32f999['where']=_[_0xaf75('0x48')](_0x32f999[_0xaf75('0x45')],{'$or':_[_0xaf75('0x36')](_0x32f999['attributes'],function(_0x3752b1){var _0x106974={};_0x106974[_0x3752b1]={'$like':'%'+_0x2561fa[_0xaf75('0x3c')]['filter']+'%'};return _0x106974;})});}_0x32f999=_[_0xaf75('0x48')]({},_0x32f999,_0x2561fa['options']);return _0x5262ab['getFields'](_0x32f999);}})[_0xaf75('0x1b')](function(_0x3ddf04){if(_0x3ddf04){_0x1a904e=_0x3ddf04[_0xaf75('0x41')];if(!_0x2561fa[_0xaf75('0x3c')][_0xaf75('0x42')](_0xaf75('0x43'))){_0x32f999[_0xaf75('0x2c')]=qs[_0xaf75('0x2c')](_0x2561fa['query']['limit']);_0x32f999[_0xaf75('0x2e')]=qs['offset'](_0x2561fa[_0xaf75('0x3c')][_0xaf75('0x2e')]);}return _0x5262ab[_0xaf75('0x53')](_0x32f999);}})[_0xaf75('0x1b')](function(_0x320911){if(_0x320911){return _0x320911?{'count':_0x1a904e,'rows':_0x320911}:null;}})[_0xaf75('0x1b')](respondWithResult(_0x3b8a10,null))[_0xaf75('0x26')](handleError(_0x3b8a10,null));};exports[_0xaf75('0x58')]=function(_0x38791c,_0x341428,_0x578236){var _0x40b200={};var _0x5259a7={};var _0x390b04;var _0x14d4ce;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x38791c[_0xaf75('0x4e')]['id']}})[_0xaf75('0x1b')](handleEntityNotFound(_0x341428,null))[_0xaf75('0x1b')](function(_0x4675f4){if(_0x4675f4){_0x390b04=_0x4675f4;_0x5259a7['model']=_['keys'](db['ZendeskField']['rawAttributes']);_0x5259a7['query']=_[_0xaf75('0x3d')](_0x38791c[_0xaf75('0x3c')]);_0x5259a7[_0xaf75('0x46')]=_[_0xaf75('0x3e')](_0x5259a7['model'],_0x5259a7[_0xaf75('0x3c')]);_0x40b200[_0xaf75('0x3f')]=_[_0xaf75('0x3e')](_0x5259a7[_0xaf75('0x3b')],qs[_0xaf75('0x40')](_0x38791c[_0xaf75('0x3c')][_0xaf75('0x40')]));_0x40b200[_0xaf75('0x3f')]=_0x40b200[_0xaf75('0x3f')][_0xaf75('0x41')]?_0x40b200[_0xaf75('0x3f')]:_0x5259a7[_0xaf75('0x3b')];_0x40b200['order']=qs[_0xaf75('0x44')](_0x38791c['query'][_0xaf75('0x44')]);_0x40b200[_0xaf75('0x45')]=qs[_0xaf75('0x46')](_['pick'](_0x38791c[_0xaf75('0x3c')],_0x5259a7[_0xaf75('0x46')]));if(_0x38791c[_0xaf75('0x3c')][_0xaf75('0x47')]){_0x40b200[_0xaf75('0x45')]=_[_0xaf75('0x48')](_0x40b200[_0xaf75('0x45')],{'$or':_[_0xaf75('0x36')](_0x40b200['attributes'],function(_0x125531){var _0x5ecb81={};_0x5ecb81[_0x125531]={'$like':'%'+_0x38791c[_0xaf75('0x3c')][_0xaf75('0x47')]+'%'};return _0x5ecb81;})});}_0x40b200=_[_0xaf75('0x48')]({},_0x40b200,_0x38791c[_0xaf75('0x4f')]);return _0x390b04[_0xaf75('0x58')](_0x40b200);}})[_0xaf75('0x1b')](function(_0x577f45){if(_0x577f45){_0x14d4ce=_0x577f45[_0xaf75('0x41')];if(!_0x38791c['query']['hasOwnProperty'](_0xaf75('0x43'))){_0x40b200[_0xaf75('0x2c')]=qs[_0xaf75('0x2c')](_0x38791c[_0xaf75('0x3c')][_0xaf75('0x2c')]);_0x40b200['offset']=qs[_0xaf75('0x2e')](_0x38791c[_0xaf75('0x3c')]['offset']);}return _0x390b04[_0xaf75('0x58')](_0x40b200);}})[_0xaf75('0x1b')](function(_0x433c03){if(_0x433c03){return _0x433c03?{'count':_0x14d4ce,'rows':_0x433c03}:null;}})['then'](respondWithResult(_0x341428,null))[_0xaf75('0x26')](handleError(_0x341428,null));};exports[_0xaf75('0x59')]=function(_0x188616,_0x5d3191,_0x211459){var _0x3f1353={};var _0x3e8af0={};var _0x27226d;var _0x3afcbf;return db[_0xaf75('0x37')][_0xaf75('0x54')]({'where':{'id':_0x188616[_0xaf75('0x4e')]['id']}})[_0xaf75('0x1b')](handleEntityNotFound(_0x5d3191,null))[_0xaf75('0x1b')](function(_0x3bb968){if(_0x3bb968){_0x27226d=_0x3bb968;_0x3e8af0[_0xaf75('0x3b')]=_[_0xaf75('0x3d')](db['ZendeskField']['rawAttributes']);_0x3e8af0[_0xaf75('0x3c')]=_['keys'](_0x188616['query']);_0x3e8af0['filters']=_[_0xaf75('0x3e')](_0x3e8af0[_0xaf75('0x3b')],_0x3e8af0[_0xaf75('0x3c')]);_0x3f1353['attributes']=_['intersection'](_0x3e8af0[_0xaf75('0x3b')],qs[_0xaf75('0x40')](_0x188616[_0xaf75('0x3c')][_0xaf75('0x40')]));_0x3f1353[_0xaf75('0x3f')]=_0x3f1353[_0xaf75('0x3f')][_0xaf75('0x41')]?_0x3f1353[_0xaf75('0x3f')]:_0x3e8af0[_0xaf75('0x3b')];_0x3f1353[_0xaf75('0x56')]=qs[_0xaf75('0x44')](_0x188616[_0xaf75('0x3c')]['sort']);_0x3f1353['where']=qs[_0xaf75('0x46')](_[_0xaf75('0x57')](_0x188616[_0xaf75('0x3c')],_0x3e8af0[_0xaf75('0x46')]));if(_0x188616[_0xaf75('0x3c')][_0xaf75('0x47')]){_0x3f1353[_0xaf75('0x45')]=_[_0xaf75('0x48')](_0x3f1353['where'],{'$or':_['map'](_0x3f1353['attributes'],function(_0x4abd07){var _0x5f4c25={};_0x5f4c25[_0x4abd07]={'$like':'%'+_0x188616['query'][_0xaf75('0x47')]+'%'};return _0x5f4c25;})});}_0x3f1353=_['merge']({},_0x3f1353,_0x188616['options']);return _0x27226d[_0xaf75('0x59')](_0x3f1353);}})[_0xaf75('0x1b')](function(_0x2900f7){if(_0x2900f7){_0x3afcbf=_0x2900f7['length'];if(!_0x188616['query']['hasOwnProperty'](_0xaf75('0x43'))){_0x3f1353['limit']=qs['limit'](_0x188616['query']['limit']);_0x3f1353[_0xaf75('0x2e')]=qs[_0xaf75('0x2e')](_0x188616[_0xaf75('0x3c')][_0xaf75('0x2e')]);}return _0x27226d['getDescriptions'](_0x3f1353);}})[_0xaf75('0x1b')](function(_0x1d25e1){if(_0x1d25e1){return _0x1d25e1?{'count':_0x3afcbf,'rows':_0x1d25e1}:null;}})[_0xaf75('0x1b')](respondWithResult(_0x5d3191,null))['catch'](handleError(_0x5d3191,null));};exports[_0xaf75('0x5a')]=function(_0x2186a4,_0xdf8497,_0x2df374){var _0x1d6208={};var _0x294a41={};var _0x5172d9;var _0x57716a;return db['ZendeskConfiguration'][_0xaf75('0x54')]({'where':{'id':_0x2186a4['params']['id']}})['then'](handleEntityNotFound(_0xdf8497,null))['then'](function(_0x5c1feb){if(_0x5c1feb){_0x5172d9=_0x5c1feb;_0x294a41[_0xaf75('0x3b')]=_[_0xaf75('0x3d')](db['Tag']['rawAttributes']);_0x294a41[_0xaf75('0x3c')]=_[_0xaf75('0x3d')](_0x2186a4[_0xaf75('0x3c')]);_0x294a41['filters']=_[_0xaf75('0x3e')](_0x294a41[_0xaf75('0x3b')],_0x294a41['query']);_0x1d6208[_0xaf75('0x3f')]=_['intersection'](_0x294a41[_0xaf75('0x3b')],qs['fields'](_0x2186a4[_0xaf75('0x3c')]['fields']));_0x1d6208[_0xaf75('0x3f')]=_0x1d6208[_0xaf75('0x3f')]['length']?_0x1d6208[_0xaf75('0x3f')]:_0x294a41[_0xaf75('0x3b')];_0x1d6208['order']=qs[_0xaf75('0x44')](_0x2186a4[_0xaf75('0x3c')][_0xaf75('0x44')]);_0x1d6208['where']=qs[_0xaf75('0x46')](_['pick'](_0x2186a4['query'],_0x294a41[_0xaf75('0x46')]));if(_0x2186a4[_0xaf75('0x3c')][_0xaf75('0x47')]){_0x1d6208['where']=_[_0xaf75('0x48')](_0x1d6208[_0xaf75('0x45')],{'$or':_[_0xaf75('0x36')](_0x1d6208['attributes'],function(_0x1904f4){var _0x5d083a={};_0x5d083a[_0x1904f4]={'$like':'%'+_0x2186a4['query'][_0xaf75('0x47')]+'%'};return _0x5d083a;})});}_0x1d6208=_[_0xaf75('0x48')]({},_0x1d6208,_0x2186a4[_0xaf75('0x4f')]);return _0x5172d9[_0xaf75('0x5a')](_0x1d6208);}})['then'](function(_0x26d084){if(_0x26d084){_0x57716a=_0x26d084[_0xaf75('0x41')];if(!_0x2186a4[_0xaf75('0x3c')][_0xaf75('0x42')]('nolimit')){_0x1d6208[_0xaf75('0x2c')]=qs[_0xaf75('0x2c')](_0x2186a4[_0xaf75('0x3c')][_0xaf75('0x2c')]);_0x1d6208[_0xaf75('0x2e')]=qs['offset'](_0x2186a4[_0xaf75('0x3c')]['offset']);}return _0x5172d9[_0xaf75('0x5a')](_0x1d6208);}})[_0xaf75('0x1b')](function(_0x1c0985){if(_0x1c0985){return _0x1c0985?{'count':_0x57716a,'rows':_0x1c0985}:null;}})['then'](respondWithResult(_0xdf8497,null))['catch'](handleError(_0xdf8497,null));};exports[_0xaf75('0x5b')]=function(_0x4dfac7,_0xe097dc,_0x313cc2){if(_0x4dfac7['body']['id']){delete _0x4dfac7[_0xaf75('0x52')]['id'];}return db[_0xaf75('0x37')]['findOne']({'where':{'id':_0x4dfac7['params']['id']}})[_0xaf75('0x1b')](handleEntityNotFound(_0xe097dc,null))[_0xaf75('0x1b')](function(_0x47b559){if(_0x47b559){return _0x47b559[_0xaf75('0x5b')](_0x4dfac7[_0xaf75('0x52')][_0xaf75('0x5c')]||[]);}return null;})[_0xaf75('0x1b')](respondWithResult(_0xe097dc,null))['catch'](handleError(_0xe097dc,null));};
\ No newline at end of file
+var _0x0fc2=['save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','params','find','create','body','getFields','ZendeskField','options','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','set','json','apply','reject'];(function(_0x24588b,_0x476aa4){var _0x175178=function(_0x3455d1){while(--_0x3455d1){_0x24588b['push'](_0x24588b['shift']());}};_0x175178(++_0x476aa4);}(_0x0fc2,0x133));var _0x20fc=function(_0xb807c3,_0x350d96){_0xb807c3=_0xb807c3-0x0;var _0x3139d6=_0x0fc2[_0xb807c3];return _0x3139d6;};'use strict';var emlformat=require(_0x20fc('0x0'));var rimraf=require(_0x20fc('0x1'));var zipdir=require(_0x20fc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x20fc('0x3'));var moment=require('moment');var BPromise=require(_0x20fc('0x4'));var Mustache=require(_0x20fc('0x5'));var util=require(_0x20fc('0x6'));var path=require(_0x20fc('0x7'));var sox=require(_0x20fc('0x8'));var csv=require('to-csv');var ejs=require(_0x20fc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x20fc('0xa'));var squel=require(_0x20fc('0xb'));var crypto=require(_0x20fc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x20fc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x20fc('0xe'));var Papa=require(_0x20fc('0xf'));var Redis=require('ioredis');var authService=require(_0x20fc('0x10'));var qs=require(_0x20fc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20fc('0x12'));var logger=require(_0x20fc('0x13'))(_0x20fc('0x14'));var utils=require(_0x20fc('0x15'));var config=require(_0x20fc('0x16'));var licenseUtil=require(_0x20fc('0x17'));var db=require(_0x20fc('0x18'))['db'];function respondWithStatusCode(_0x4e7329,_0x13aa68){_0x13aa68=_0x13aa68||0xcc;return function(_0x3a269f){if(_0x3a269f){return _0x4e7329['sendStatus'](_0x13aa68);}return _0x4e7329[_0x20fc('0x19')](_0x13aa68)['end']();};}function respondWithResult(_0x91f6ab,_0x30a84b){_0x30a84b=_0x30a84b||0xc8;return function(_0x6610e3){if(_0x6610e3){return _0x91f6ab[_0x20fc('0x19')](_0x30a84b)['json'](_0x6610e3);}};}function respondWithFilteredResult(_0x590331,_0x495721){return function(_0x239405){if(_0x239405){var _0x5e730c=typeof _0x495721[_0x20fc('0x1a')]===_0x20fc('0x1b')&&typeof _0x495721['limit']===_0x20fc('0x1b');var _0x11ddc5=_0x239405[_0x20fc('0x1c')];var _0x3e1d33=_0x5e730c?0x0:_0x495721[_0x20fc('0x1a')];var _0x11b57c=_0x5e730c?_0x239405[_0x20fc('0x1c')]:_0x495721[_0x20fc('0x1a')]+_0x495721['limit'];var _0x4ed2b7;if(_0x11b57c>=_0x11ddc5){_0x11b57c=_0x11ddc5;_0x4ed2b7=0xc8;}else{_0x4ed2b7=0xce;}_0x590331['status'](_0x4ed2b7);return _0x590331[_0x20fc('0x1d')]('Content-Range',_0x3e1d33+'-'+_0x11b57c+'/'+_0x11ddc5)[_0x20fc('0x1e')](_0x239405);}return null;};}function patchUpdates(_0x652d53){return function(_0x2fcb21){try{jsonpatch[_0x20fc('0x1f')](_0x2fcb21,_0x652d53,!![]);}catch(_0x5ab897){return BPromise[_0x20fc('0x20')](_0x5ab897);}return _0x2fcb21[_0x20fc('0x21')]();};}function saveUpdates(_0x1f700e,_0xbcd7b0){return function(_0xf42a0f){if(_0xf42a0f){return _0xf42a0f[_0x20fc('0x22')](_0x1f700e)['then'](function(_0x18c198){return _0x18c198;});}return null;};}function removeEntity(_0x174810,_0x2dbe78){return function(_0x729d43){if(_0x729d43){return _0x729d43[_0x20fc('0x23')]()[_0x20fc('0x24')](function(){_0x174810[_0x20fc('0x19')](0xcc)[_0x20fc('0x25')]();});}};}function handleEntityNotFound(_0x581d91,_0x19c93a){return function(_0x5b68e7){if(!_0x5b68e7){_0x581d91[_0x20fc('0x26')](0x194);}return _0x5b68e7;};}function handleError(_0xac6452,_0x2347f4){_0x2347f4=_0x2347f4||0x1f4;return function(_0x1b36ac){logger[_0x20fc('0x27')](_0x1b36ac[_0x20fc('0x28')]);if(_0x1b36ac[_0x20fc('0x29')]){delete _0x1b36ac['name'];}_0xac6452['status'](_0x2347f4)[_0x20fc('0x2a')](_0x1b36ac);};}exports[_0x20fc('0x2b')]=function(_0x296f18,_0x7d0ed9){var _0x395952={},_0x39c746={},_0x3a0346={'count':0x0,'rows':[]};var _0xad27a=_[_0x20fc('0x2c')](db[_0x20fc('0x2d')][_0x20fc('0x2e')],function(_0x5e843a){return{'name':_0x5e843a[_0x20fc('0x2f')],'type':_0x5e843a['type']['key']};});_0x39c746[_0x20fc('0x30')]=_['map'](_0xad27a,_0x20fc('0x29'));_0x39c746[_0x20fc('0x31')]=_[_0x20fc('0x32')](_0x296f18[_0x20fc('0x31')]);_0x39c746[_0x20fc('0x33')]=_[_0x20fc('0x34')](_0x39c746['model'],_0x39c746[_0x20fc('0x31')]);_0x395952[_0x20fc('0x35')]=_[_0x20fc('0x34')](_0x39c746['model'],qs[_0x20fc('0x36')](_0x296f18['query'][_0x20fc('0x36')]));_0x395952[_0x20fc('0x35')]=_0x395952['attributes'][_0x20fc('0x37')]?_0x395952['attributes']:_0x39c746[_0x20fc('0x30')];if(!_0x296f18['query'][_0x20fc('0x38')](_0x20fc('0x39'))){_0x395952[_0x20fc('0x3a')]=qs[_0x20fc('0x3a')](_0x296f18['query'][_0x20fc('0x3a')]);_0x395952[_0x20fc('0x1a')]=qs[_0x20fc('0x1a')](_0x296f18[_0x20fc('0x31')][_0x20fc('0x1a')]);}_0x395952[_0x20fc('0x3b')]=qs[_0x20fc('0x3c')](_0x296f18['query'][_0x20fc('0x3c')]);_0x395952[_0x20fc('0x3d')]=qs[_0x20fc('0x33')](_[_0x20fc('0x3e')](_0x296f18['query'],_0x39c746['filters']),_0xad27a);if(_0x296f18['query'][_0x20fc('0x3f')]){_0x395952[_0x20fc('0x3d')]=_[_0x20fc('0x40')](_0x395952[_0x20fc('0x3d')],{'$or':_['map'](_0xad27a,function(_0x4d46d7){if(_0x4d46d7[_0x20fc('0x41')]!==_0x20fc('0x42')){var _0x36f302={};_0x36f302[_0x4d46d7[_0x20fc('0x29')]]={'$like':'%'+_0x296f18[_0x20fc('0x31')][_0x20fc('0x3f')]+'%'};return _0x36f302;}})});}_0x395952=_['merge']({},_0x395952,_0x296f18['options']);var _0x1b2505={'where':_0x395952[_0x20fc('0x3d')]};return db[_0x20fc('0x2d')]['count'](_0x1b2505)[_0x20fc('0x24')](function(_0x138abf){_0x3a0346[_0x20fc('0x1c')]=_0x138abf;if(_0x296f18['query'][_0x20fc('0x43')]){_0x395952['include']=[{'all':!![]}];}return db[_0x20fc('0x2d')][_0x20fc('0x44')](_0x395952);})['then'](function(_0xcda39d){_0x3a0346[_0x20fc('0x45')]=_0xcda39d;return _0x3a0346;})[_0x20fc('0x24')](respondWithFilteredResult(_0x7d0ed9,_0x395952))[_0x20fc('0x46')](handleError(_0x7d0ed9,null));};exports['show']=function(_0x24a9a6,_0x38db52){var _0x1e7890={'raw':![],'where':{'id':_0x24a9a6[_0x20fc('0x47')]['id']}},_0x5be93d={};_0x5be93d[_0x20fc('0x30')]=_['keys'](db[_0x20fc('0x2d')]['rawAttributes']);_0x5be93d[_0x20fc('0x31')]=_[_0x20fc('0x32')](_0x24a9a6[_0x20fc('0x31')]);_0x5be93d[_0x20fc('0x33')]=_['intersection'](_0x5be93d[_0x20fc('0x30')],_0x5be93d[_0x20fc('0x31')]);_0x1e7890['attributes']=_[_0x20fc('0x34')](_0x5be93d[_0x20fc('0x30')],qs[_0x20fc('0x36')](_0x24a9a6[_0x20fc('0x31')][_0x20fc('0x36')]));_0x1e7890[_0x20fc('0x35')]=_0x1e7890[_0x20fc('0x35')]['length']?_0x1e7890[_0x20fc('0x35')]:_0x5be93d['model'];if(_0x24a9a6[_0x20fc('0x31')][_0x20fc('0x43')]){_0x1e7890['include']=[{'all':!![]}];}_0x1e7890=_[_0x20fc('0x40')]({},_0x1e7890,_0x24a9a6['options']);return db[_0x20fc('0x2d')][_0x20fc('0x48')](_0x1e7890)[_0x20fc('0x24')](handleEntityNotFound(_0x38db52,null))[_0x20fc('0x24')](respondWithResult(_0x38db52,null))[_0x20fc('0x46')](handleError(_0x38db52,null));};exports[_0x20fc('0x49')]=function(_0x55f2ab,_0x710954){return db[_0x20fc('0x2d')]['create'](_0x55f2ab['body'],{})[_0x20fc('0x24')](respondWithResult(_0x710954,0xc9))['catch'](handleError(_0x710954,null));};exports[_0x20fc('0x22')]=function(_0x4f3d4d,_0x2ad9ed){if(_0x4f3d4d[_0x20fc('0x4a')]['id']){delete _0x4f3d4d[_0x20fc('0x4a')]['id'];}return db['ZendeskConfiguration'][_0x20fc('0x48')]({'where':{'id':_0x4f3d4d[_0x20fc('0x47')]['id']}})[_0x20fc('0x24')](handleEntityNotFound(_0x2ad9ed,null))[_0x20fc('0x24')](saveUpdates(_0x4f3d4d[_0x20fc('0x4a')],null))['then'](respondWithResult(_0x2ad9ed,null))[_0x20fc('0x46')](handleError(_0x2ad9ed,null));};exports[_0x20fc('0x23')]=function(_0xe2cfab,_0x210276){return db[_0x20fc('0x2d')][_0x20fc('0x48')]({'where':{'id':_0xe2cfab[_0x20fc('0x47')]['id']}})[_0x20fc('0x24')](handleEntityNotFound(_0x210276,null))[_0x20fc('0x24')](removeEntity(_0x210276,null))['catch'](handleError(_0x210276,null));};exports[_0x20fc('0x4b')]=function(_0x287d29,_0x5383d6,_0x1a1455){var _0x124530={};var _0x54bcb6={};var _0x138fe5;var _0x5a07a6;return db[_0x20fc('0x2d')]['findOne']({'where':{'id':_0x287d29[_0x20fc('0x47')]['id']}})[_0x20fc('0x24')](handleEntityNotFound(_0x5383d6,null))[_0x20fc('0x24')](function(_0x4211b4){if(_0x4211b4){_0x138fe5=_0x4211b4;_0x54bcb6['model']=_['keys'](db[_0x20fc('0x4c')][_0x20fc('0x2e')]);_0x54bcb6[_0x20fc('0x31')]=_[_0x20fc('0x32')](_0x287d29[_0x20fc('0x31')]);_0x54bcb6['filters']=_[_0x20fc('0x34')](_0x54bcb6[_0x20fc('0x30')],_0x54bcb6['query']);_0x124530[_0x20fc('0x35')]=_[_0x20fc('0x34')](_0x54bcb6[_0x20fc('0x30')],qs[_0x20fc('0x36')](_0x287d29[_0x20fc('0x31')][_0x20fc('0x36')]));_0x124530[_0x20fc('0x35')]=_0x124530[_0x20fc('0x35')][_0x20fc('0x37')]?_0x124530[_0x20fc('0x35')]:_0x54bcb6[_0x20fc('0x30')];_0x124530['order']=qs[_0x20fc('0x3c')](_0x287d29[_0x20fc('0x31')]['sort']);_0x124530['where']=qs[_0x20fc('0x33')](_['pick'](_0x287d29[_0x20fc('0x31')],_0x54bcb6[_0x20fc('0x33')]));if(_0x287d29['query']['filter']){_0x124530[_0x20fc('0x3d')]=_[_0x20fc('0x40')](_0x124530[_0x20fc('0x3d')],{'$or':_[_0x20fc('0x2c')](_0x124530[_0x20fc('0x35')],function(_0x93302){var _0x5d8c02={};_0x5d8c02[_0x93302]={'$like':'%'+_0x287d29[_0x20fc('0x31')][_0x20fc('0x3f')]+'%'};return _0x5d8c02;})});}_0x124530=_[_0x20fc('0x40')]({},_0x124530,_0x287d29[_0x20fc('0x4d')]);return _0x138fe5[_0x20fc('0x4b')](_0x124530);}})[_0x20fc('0x24')](function(_0x5e339b){if(_0x5e339b){_0x5a07a6=_0x5e339b[_0x20fc('0x37')];if(!_0x287d29[_0x20fc('0x31')][_0x20fc('0x38')](_0x20fc('0x39'))){_0x124530[_0x20fc('0x3a')]=qs[_0x20fc('0x3a')](_0x287d29[_0x20fc('0x31')][_0x20fc('0x3a')]);_0x124530[_0x20fc('0x1a')]=qs[_0x20fc('0x1a')](_0x287d29['query'][_0x20fc('0x1a')]);}return _0x138fe5['getFields'](_0x124530);}})[_0x20fc('0x24')](function(_0xba4654){if(_0xba4654){return _0xba4654?{'count':_0x5a07a6,'rows':_0xba4654}:null;}})['then'](respondWithResult(_0x5383d6,null))['catch'](handleError(_0x5383d6,null));};exports[_0x20fc('0x4e')]=function(_0x1495f6,_0x5ce969,_0x521531){var _0xf43e9c={};var _0x13f17c={};var _0x17925f;var _0x5eac18;return db[_0x20fc('0x2d')]['findOne']({'where':{'id':_0x1495f6[_0x20fc('0x47')]['id']}})[_0x20fc('0x24')](handleEntityNotFound(_0x5ce969,null))[_0x20fc('0x24')](function(_0x5ec4b5){if(_0x5ec4b5){_0x17925f=_0x5ec4b5;_0x13f17c[_0x20fc('0x30')]=_[_0x20fc('0x32')](db[_0x20fc('0x4c')][_0x20fc('0x2e')]);_0x13f17c[_0x20fc('0x31')]=_[_0x20fc('0x32')](_0x1495f6[_0x20fc('0x31')]);_0x13f17c['filters']=_[_0x20fc('0x34')](_0x13f17c[_0x20fc('0x30')],_0x13f17c['query']);_0xf43e9c['attributes']=_[_0x20fc('0x34')](_0x13f17c[_0x20fc('0x30')],qs[_0x20fc('0x36')](_0x1495f6[_0x20fc('0x31')][_0x20fc('0x36')]));_0xf43e9c['attributes']=_0xf43e9c['attributes'][_0x20fc('0x37')]?_0xf43e9c[_0x20fc('0x35')]:_0x13f17c[_0x20fc('0x30')];_0xf43e9c['order']=qs[_0x20fc('0x3c')](_0x1495f6[_0x20fc('0x31')][_0x20fc('0x3c')]);_0xf43e9c['where']=qs['filters'](_['pick'](_0x1495f6[_0x20fc('0x31')],_0x13f17c['filters']));if(_0x1495f6[_0x20fc('0x31')]['filter']){_0xf43e9c['where']=_[_0x20fc('0x40')](_0xf43e9c[_0x20fc('0x3d')],{'$or':_[_0x20fc('0x2c')](_0xf43e9c['attributes'],function(_0x310ae1){var _0x439e22={};_0x439e22[_0x310ae1]={'$like':'%'+_0x1495f6[_0x20fc('0x31')][_0x20fc('0x3f')]+'%'};return _0x439e22;})});}_0xf43e9c=_[_0x20fc('0x40')]({},_0xf43e9c,_0x1495f6[_0x20fc('0x4d')]);return _0x17925f[_0x20fc('0x4e')](_0xf43e9c);}})[_0x20fc('0x24')](function(_0xa9c60b){if(_0xa9c60b){_0x5eac18=_0xa9c60b[_0x20fc('0x37')];if(!_0x1495f6['query'][_0x20fc('0x38')](_0x20fc('0x39'))){_0xf43e9c[_0x20fc('0x3a')]=qs['limit'](_0x1495f6['query'][_0x20fc('0x3a')]);_0xf43e9c['offset']=qs[_0x20fc('0x1a')](_0x1495f6[_0x20fc('0x31')][_0x20fc('0x1a')]);}return _0x17925f[_0x20fc('0x4e')](_0xf43e9c);}})['then'](function(_0x2e309f){if(_0x2e309f){return _0x2e309f?{'count':_0x5eac18,'rows':_0x2e309f}:null;}})[_0x20fc('0x24')](respondWithResult(_0x5ce969,null))[_0x20fc('0x46')](handleError(_0x5ce969,null));};exports['getDescriptions']=function(_0x38ac8d,_0x422ae0,_0x13bae0){var _0x4ac273={};var _0x22c827={};var _0x117332;var _0x47a40f;return db[_0x20fc('0x2d')][_0x20fc('0x4f')]({'where':{'id':_0x38ac8d[_0x20fc('0x47')]['id']}})[_0x20fc('0x24')](handleEntityNotFound(_0x422ae0,null))[_0x20fc('0x24')](function(_0x1f8f58){if(_0x1f8f58){_0x117332=_0x1f8f58;_0x22c827[_0x20fc('0x30')]=_[_0x20fc('0x32')](db[_0x20fc('0x4c')][_0x20fc('0x2e')]);_0x22c827[_0x20fc('0x31')]=_[_0x20fc('0x32')](_0x38ac8d[_0x20fc('0x31')]);_0x22c827['filters']=_[_0x20fc('0x34')](_0x22c827[_0x20fc('0x30')],_0x22c827['query']);_0x4ac273['attributes']=_['intersection'](_0x22c827[_0x20fc('0x30')],qs[_0x20fc('0x36')](_0x38ac8d['query'][_0x20fc('0x36')]));_0x4ac273['attributes']=_0x4ac273[_0x20fc('0x35')]['length']?_0x4ac273[_0x20fc('0x35')]:_0x22c827[_0x20fc('0x30')];_0x4ac273[_0x20fc('0x3b')]=qs[_0x20fc('0x3c')](_0x38ac8d['query'][_0x20fc('0x3c')]);_0x4ac273[_0x20fc('0x3d')]=qs[_0x20fc('0x33')](_[_0x20fc('0x3e')](_0x38ac8d[_0x20fc('0x31')],_0x22c827[_0x20fc('0x33')]));if(_0x38ac8d[_0x20fc('0x31')]['filter']){_0x4ac273[_0x20fc('0x3d')]=_[_0x20fc('0x40')](_0x4ac273[_0x20fc('0x3d')],{'$or':_[_0x20fc('0x2c')](_0x4ac273[_0x20fc('0x35')],function(_0x51ee7d){var _0x55cbd1={};_0x55cbd1[_0x51ee7d]={'$like':'%'+_0x38ac8d[_0x20fc('0x31')]['filter']+'%'};return _0x55cbd1;})});}_0x4ac273=_['merge']({},_0x4ac273,_0x38ac8d[_0x20fc('0x4d')]);return _0x117332[_0x20fc('0x50')](_0x4ac273);}})[_0x20fc('0x24')](function(_0x303ec6){if(_0x303ec6){_0x47a40f=_0x303ec6[_0x20fc('0x37')];if(!_0x38ac8d[_0x20fc('0x31')][_0x20fc('0x38')](_0x20fc('0x39'))){_0x4ac273['limit']=qs['limit'](_0x38ac8d[_0x20fc('0x31')][_0x20fc('0x3a')]);_0x4ac273['offset']=qs[_0x20fc('0x1a')](_0x38ac8d['query'][_0x20fc('0x1a')]);}return _0x117332[_0x20fc('0x50')](_0x4ac273);}})[_0x20fc('0x24')](function(_0x44f471){if(_0x44f471){return _0x44f471?{'count':_0x47a40f,'rows':_0x44f471}:null;}})[_0x20fc('0x24')](respondWithResult(_0x422ae0,null))[_0x20fc('0x46')](handleError(_0x422ae0,null));};exports[_0x20fc('0x51')]=function(_0x18cad1,_0xcc39b0,_0x8b02d9){var _0x4c3e9d={};var _0x366367={};var _0x3be80a;var _0x58f7b6;return db[_0x20fc('0x2d')]['findOne']({'where':{'id':_0x18cad1['params']['id']}})[_0x20fc('0x24')](handleEntityNotFound(_0xcc39b0,null))[_0x20fc('0x24')](function(_0x5b3b21){if(_0x5b3b21){_0x3be80a=_0x5b3b21;_0x366367[_0x20fc('0x30')]=_['keys'](db[_0x20fc('0x52')][_0x20fc('0x2e')]);_0x366367[_0x20fc('0x31')]=_[_0x20fc('0x32')](_0x18cad1[_0x20fc('0x31')]);_0x366367[_0x20fc('0x33')]=_[_0x20fc('0x34')](_0x366367[_0x20fc('0x30')],_0x366367[_0x20fc('0x31')]);_0x4c3e9d[_0x20fc('0x35')]=_[_0x20fc('0x34')](_0x366367[_0x20fc('0x30')],qs['fields'](_0x18cad1[_0x20fc('0x31')][_0x20fc('0x36')]));_0x4c3e9d[_0x20fc('0x35')]=_0x4c3e9d[_0x20fc('0x35')][_0x20fc('0x37')]?_0x4c3e9d[_0x20fc('0x35')]:_0x366367['model'];_0x4c3e9d[_0x20fc('0x3b')]=qs[_0x20fc('0x3c')](_0x18cad1[_0x20fc('0x31')][_0x20fc('0x3c')]);_0x4c3e9d[_0x20fc('0x3d')]=qs['filters'](_['pick'](_0x18cad1[_0x20fc('0x31')],_0x366367['filters']));if(_0x18cad1[_0x20fc('0x31')][_0x20fc('0x3f')]){_0x4c3e9d[_0x20fc('0x3d')]=_['merge'](_0x4c3e9d[_0x20fc('0x3d')],{'$or':_[_0x20fc('0x2c')](_0x4c3e9d['attributes'],function(_0x28d292){var _0x5aefa7={};_0x5aefa7[_0x28d292]={'$like':'%'+_0x18cad1[_0x20fc('0x31')][_0x20fc('0x3f')]+'%'};return _0x5aefa7;})});}_0x4c3e9d=_[_0x20fc('0x40')]({},_0x4c3e9d,_0x18cad1[_0x20fc('0x4d')]);return _0x3be80a['getTags'](_0x4c3e9d);}})[_0x20fc('0x24')](function(_0x28ddad){if(_0x28ddad){_0x58f7b6=_0x28ddad[_0x20fc('0x37')];if(!_0x18cad1[_0x20fc('0x31')][_0x20fc('0x38')]('nolimit')){_0x4c3e9d[_0x20fc('0x3a')]=qs[_0x20fc('0x3a')](_0x18cad1[_0x20fc('0x31')][_0x20fc('0x3a')]);_0x4c3e9d[_0x20fc('0x1a')]=qs[_0x20fc('0x1a')](_0x18cad1[_0x20fc('0x31')][_0x20fc('0x1a')]);}return _0x3be80a[_0x20fc('0x51')](_0x4c3e9d);}})['then'](function(_0x288cf1){if(_0x288cf1){return _0x288cf1?{'count':_0x58f7b6,'rows':_0x288cf1}:null;}})[_0x20fc('0x24')](respondWithResult(_0xcc39b0,null))[_0x20fc('0x46')](handleError(_0xcc39b0,null));};exports['setTags']=function(_0x4b1008,_0x555366,_0x298fa1){if(_0x4b1008[_0x20fc('0x4a')]['id']){delete _0x4b1008['body']['id'];}return db[_0x20fc('0x2d')][_0x20fc('0x4f')]({'where':{'id':_0x4b1008[_0x20fc('0x47')]['id']}})[_0x20fc('0x24')](handleEntityNotFound(_0x555366,null))[_0x20fc('0x24')](function(_0x26b580){if(_0x26b580){return _0x26b580[_0x20fc('0x53')](_0x4b1008[_0x20fc('0x4a')][_0x20fc('0x54')]||[]);}return null;})[_0x20fc('0x24')](respondWithResult(_0x555366,null))[_0x20fc('0x46')](handleError(_0x555366,null));};
\ No newline at end of file