7ff2558a96bc48354130cee03f29e0a1bf107b26
[motion2.git] / server / api / intZendeskConfiguration / intZendeskConfiguration.controller.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x19f3=['zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','ZendeskConfiguration','rawAttributes','type','key','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format'];(function(_0xbb4964,_0x2424c0){var _0x31b07c=function(_0x28ca61){while(--_0x28ca61){_0xbb4964['push'](_0xbb4964['shift']());}};_0x31b07c(++_0x2424c0);}(_0x19f3,0xf5));var _0x319f=function(_0x1ad07b,_0x551d55){_0x1ad07b=_0x1ad07b-0x0;var _0x2c447f=_0x19f3[_0x1ad07b];return _0x2c447f;};'use strict';var emlformat=require(_0x319f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x319f('0x1'));var jsonpatch=require(_0x319f('0x2'));var rp=require(_0x319f('0x3'));var moment=require(_0x319f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x319f('0x5'));var util=require('util');var path=require(_0x319f('0x6'));var sox=require(_0x319f('0x7'));var csv=require(_0x319f('0x8'));var ejs=require(_0x319f('0x9'));var fs=require('fs');var fs_extra=require(_0x319f('0xa'));var _=require('lodash');var squel=require(_0x319f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x319f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x319f('0xd'));var Papa=require(_0x319f('0xe'));var Redis=require(_0x319f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x319f('0x10'));var as=require(_0x319f('0x11'));var hardwareService=require(_0x319f('0x12'));var logger=require(_0x319f('0x13'))(_0x319f('0x14'));var utils=require('../../config/utils');var config=require(_0x319f('0x15'));var licenseUtil=require(_0x319f('0x16'));var db=require(_0x319f('0x17'))['db'];function respondWithStatusCode(_0x5cf16e,_0x1e617d){_0x1e617d=_0x1e617d||0xcc;return function(_0x39c599){if(_0x39c599){return _0x5cf16e['sendStatus'](_0x1e617d);}return _0x5cf16e[_0x319f('0x18')](_0x1e617d)['end']();};}function respondWithResult(_0x107412,_0x257ac8){_0x257ac8=_0x257ac8||0xc8;return function(_0x1f3f09){if(_0x1f3f09){return _0x107412[_0x319f('0x18')](_0x257ac8)[_0x319f('0x19')](_0x1f3f09);}};}function respondWithFilteredResult(_0x1b0767,_0x314789){return function(_0x3bc5f9){if(_0x3bc5f9){var _0x10702f=typeof _0x314789['offset']===_0x319f('0x1a')&&typeof _0x314789[_0x319f('0x1b')]===_0x319f('0x1a');var _0xcb7ede=_0x3bc5f9[_0x319f('0x1c')];var _0x512c07=_0x10702f?0x0:_0x314789['offset'];var _0x23eeab=_0x10702f?_0x3bc5f9[_0x319f('0x1c')]:_0x314789[_0x319f('0x1d')]+_0x314789['limit'];var _0x2a3466;if(_0x23eeab>=_0xcb7ede){_0x23eeab=_0xcb7ede;_0x2a3466=0xc8;}else{_0x2a3466=0xce;}_0x1b0767['status'](_0x2a3466);return _0x1b0767[_0x319f('0x1e')]('Content-Range',_0x512c07+'-'+_0x23eeab+'/'+_0xcb7ede)['json'](_0x3bc5f9);}return null;};}function patchUpdates(_0x1427fe){return function(_0x1e960d){try{jsonpatch[_0x319f('0x1f')](_0x1e960d,_0x1427fe,!![]);}catch(_0x255e3d){return BPromise[_0x319f('0x20')](_0x255e3d);}return _0x1e960d[_0x319f('0x21')]();};}function saveUpdates(_0x549720,_0xb6bb9){return function(_0x2de9cf){if(_0x2de9cf){return _0x2de9cf[_0x319f('0x22')](_0x549720)[_0x319f('0x23')](function(_0x2befd4){return _0x2befd4;});}return null;};}function removeEntity(_0x501eff,_0x3b9c95){return function(_0xe0e864){if(_0xe0e864){return _0xe0e864[_0x319f('0x24')]()[_0x319f('0x23')](function(){_0x501eff[_0x319f('0x18')](0xcc)[_0x319f('0x25')]();});}};}function handleEntityNotFound(_0x56aec7,_0x2689e1){return function(_0x2f70de){if(!_0x2f70de){_0x56aec7[_0x319f('0x26')](0x194);}return _0x2f70de;};}function handleError(_0x27634d,_0x472c90){_0x472c90=_0x472c90||0x1f4;return function(_0x55c92f){logger['error'](_0x55c92f[_0x319f('0x27')]);if(_0x55c92f['name']){delete _0x55c92f[_0x319f('0x28')];}_0x27634d[_0x319f('0x18')](_0x472c90)[_0x319f('0x29')](_0x55c92f);};}exports['index']=function(_0x2642c8,_0x1a7979){var _0x1963c2={},_0x62b21a={},_0x78e6cb={'count':0x0,'rows':[]};var _0x1a77a0=_['map'](db[_0x319f('0x2a')][_0x319f('0x2b')],function(_0x3b12bd){return{'name':_0x3b12bd['fieldName'],'type':_0x3b12bd[_0x319f('0x2c')][_0x319f('0x2d')]};});_0x62b21a[_0x319f('0x2e')]=_['map'](_0x1a77a0,_0x319f('0x28'));_0x62b21a['query']=_['keys'](_0x2642c8['query']);_0x62b21a[_0x319f('0x2f')]=_[_0x319f('0x30')](_0x62b21a['model'],_0x62b21a['query']);_0x1963c2[_0x319f('0x31')]=_[_0x319f('0x30')](_0x62b21a[_0x319f('0x2e')],qs[_0x319f('0x32')](_0x2642c8[_0x319f('0x33')]['fields']));_0x1963c2[_0x319f('0x31')]=_0x1963c2[_0x319f('0x31')][_0x319f('0x34')]?_0x1963c2[_0x319f('0x31')]:_0x62b21a[_0x319f('0x2e')];if(!_0x2642c8[_0x319f('0x33')][_0x319f('0x35')](_0x319f('0x36'))){_0x1963c2[_0x319f('0x1b')]=qs[_0x319f('0x1b')](_0x2642c8[_0x319f('0x33')]['limit']);_0x1963c2[_0x319f('0x1d')]=qs[_0x319f('0x1d')](_0x2642c8[_0x319f('0x33')][_0x319f('0x1d')]);}_0x1963c2[_0x319f('0x37')]=qs[_0x319f('0x38')](_0x2642c8['query'][_0x319f('0x38')]);_0x1963c2[_0x319f('0x39')]=qs['filters'](_[_0x319f('0x3a')](_0x2642c8['query'],_0x62b21a[_0x319f('0x2f')]),_0x1a77a0);if(_0x2642c8['query'][_0x319f('0x3b')]){_0x1963c2[_0x319f('0x39')]=_[_0x319f('0x3c')](_0x1963c2[_0x319f('0x39')],{'$or':_[_0x319f('0x3d')](_0x1a77a0,function(_0x1ab568){if(_0x1ab568['type']!=='VIRTUAL'){var _0x1617dc={};_0x1617dc[_0x1ab568[_0x319f('0x28')]]={'$like':'%'+_0x2642c8[_0x319f('0x33')][_0x319f('0x3b')]+'%'};return _0x1617dc;}})});}_0x1963c2=_['merge']({},_0x1963c2,_0x2642c8[_0x319f('0x3e')]);var _0x2a083d={'where':_0x1963c2[_0x319f('0x39')]};return db[_0x319f('0x2a')][_0x319f('0x1c')](_0x2a083d)[_0x319f('0x23')](function(_0x58ec07){_0x78e6cb[_0x319f('0x1c')]=_0x58ec07;if(_0x2642c8['query'][_0x319f('0x3f')]){_0x1963c2[_0x319f('0x40')]=[{'all':!![]}];}return db[_0x319f('0x2a')][_0x319f('0x41')](_0x1963c2);})[_0x319f('0x23')](function(_0x526f52){_0x78e6cb['rows']=_0x526f52;return _0x78e6cb;})[_0x319f('0x23')](respondWithFilteredResult(_0x1a7979,_0x1963c2))[_0x319f('0x42')](handleError(_0x1a7979,null));};exports[_0x319f('0x43')]=function(_0x4660b2,_0x2bf38e){var _0x35afc8={'raw':![],'where':{'id':_0x4660b2[_0x319f('0x44')]['id']}},_0x3b92ca={};_0x3b92ca[_0x319f('0x2e')]=_['keys'](db[_0x319f('0x2a')][_0x319f('0x2b')]);_0x3b92ca[_0x319f('0x33')]=_[_0x319f('0x45')](_0x4660b2[_0x319f('0x33')]);_0x3b92ca[_0x319f('0x2f')]=_[_0x319f('0x30')](_0x3b92ca[_0x319f('0x2e')],_0x3b92ca[_0x319f('0x33')]);_0x35afc8[_0x319f('0x31')]=_[_0x319f('0x30')](_0x3b92ca[_0x319f('0x2e')],qs[_0x319f('0x32')](_0x4660b2[_0x319f('0x33')][_0x319f('0x32')]));_0x35afc8[_0x319f('0x31')]=_0x35afc8['attributes'][_0x319f('0x34')]?_0x35afc8[_0x319f('0x31')]:_0x3b92ca['model'];if(_0x4660b2[_0x319f('0x33')][_0x319f('0x3f')]){_0x35afc8[_0x319f('0x40')]=[{'all':!![]}];}_0x35afc8=_[_0x319f('0x3c')]({},_0x35afc8,_0x4660b2['options']);return db[_0x319f('0x2a')][_0x319f('0x46')](_0x35afc8)[_0x319f('0x23')](handleEntityNotFound(_0x2bf38e,null))['then'](respondWithResult(_0x2bf38e,null))['catch'](handleError(_0x2bf38e,null));};exports[_0x319f('0x47')]=function(_0x4ccf9d,_0x33142a){return db[_0x319f('0x2a')][_0x319f('0x47')](_0x4ccf9d[_0x319f('0x48')],{})[_0x319f('0x23')](respondWithResult(_0x33142a,0xc9))[_0x319f('0x42')](handleError(_0x33142a,null));};exports['update']=function(_0x17dca9,_0x4480d2){if(_0x17dca9[_0x319f('0x48')]['id']){delete _0x17dca9[_0x319f('0x48')]['id'];}return db[_0x319f('0x2a')][_0x319f('0x46')]({'where':{'id':_0x17dca9[_0x319f('0x44')]['id']}})[_0x319f('0x23')](handleEntityNotFound(_0x4480d2,null))[_0x319f('0x23')](saveUpdates(_0x17dca9[_0x319f('0x48')],null))[_0x319f('0x23')](respondWithResult(_0x4480d2,null))[_0x319f('0x42')](handleError(_0x4480d2,null));};exports['destroy']=function(_0x2f818c,_0x442d0f){return db[_0x319f('0x2a')]['find']({'where':{'id':_0x2f818c['params']['id']}})['then'](handleEntityNotFound(_0x442d0f,null))[_0x319f('0x23')](removeEntity(_0x442d0f,null))[_0x319f('0x42')](handleError(_0x442d0f,null));};exports[_0x319f('0x49')]=function(_0x1fb299,_0x3f327d,_0x2bf785){var _0x5edc2e={};var _0x1a94f8={};var _0x527dd7;var _0x572244;return db[_0x319f('0x2a')][_0x319f('0x4a')]({'where':{'id':_0x1fb299[_0x319f('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f327d,null))[_0x319f('0x23')](function(_0xc95a10){if(_0xc95a10){_0x527dd7=_0xc95a10;_0x1a94f8['model']=_['keys'](db[_0x319f('0x4b')][_0x319f('0x2b')]);_0x1a94f8[_0x319f('0x33')]=_[_0x319f('0x45')](_0x1fb299[_0x319f('0x33')]);_0x1a94f8[_0x319f('0x2f')]=_['intersection'](_0x1a94f8[_0x319f('0x2e')],_0x1a94f8[_0x319f('0x33')]);_0x5edc2e[_0x319f('0x31')]=_[_0x319f('0x30')](_0x1a94f8[_0x319f('0x2e')],qs[_0x319f('0x32')](_0x1fb299['query'][_0x319f('0x32')]));_0x5edc2e[_0x319f('0x31')]=_0x5edc2e[_0x319f('0x31')][_0x319f('0x34')]?_0x5edc2e['attributes']:_0x1a94f8[_0x319f('0x2e')];_0x5edc2e[_0x319f('0x37')]=qs[_0x319f('0x38')](_0x1fb299[_0x319f('0x33')]['sort']);_0x5edc2e[_0x319f('0x39')]=qs[_0x319f('0x2f')](_[_0x319f('0x3a')](_0x1fb299[_0x319f('0x33')],_0x1a94f8['filters']));if(_0x1fb299[_0x319f('0x33')][_0x319f('0x3b')]){_0x5edc2e[_0x319f('0x39')]=_['merge'](_0x5edc2e[_0x319f('0x39')],{'$or':_['map'](_0x5edc2e[_0x319f('0x31')],function(_0x58537c){var _0x44aff2={};_0x44aff2[_0x58537c]={'$like':'%'+_0x1fb299[_0x319f('0x33')][_0x319f('0x3b')]+'%'};return _0x44aff2;})});}_0x5edc2e=_['merge']({},_0x5edc2e,_0x1fb299[_0x319f('0x3e')]);return _0x527dd7['getFields'](_0x5edc2e);}})[_0x319f('0x23')](function(_0x393fb9){if(_0x393fb9){_0x572244=_0x393fb9[_0x319f('0x34')];if(!_0x1fb299['query'][_0x319f('0x35')](_0x319f('0x36'))){_0x5edc2e[_0x319f('0x1b')]=qs[_0x319f('0x1b')](_0x1fb299[_0x319f('0x33')][_0x319f('0x1b')]);_0x5edc2e[_0x319f('0x1d')]=qs[_0x319f('0x1d')](_0x1fb299[_0x319f('0x33')][_0x319f('0x1d')]);}return _0x527dd7[_0x319f('0x49')](_0x5edc2e);}})[_0x319f('0x23')](function(_0xcc1c4f){if(_0xcc1c4f){return _0xcc1c4f?{'count':_0x572244,'rows':_0xcc1c4f}:null;}})[_0x319f('0x23')](respondWithResult(_0x3f327d,null))[_0x319f('0x42')](handleError(_0x3f327d,null));};exports[_0x319f('0x4c')]=function(_0x3c3ba2,_0x2ee1ea,_0x1a1157){var _0x39fd99={};var _0x589fa2={};var _0x39314f;var _0x84797;return db['ZendeskConfiguration'][_0x319f('0x4a')]({'where':{'id':_0x3c3ba2[_0x319f('0x44')]['id']}})[_0x319f('0x23')](handleEntityNotFound(_0x2ee1ea,null))[_0x319f('0x23')](function(_0x17a8fb){if(_0x17a8fb){_0x39314f=_0x17a8fb;_0x589fa2[_0x319f('0x2e')]=_[_0x319f('0x45')](db['ZendeskField']['rawAttributes']);_0x589fa2[_0x319f('0x33')]=_[_0x319f('0x45')](_0x3c3ba2[_0x319f('0x33')]);_0x589fa2['filters']=_['intersection'](_0x589fa2[_0x319f('0x2e')],_0x589fa2['query']);_0x39fd99[_0x319f('0x31')]=_[_0x319f('0x30')](_0x589fa2['model'],qs[_0x319f('0x32')](_0x3c3ba2[_0x319f('0x33')][_0x319f('0x32')]));_0x39fd99[_0x319f('0x31')]=_0x39fd99[_0x319f('0x31')]['length']?_0x39fd99['attributes']:_0x589fa2[_0x319f('0x2e')];_0x39fd99[_0x319f('0x37')]=qs[_0x319f('0x38')](_0x3c3ba2[_0x319f('0x33')][_0x319f('0x38')]);_0x39fd99['where']=qs['filters'](_[_0x319f('0x3a')](_0x3c3ba2[_0x319f('0x33')],_0x589fa2['filters']));if(_0x3c3ba2[_0x319f('0x33')][_0x319f('0x3b')]){_0x39fd99[_0x319f('0x39')]=_[_0x319f('0x3c')](_0x39fd99[_0x319f('0x39')],{'$or':_[_0x319f('0x3d')](_0x39fd99['attributes'],function(_0x42f51a){var _0x2cfaef={};_0x2cfaef[_0x42f51a]={'$like':'%'+_0x3c3ba2[_0x319f('0x33')][_0x319f('0x3b')]+'%'};return _0x2cfaef;})});}_0x39fd99=_[_0x319f('0x3c')]({},_0x39fd99,_0x3c3ba2['options']);return _0x39314f[_0x319f('0x4c')](_0x39fd99);}})[_0x319f('0x23')](function(_0x5704a0){if(_0x5704a0){_0x84797=_0x5704a0['length'];if(!_0x3c3ba2[_0x319f('0x33')]['hasOwnProperty'](_0x319f('0x36'))){_0x39fd99[_0x319f('0x1b')]=qs[_0x319f('0x1b')](_0x3c3ba2[_0x319f('0x33')][_0x319f('0x1b')]);_0x39fd99[_0x319f('0x1d')]=qs['offset'](_0x3c3ba2[_0x319f('0x33')]['offset']);}return _0x39314f[_0x319f('0x4c')](_0x39fd99);}})['then'](function(_0x344e8c){if(_0x344e8c){return _0x344e8c?{'count':_0x84797,'rows':_0x344e8c}:null;}})[_0x319f('0x23')](respondWithResult(_0x2ee1ea,null))[_0x319f('0x42')](handleError(_0x2ee1ea,null));};exports[_0x319f('0x4d')]=function(_0x349f12,_0x1afa65,_0x4a05a3){var _0x223087={};var _0x4b0ecd={};var _0x1e743e;var _0x492039;return db['ZendeskConfiguration'][_0x319f('0x4a')]({'where':{'id':_0x349f12[_0x319f('0x44')]['id']}})['then'](handleEntityNotFound(_0x1afa65,null))[_0x319f('0x23')](function(_0x56ae0a){if(_0x56ae0a){_0x1e743e=_0x56ae0a;_0x4b0ecd['model']=_[_0x319f('0x45')](db[_0x319f('0x4b')]['rawAttributes']);_0x4b0ecd['query']=_[_0x319f('0x45')](_0x349f12[_0x319f('0x33')]);_0x4b0ecd['filters']=_[_0x319f('0x30')](_0x4b0ecd[_0x319f('0x2e')],_0x4b0ecd[_0x319f('0x33')]);_0x223087[_0x319f('0x31')]=_['intersection'](_0x4b0ecd[_0x319f('0x2e')],qs[_0x319f('0x32')](_0x349f12[_0x319f('0x33')]['fields']));_0x223087[_0x319f('0x31')]=_0x223087[_0x319f('0x31')][_0x319f('0x34')]?_0x223087[_0x319f('0x31')]:_0x4b0ecd['model'];_0x223087[_0x319f('0x37')]=qs[_0x319f('0x38')](_0x349f12[_0x319f('0x33')][_0x319f('0x38')]);_0x223087[_0x319f('0x39')]=qs[_0x319f('0x2f')](_[_0x319f('0x3a')](_0x349f12[_0x319f('0x33')],_0x4b0ecd[_0x319f('0x2f')]));if(_0x349f12[_0x319f('0x33')]['filter']){_0x223087[_0x319f('0x39')]=_['merge'](_0x223087[_0x319f('0x39')],{'$or':_[_0x319f('0x3d')](_0x223087[_0x319f('0x31')],function(_0x337a37){var _0xbeb942={};_0xbeb942[_0x337a37]={'$like':'%'+_0x349f12['query'][_0x319f('0x3b')]+'%'};return _0xbeb942;})});}_0x223087=_[_0x319f('0x3c')]({},_0x223087,_0x349f12['options']);return _0x1e743e[_0x319f('0x4d')](_0x223087);}})[_0x319f('0x23')](function(_0x159a2f){if(_0x159a2f){_0x492039=_0x159a2f[_0x319f('0x34')];if(!_0x349f12[_0x319f('0x33')]['hasOwnProperty'](_0x319f('0x36'))){_0x223087[_0x319f('0x1b')]=qs[_0x319f('0x1b')](_0x349f12['query'][_0x319f('0x1b')]);_0x223087[_0x319f('0x1d')]=qs[_0x319f('0x1d')](_0x349f12[_0x319f('0x33')]['offset']);}return _0x1e743e[_0x319f('0x4d')](_0x223087);}})[_0x319f('0x23')](function(_0x2953ea){if(_0x2953ea){return _0x2953ea?{'count':_0x492039,'rows':_0x2953ea}:null;}})[_0x319f('0x23')](respondWithResult(_0x1afa65,null))[_0x319f('0x42')](handleError(_0x1afa65,null));};exports[_0x319f('0x4e')]=function(_0x2a73c7,_0x41d43b,_0x1856bd){var _0x282bfd={};var _0x45afcb={};var _0xd8447d;var _0x485ffa;return db['ZendeskConfiguration'][_0x319f('0x4a')]({'where':{'id':_0x2a73c7[_0x319f('0x44')]['id']}})[_0x319f('0x23')](handleEntityNotFound(_0x41d43b,null))['then'](function(_0x333fd0){if(_0x333fd0){_0xd8447d=_0x333fd0;_0x45afcb[_0x319f('0x2e')]=_[_0x319f('0x45')](db[_0x319f('0x4f')][_0x319f('0x2b')]);_0x45afcb['query']=_[_0x319f('0x45')](_0x2a73c7[_0x319f('0x33')]);_0x45afcb[_0x319f('0x2f')]=_[_0x319f('0x30')](_0x45afcb['model'],_0x45afcb[_0x319f('0x33')]);_0x282bfd['attributes']=_[_0x319f('0x30')](_0x45afcb[_0x319f('0x2e')],qs[_0x319f('0x32')](_0x2a73c7[_0x319f('0x33')][_0x319f('0x32')]));_0x282bfd[_0x319f('0x31')]=_0x282bfd[_0x319f('0x31')][_0x319f('0x34')]?_0x282bfd[_0x319f('0x31')]:_0x45afcb[_0x319f('0x2e')];_0x282bfd[_0x319f('0x37')]=qs[_0x319f('0x38')](_0x2a73c7['query'][_0x319f('0x38')]);_0x282bfd['where']=qs[_0x319f('0x2f')](_[_0x319f('0x3a')](_0x2a73c7[_0x319f('0x33')],_0x45afcb[_0x319f('0x2f')]));if(_0x2a73c7[_0x319f('0x33')][_0x319f('0x3b')]){_0x282bfd['where']=_[_0x319f('0x3c')](_0x282bfd[_0x319f('0x39')],{'$or':_[_0x319f('0x3d')](_0x282bfd[_0x319f('0x31')],function(_0x49ea98){var _0x3f1cfe={};_0x3f1cfe[_0x49ea98]={'$like':'%'+_0x2a73c7[_0x319f('0x33')][_0x319f('0x3b')]+'%'};return _0x3f1cfe;})});}_0x282bfd=_[_0x319f('0x3c')]({},_0x282bfd,_0x2a73c7[_0x319f('0x3e')]);return _0xd8447d[_0x319f('0x4e')](_0x282bfd);}})[_0x319f('0x23')](function(_0x956e8){if(_0x956e8){_0x485ffa=_0x956e8[_0x319f('0x34')];if(!_0x2a73c7[_0x319f('0x33')][_0x319f('0x35')](_0x319f('0x36'))){_0x282bfd[_0x319f('0x1b')]=qs[_0x319f('0x1b')](_0x2a73c7[_0x319f('0x33')][_0x319f('0x1b')]);_0x282bfd[_0x319f('0x1d')]=qs['offset'](_0x2a73c7[_0x319f('0x33')][_0x319f('0x1d')]);}return _0xd8447d['getTags'](_0x282bfd);}})[_0x319f('0x23')](function(_0x5b758e){if(_0x5b758e){return _0x5b758e?{'count':_0x485ffa,'rows':_0x5b758e}:null;}})[_0x319f('0x23')](respondWithResult(_0x41d43b,null))['catch'](handleError(_0x41d43b,null));};exports[_0x319f('0x50')]=function(_0x10a776,_0x577ac3,_0x13ade8){if(_0x10a776[_0x319f('0x48')]['id']){delete _0x10a776[_0x319f('0x48')]['id'];}return db['ZendeskConfiguration'][_0x319f('0x4a')]({'where':{'id':_0x10a776[_0x319f('0x44')]['id']}})[_0x319f('0x23')](handleEntityNotFound(_0x577ac3,null))[_0x319f('0x23')](function(_0x23198c){if(_0x23198c){return _0x23198c['setTags'](_0x10a776['body'][_0x319f('0x51')]||[]);}return null;})[_0x319f('0x23')](respondWithResult(_0x577ac3,null))['catch'](handleError(_0x577ac3,null));};