Built motion from commit 092f8824.|2.5.49
[motion2.git] / server / api / intFreshdeskConfiguration / intFreshdeskConfiguration.controller.js
index 78ee798..4dc685a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf57f=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','send','index','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','FreshdeskConfiguration','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x16a101,_0x12caba){var _0x47b258=function(_0x1d4a8b){while(--_0x1d4a8b){_0x16a101['push'](_0x16a101['shift']());}};_0x47b258(++_0x12caba);}(_0xf57f,0x194));var _0xff57=function(_0x562ec5,_0x36b5a4){_0x562ec5=_0x562ec5-0x0;var _0x279c8c=_0xf57f[_0x562ec5];return _0x279c8c;};'use strict';var emlformat=require(_0xff57('0x0'));var rimraf=require(_0xff57('0x1'));var zipdir=require(_0xff57('0x2'));var jsonpatch=require(_0xff57('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xff57('0x4'));var Mustache=require(_0xff57('0x5'));var util=require(_0xff57('0x6'));var path=require(_0xff57('0x7'));var sox=require(_0xff57('0x8'));var csv=require(_0xff57('0x9'));var ejs=require(_0xff57('0xa'));var fs=require('fs');var fs_extra=require(_0xff57('0xb'));var _=require(_0xff57('0xc'));var squel=require('squel');var crypto=require(_0xff57('0xd'));var jsforce=require(_0xff57('0xe'));var deskjs=require(_0xff57('0xf'));var toCsv=require(_0xff57('0x9'));var querystring=require(_0xff57('0x10'));var Papa=require(_0xff57('0x11'));var Redis=require(_0xff57('0x12'));var authService=require(_0xff57('0x13'));var qs=require(_0xff57('0x14'));var as=require(_0xff57('0x15'));var hardwareService=require(_0xff57('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xff57('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xff57('0x18'));var db=require(_0xff57('0x19'))['db'];function respondWithStatusCode(_0x58adb1,_0x20d045){_0x20d045=_0x20d045||0xcc;return function(_0x2e7574){if(_0x2e7574){return _0x58adb1[_0xff57('0x1a')](_0x20d045);}return _0x58adb1[_0xff57('0x1b')](_0x20d045)[_0xff57('0x1c')]();};}function respondWithResult(_0x216855,_0x374360){_0x374360=_0x374360||0xc8;return function(_0xba544b){if(_0xba544b){return _0x216855[_0xff57('0x1b')](_0x374360)['json'](_0xba544b);}};}function respondWithFilteredResult(_0x4bcced,_0xe9e3eb){return function(_0x1a9848){if(_0x1a9848){var _0x1a8baa=typeof _0xe9e3eb[_0xff57('0x1d')]===_0xff57('0x1e')&&typeof _0xe9e3eb[_0xff57('0x1f')]==='undefined';var _0x5b7c44=_0x1a9848['count'];var _0x4bb88e=_0x1a8baa?0x0:_0xe9e3eb[_0xff57('0x1d')];var _0x5b55e1=_0x1a8baa?_0x1a9848[_0xff57('0x20')]:_0xe9e3eb['offset']+_0xe9e3eb[_0xff57('0x1f')];var _0x366e3c;if(_0x5b55e1>=_0x5b7c44){_0x5b55e1=_0x5b7c44;_0x366e3c=0xc8;}else{_0x366e3c=0xce;}_0x4bcced['status'](_0x366e3c);return _0x4bcced[_0xff57('0x21')](_0xff57('0x22'),_0x4bb88e+'-'+_0x5b55e1+'/'+_0x5b7c44)[_0xff57('0x23')](_0x1a9848);}return null;};}function patchUpdates(_0x2a2d16){return function(_0x3c63bc){try{jsonpatch['apply'](_0x3c63bc,_0x2a2d16,!![]);}catch(_0x31bd77){return BPromise[_0xff57('0x24')](_0x31bd77);}return _0x3c63bc[_0xff57('0x25')]();};}function saveUpdates(_0x3f2ec1,_0x337891){return function(_0x177432){if(_0x177432){return _0x177432[_0xff57('0x26')](_0x3f2ec1)['then'](function(_0x594613){return _0x594613;});}return null;};}function removeEntity(_0x420332,_0x50a8af){return function(_0x2f6be6){if(_0x2f6be6){return _0x2f6be6[_0xff57('0x27')]()[_0xff57('0x28')](function(){_0x420332[_0xff57('0x1b')](0xcc)[_0xff57('0x1c')]();});}};}function handleEntityNotFound(_0x227e5a,_0x3f02fd){return function(_0x1b86d2){if(!_0x1b86d2){_0x227e5a[_0xff57('0x1a')](0x194);}return _0x1b86d2;};}function handleError(_0x10c52b,_0x41d477){_0x41d477=_0x41d477||0x1f4;return function(_0x2fdb85){logger[_0xff57('0x29')](_0x2fdb85[_0xff57('0x2a')]);if(_0x2fdb85[_0xff57('0x2b')]){delete _0x2fdb85[_0xff57('0x2b')];}_0x10c52b[_0xff57('0x1b')](_0x41d477)[_0xff57('0x2c')](_0x2fdb85);};}exports[_0xff57('0x2d')]=function(_0x129013,_0x84e055){var _0x292f68={},_0x3941e0={},_0x2138ad={'count':0x0,'rows':[]};var _0x3664ae=_['map'](db['FreshdeskConfiguration'][_0xff57('0x2e')],function(_0x1cf7b1){return{'name':_0x1cf7b1['fieldName'],'type':_0x1cf7b1[_0xff57('0x2f')][_0xff57('0x30')]};});_0x3941e0[_0xff57('0x31')]=_[_0xff57('0x32')](_0x3664ae,'name');_0x3941e0[_0xff57('0x33')]=_['keys'](_0x129013[_0xff57('0x33')]);_0x3941e0[_0xff57('0x34')]=_[_0xff57('0x35')](_0x3941e0['model'],_0x3941e0[_0xff57('0x33')]);_0x292f68[_0xff57('0x36')]=_[_0xff57('0x35')](_0x3941e0[_0xff57('0x31')],qs[_0xff57('0x37')](_0x129013[_0xff57('0x33')]['fields']));_0x292f68['attributes']=_0x292f68[_0xff57('0x36')][_0xff57('0x38')]?_0x292f68[_0xff57('0x36')]:_0x3941e0[_0xff57('0x31')];if(!_0x129013[_0xff57('0x33')][_0xff57('0x39')](_0xff57('0x3a'))){_0x292f68[_0xff57('0x1f')]=qs[_0xff57('0x1f')](_0x129013['query'][_0xff57('0x1f')]);_0x292f68[_0xff57('0x1d')]=qs[_0xff57('0x1d')](_0x129013[_0xff57('0x33')][_0xff57('0x1d')]);}_0x292f68[_0xff57('0x3b')]=qs[_0xff57('0x3c')](_0x129013[_0xff57('0x33')][_0xff57('0x3c')]);_0x292f68[_0xff57('0x3d')]=qs['filters'](_[_0xff57('0x3e')](_0x129013[_0xff57('0x33')],_0x3941e0['filters']),_0x3664ae);if(_0x129013[_0xff57('0x33')]['filter']){_0x292f68[_0xff57('0x3d')]=_[_0xff57('0x3f')](_0x292f68[_0xff57('0x3d')],{'$or':_[_0xff57('0x32')](_0x3664ae,function(_0x1f50f6){if(_0x1f50f6['type']!==_0xff57('0x40')){var _0x12d532={};_0x12d532[_0x1f50f6[_0xff57('0x2b')]]={'$like':'%'+_0x129013[_0xff57('0x33')][_0xff57('0x41')]+'%'};return _0x12d532;}})});}_0x292f68=_[_0xff57('0x3f')]({},_0x292f68,_0x129013[_0xff57('0x42')]);var _0x200820={'where':_0x292f68[_0xff57('0x3d')]};return db['FreshdeskConfiguration']['count'](_0x200820)[_0xff57('0x28')](function(_0x42c924){_0x2138ad['count']=_0x42c924;if(_0x129013['query'][_0xff57('0x43')]){_0x292f68[_0xff57('0x44')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x292f68);})[_0xff57('0x28')](function(_0x48adba){_0x2138ad[_0xff57('0x45')]=_0x48adba;return _0x2138ad;})['then'](respondWithFilteredResult(_0x84e055,_0x292f68))[_0xff57('0x46')](handleError(_0x84e055,null));};exports[_0xff57('0x47')]=function(_0x1d2015,_0x2a476c){var _0xe0753f={'raw':![],'where':{'id':_0x1d2015[_0xff57('0x48')]['id']}},_0x4b9afc={};_0x4b9afc['model']=_[_0xff57('0x49')](db[_0xff57('0x4a')][_0xff57('0x2e')]);_0x4b9afc[_0xff57('0x33')]=_['keys'](_0x1d2015['query']);_0x4b9afc[_0xff57('0x34')]=_[_0xff57('0x35')](_0x4b9afc[_0xff57('0x31')],_0x4b9afc[_0xff57('0x33')]);_0xe0753f[_0xff57('0x36')]=_[_0xff57('0x35')](_0x4b9afc[_0xff57('0x31')],qs[_0xff57('0x37')](_0x1d2015[_0xff57('0x33')][_0xff57('0x37')]));_0xe0753f[_0xff57('0x36')]=_0xe0753f[_0xff57('0x36')][_0xff57('0x38')]?_0xe0753f['attributes']:_0x4b9afc[_0xff57('0x31')];if(_0x1d2015[_0xff57('0x33')][_0xff57('0x43')]){_0xe0753f[_0xff57('0x44')]=[{'all':!![]}];}_0xe0753f=_[_0xff57('0x3f')]({},_0xe0753f,_0x1d2015[_0xff57('0x42')]);return db[_0xff57('0x4a')][_0xff57('0x4b')](_0xe0753f)['then'](handleEntityNotFound(_0x2a476c,null))[_0xff57('0x28')](respondWithResult(_0x2a476c,null))[_0xff57('0x46')](handleError(_0x2a476c,null));};exports[_0xff57('0x4c')]=function(_0x117ff2,_0x4745f2){return db[_0xff57('0x4a')][_0xff57('0x4c')](_0x117ff2[_0xff57('0x4d')],{})[_0xff57('0x28')](respondWithResult(_0x4745f2,0xc9))[_0xff57('0x46')](handleError(_0x4745f2,null));};exports[_0xff57('0x26')]=function(_0x1cd538,_0x585b5b){if(_0x1cd538['body']['id']){delete _0x1cd538[_0xff57('0x4d')]['id'];}return db[_0xff57('0x4a')][_0xff57('0x4b')]({'where':{'id':_0x1cd538[_0xff57('0x48')]['id']}})['then'](handleEntityNotFound(_0x585b5b,null))[_0xff57('0x28')](saveUpdates(_0x1cd538[_0xff57('0x4d')],null))[_0xff57('0x28')](respondWithResult(_0x585b5b,null))['catch'](handleError(_0x585b5b,null));};exports[_0xff57('0x27')]=function(_0xad5c8a,_0x46d09d){return db[_0xff57('0x4a')][_0xff57('0x4b')]({'where':{'id':_0xad5c8a['params']['id']}})['then'](handleEntityNotFound(_0x46d09d,null))[_0xff57('0x28')](removeEntity(_0x46d09d,null))[_0xff57('0x46')](handleError(_0x46d09d,null));};exports[_0xff57('0x4e')]=function(_0x18add1,_0x2b1f92,_0x1b9806){var _0x277aa9={};var _0x33c0f6={};var _0x498d74;var _0x345ad2;return db[_0xff57('0x4a')][_0xff57('0x4f')]({'where':{'id':_0x18add1[_0xff57('0x48')]['id']}})[_0xff57('0x28')](handleEntityNotFound(_0x2b1f92,null))['then'](function(_0x2894e4){if(_0x2894e4){_0x498d74=_0x2894e4;_0x33c0f6['model']=_[_0xff57('0x49')](db[_0xff57('0x50')][_0xff57('0x2e')]);_0x33c0f6['query']=_[_0xff57('0x49')](_0x18add1[_0xff57('0x33')]);_0x33c0f6['filters']=_[_0xff57('0x35')](_0x33c0f6[_0xff57('0x31')],_0x33c0f6[_0xff57('0x33')]);_0x277aa9['attributes']=_[_0xff57('0x35')](_0x33c0f6[_0xff57('0x31')],qs[_0xff57('0x37')](_0x18add1[_0xff57('0x33')]['fields']));_0x277aa9[_0xff57('0x36')]=_0x277aa9[_0xff57('0x36')][_0xff57('0x38')]?_0x277aa9[_0xff57('0x36')]:_0x33c0f6[_0xff57('0x31')];_0x277aa9[_0xff57('0x3b')]=qs[_0xff57('0x3c')](_0x18add1[_0xff57('0x33')][_0xff57('0x3c')]);_0x277aa9[_0xff57('0x3d')]=qs[_0xff57('0x34')](_['pick'](_0x18add1[_0xff57('0x33')],_0x33c0f6['filters']));if(_0x18add1['query'][_0xff57('0x41')]){_0x277aa9[_0xff57('0x3d')]=_[_0xff57('0x3f')](_0x277aa9[_0xff57('0x3d')],{'$or':_['map'](_0x277aa9[_0xff57('0x36')],function(_0x1f3a7b){var _0x2e7f1c={};_0x2e7f1c[_0x1f3a7b]={'$like':'%'+_0x18add1['query'][_0xff57('0x41')]+'%'};return _0x2e7f1c;})});}_0x277aa9=_[_0xff57('0x3f')]({},_0x277aa9,_0x18add1[_0xff57('0x42')]);return _0x498d74[_0xff57('0x4e')](_0x277aa9);}})['then'](function(_0x296bb4){if(_0x296bb4){_0x345ad2=_0x296bb4['length'];if(!_0x18add1[_0xff57('0x33')]['hasOwnProperty']('nolimit')){_0x277aa9['limit']=qs[_0xff57('0x1f')](_0x18add1[_0xff57('0x33')][_0xff57('0x1f')]);_0x277aa9[_0xff57('0x1d')]=qs['offset'](_0x18add1[_0xff57('0x33')]['offset']);}return _0x498d74[_0xff57('0x4e')](_0x277aa9);}})[_0xff57('0x28')](function(_0x3753f6){if(_0x3753f6){return _0x3753f6?{'count':_0x345ad2,'rows':_0x3753f6}:null;}})[_0xff57('0x28')](respondWithResult(_0x2b1f92,null))[_0xff57('0x46')](handleError(_0x2b1f92,null));};exports[_0xff57('0x51')]=function(_0x44f4e5,_0x180246,_0x1b49eb){var _0x749896={};var _0x45dc42={};var _0x44f88b;var _0x1d3fb4;return db[_0xff57('0x4a')]['findOne']({'where':{'id':_0x44f4e5[_0xff57('0x48')]['id']}})['then'](handleEntityNotFound(_0x180246,null))[_0xff57('0x28')](function(_0x52bf7d){if(_0x52bf7d){_0x44f88b=_0x52bf7d;_0x45dc42[_0xff57('0x31')]=_[_0xff57('0x49')](db[_0xff57('0x50')][_0xff57('0x2e')]);_0x45dc42[_0xff57('0x33')]=_[_0xff57('0x49')](_0x44f4e5[_0xff57('0x33')]);_0x45dc42[_0xff57('0x34')]=_[_0xff57('0x35')](_0x45dc42[_0xff57('0x31')],_0x45dc42['query']);_0x749896['attributes']=_[_0xff57('0x35')](_0x45dc42[_0xff57('0x31')],qs['fields'](_0x44f4e5['query'][_0xff57('0x37')]));_0x749896['attributes']=_0x749896[_0xff57('0x36')][_0xff57('0x38')]?_0x749896[_0xff57('0x36')]:_0x45dc42[_0xff57('0x31')];_0x749896[_0xff57('0x3b')]=qs['sort'](_0x44f4e5[_0xff57('0x33')][_0xff57('0x3c')]);_0x749896[_0xff57('0x3d')]=qs[_0xff57('0x34')](_[_0xff57('0x3e')](_0x44f4e5[_0xff57('0x33')],_0x45dc42['filters']));if(_0x44f4e5[_0xff57('0x33')][_0xff57('0x41')]){_0x749896[_0xff57('0x3d')]=_['merge'](_0x749896['where'],{'$or':_[_0xff57('0x32')](_0x749896[_0xff57('0x36')],function(_0x33bd75){var _0x3ca16d={};_0x3ca16d[_0x33bd75]={'$like':'%'+_0x44f4e5[_0xff57('0x33')][_0xff57('0x41')]+'%'};return _0x3ca16d;})});}_0x749896=_[_0xff57('0x3f')]({},_0x749896,_0x44f4e5[_0xff57('0x42')]);return _0x44f88b['getSubjects'](_0x749896);}})[_0xff57('0x28')](function(_0x94f35b){if(_0x94f35b){_0x1d3fb4=_0x94f35b[_0xff57('0x38')];if(!_0x44f4e5[_0xff57('0x33')]['hasOwnProperty']('nolimit')){_0x749896[_0xff57('0x1f')]=qs[_0xff57('0x1f')](_0x44f4e5['query']['limit']);_0x749896[_0xff57('0x1d')]=qs[_0xff57('0x1d')](_0x44f4e5[_0xff57('0x33')][_0xff57('0x1d')]);}return _0x44f88b['getSubjects'](_0x749896);}})[_0xff57('0x28')](function(_0x3c11db){if(_0x3c11db){return _0x3c11db?{'count':_0x1d3fb4,'rows':_0x3c11db}:null;}})[_0xff57('0x28')](respondWithResult(_0x180246,null))[_0xff57('0x46')](handleError(_0x180246,null));};exports[_0xff57('0x52')]=function(_0x231793,_0x4d629e,_0x60a130){var _0xc828a8={};var _0x28b173={};var _0x2b169c;var _0x51e1b3;return db[_0xff57('0x4a')][_0xff57('0x4f')]({'where':{'id':_0x231793[_0xff57('0x48')]['id']}})[_0xff57('0x28')](handleEntityNotFound(_0x4d629e,null))[_0xff57('0x28')](function(_0x52c2c3){if(_0x52c2c3){_0x2b169c=_0x52c2c3;_0x28b173[_0xff57('0x31')]=_[_0xff57('0x49')](db[_0xff57('0x50')]['rawAttributes']);_0x28b173[_0xff57('0x33')]=_[_0xff57('0x49')](_0x231793[_0xff57('0x33')]);_0x28b173[_0xff57('0x34')]=_['intersection'](_0x28b173['model'],_0x28b173[_0xff57('0x33')]);_0xc828a8[_0xff57('0x36')]=_[_0xff57('0x35')](_0x28b173[_0xff57('0x31')],qs[_0xff57('0x37')](_0x231793[_0xff57('0x33')][_0xff57('0x37')]));_0xc828a8[_0xff57('0x36')]=_0xc828a8[_0xff57('0x36')][_0xff57('0x38')]?_0xc828a8[_0xff57('0x36')]:_0x28b173['model'];_0xc828a8['order']=qs[_0xff57('0x3c')](_0x231793['query'][_0xff57('0x3c')]);_0xc828a8[_0xff57('0x3d')]=qs[_0xff57('0x34')](_['pick'](_0x231793[_0xff57('0x33')],_0x28b173[_0xff57('0x34')]));if(_0x231793[_0xff57('0x33')][_0xff57('0x41')]){_0xc828a8[_0xff57('0x3d')]=_[_0xff57('0x3f')](_0xc828a8[_0xff57('0x3d')],{'$or':_[_0xff57('0x32')](_0xc828a8[_0xff57('0x36')],function(_0x1262bd){var _0x5afffd={};_0x5afffd[_0x1262bd]={'$like':'%'+_0x231793['query'][_0xff57('0x41')]+'%'};return _0x5afffd;})});}_0xc828a8=_[_0xff57('0x3f')]({},_0xc828a8,_0x231793[_0xff57('0x42')]);return _0x2b169c['getDescriptions'](_0xc828a8);}})[_0xff57('0x28')](function(_0x17dd2a){if(_0x17dd2a){_0x51e1b3=_0x17dd2a['length'];if(!_0x231793['query'][_0xff57('0x39')]('nolimit')){_0xc828a8[_0xff57('0x1f')]=qs[_0xff57('0x1f')](_0x231793['query']['limit']);_0xc828a8[_0xff57('0x1d')]=qs[_0xff57('0x1d')](_0x231793[_0xff57('0x33')]['offset']);}return _0x2b169c[_0xff57('0x52')](_0xc828a8);}})[_0xff57('0x28')](function(_0x24dfed){if(_0x24dfed){return _0x24dfed?{'count':_0x51e1b3,'rows':_0x24dfed}:null;}})[_0xff57('0x28')](respondWithResult(_0x4d629e,null))[_0xff57('0x46')](handleError(_0x4d629e,null));};exports['getTags']=function(_0x1a7f55,_0x552958,_0x1dbb56){var _0x2a4865={};var _0x9f69b6={};var _0x4a6d1f;var _0x326b1c;return db[_0xff57('0x4a')][_0xff57('0x4f')]({'where':{'id':_0x1a7f55[_0xff57('0x48')]['id']}})[_0xff57('0x28')](handleEntityNotFound(_0x552958,null))[_0xff57('0x28')](function(_0x16df36){if(_0x16df36){_0x4a6d1f=_0x16df36;_0x9f69b6[_0xff57('0x31')]=_['keys'](db[_0xff57('0x53')][_0xff57('0x2e')]);_0x9f69b6[_0xff57('0x33')]=_[_0xff57('0x49')](_0x1a7f55[_0xff57('0x33')]);_0x9f69b6['filters']=_['intersection'](_0x9f69b6[_0xff57('0x31')],_0x9f69b6['query']);_0x2a4865['attributes']=_[_0xff57('0x35')](_0x9f69b6[_0xff57('0x31')],qs[_0xff57('0x37')](_0x1a7f55[_0xff57('0x33')]['fields']));_0x2a4865['attributes']=_0x2a4865[_0xff57('0x36')][_0xff57('0x38')]?_0x2a4865['attributes']:_0x9f69b6['model'];_0x2a4865['order']=qs[_0xff57('0x3c')](_0x1a7f55[_0xff57('0x33')][_0xff57('0x3c')]);_0x2a4865[_0xff57('0x3d')]=qs[_0xff57('0x34')](_[_0xff57('0x3e')](_0x1a7f55['query'],_0x9f69b6['filters']));if(_0x1a7f55['query'][_0xff57('0x41')]){_0x2a4865[_0xff57('0x3d')]=_['merge'](_0x2a4865['where'],{'$or':_[_0xff57('0x32')](_0x2a4865[_0xff57('0x36')],function(_0x15df1d){var _0x2b5bf8={};_0x2b5bf8[_0x15df1d]={'$like':'%'+_0x1a7f55[_0xff57('0x33')][_0xff57('0x41')]+'%'};return _0x2b5bf8;})});}_0x2a4865=_['merge']({},_0x2a4865,_0x1a7f55[_0xff57('0x42')]);return _0x4a6d1f[_0xff57('0x54')](_0x2a4865);}})['then'](function(_0x32088f){if(_0x32088f){_0x326b1c=_0x32088f[_0xff57('0x38')];if(!_0x1a7f55[_0xff57('0x33')][_0xff57('0x39')]('nolimit')){_0x2a4865[_0xff57('0x1f')]=qs[_0xff57('0x1f')](_0x1a7f55[_0xff57('0x33')][_0xff57('0x1f')]);_0x2a4865[_0xff57('0x1d')]=qs[_0xff57('0x1d')](_0x1a7f55['query']['offset']);}return _0x4a6d1f[_0xff57('0x54')](_0x2a4865);}})[_0xff57('0x28')](function(_0x1622a6){if(_0x1622a6){return _0x1622a6?{'count':_0x326b1c,'rows':_0x1622a6}:null;}})[_0xff57('0x28')](respondWithResult(_0x552958,null))[_0xff57('0x46')](handleError(_0x552958,null));};exports[_0xff57('0x55')]=function(_0x42dbad,_0x56ed4e,_0xfe0881){if(_0x42dbad['body']['id']){delete _0x42dbad[_0xff57('0x4d')]['id'];}return db[_0xff57('0x4a')][_0xff57('0x4f')]({'where':{'id':_0x42dbad['params']['id']}})[_0xff57('0x28')](handleEntityNotFound(_0x56ed4e,null))[_0xff57('0x28')](function(_0x150350){if(_0x150350){return _0x150350[_0xff57('0x55')](_0x42dbad[_0xff57('0x4d')]['ids']||[]);}return null;})[_0xff57('0x28')](respondWithResult(_0x56ed4e,null))[_0xff57('0x46')](handleError(_0x56ed4e,null));};
\ No newline at end of file
+var _0xb404=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','FreshdeskConfiguration','find','create','body','params','getFields','FreshdeskField','pick','getSubjects','getDescriptions','findOne','getTags','setTags','ids','rimraf','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','type','model','query','keys','filters'];(function(_0x59b439,_0x14ae7b){var _0x521ea3=function(_0x5af627){while(--_0x5af627){_0x59b439['push'](_0x59b439['shift']());}};_0x521ea3(++_0x14ae7b);}(_0xb404,0x6e));var _0x4b40=function(_0x4798c8,_0x53d005){_0x4798c8=_0x4798c8-0x0;var _0x1e2c1d=_0xb404[_0x4798c8];return _0x1e2c1d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4b40('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b40('0x1'));var rp=require(_0x4b40('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4b40('0x3'));var util=require(_0x4b40('0x4'));var path=require(_0x4b40('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4b40('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b40('0x7'));var squel=require('squel');var crypto=require(_0x4b40('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x4b40('0x9'));var toCsv=require(_0x4b40('0xa'));var querystring=require('querystring');var Papa=require(_0x4b40('0xb'));var Redis=require('ioredis');var authService=require(_0x4b40('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x4b40('0xd'));var hardwareService=require(_0x4b40('0xe'));var logger=require(_0x4b40('0xf'))(_0x4b40('0x10'));var utils=require(_0x4b40('0x11'));var config=require(_0x4b40('0x12'));var licenseUtil=require(_0x4b40('0x13'));var db=require(_0x4b40('0x14'))['db'];function respondWithStatusCode(_0x3dfe56,_0x1d26ed){_0x1d26ed=_0x1d26ed||0xcc;return function(_0x33c321){if(_0x33c321){return _0x3dfe56['sendStatus'](_0x1d26ed);}return _0x3dfe56[_0x4b40('0x15')](_0x1d26ed)[_0x4b40('0x16')]();};}function respondWithResult(_0x5bc696,_0x3f9d3e){_0x3f9d3e=_0x3f9d3e||0xc8;return function(_0x60f9b1){if(_0x60f9b1){return _0x5bc696[_0x4b40('0x15')](_0x3f9d3e)[_0x4b40('0x17')](_0x60f9b1);}};}function respondWithFilteredResult(_0x27852a,_0x14aa1a){return function(_0x239fb0){if(_0x239fb0){var _0x3c4a6a=typeof _0x14aa1a[_0x4b40('0x18')]===_0x4b40('0x19')&&typeof _0x14aa1a[_0x4b40('0x1a')]===_0x4b40('0x19');var _0x3f7970=_0x239fb0[_0x4b40('0x1b')];var _0x25a083=_0x3c4a6a?0x0:_0x14aa1a[_0x4b40('0x18')];var _0x8455b0=_0x3c4a6a?_0x239fb0[_0x4b40('0x1b')]:_0x14aa1a['offset']+_0x14aa1a[_0x4b40('0x1a')];var _0x5d7804;if(_0x8455b0>=_0x3f7970){_0x8455b0=_0x3f7970;_0x5d7804=0xc8;}else{_0x5d7804=0xce;}_0x27852a['status'](_0x5d7804);return _0x27852a[_0x4b40('0x1c')](_0x4b40('0x1d'),_0x25a083+'-'+_0x8455b0+'/'+_0x3f7970)[_0x4b40('0x17')](_0x239fb0);}return null;};}function patchUpdates(_0x492ec5){return function(_0x2c1659){try{jsonpatch['apply'](_0x2c1659,_0x492ec5,!![]);}catch(_0x89404){return BPromise[_0x4b40('0x1e')](_0x89404);}return _0x2c1659[_0x4b40('0x1f')]();};}function saveUpdates(_0x2ff6c9,_0x4d54be){return function(_0x16a006){if(_0x16a006){return _0x16a006[_0x4b40('0x20')](_0x2ff6c9)[_0x4b40('0x21')](function(_0x14a3c9){return _0x14a3c9;});}return null;};}function removeEntity(_0x1aecb4,_0x4ee05f){return function(_0x53f363){if(_0x53f363){return _0x53f363[_0x4b40('0x22')]()[_0x4b40('0x21')](function(){_0x1aecb4[_0x4b40('0x15')](0xcc)[_0x4b40('0x16')]();});}};}function handleEntityNotFound(_0x310507,_0x2cfb1e){return function(_0x58dbf1){if(!_0x58dbf1){_0x310507[_0x4b40('0x23')](0x194);}return _0x58dbf1;};}function handleError(_0x242eff,_0x4b0249){_0x4b0249=_0x4b0249||0x1f4;return function(_0x16d0ea){logger[_0x4b40('0x24')](_0x16d0ea['stack']);if(_0x16d0ea[_0x4b40('0x25')]){delete _0x16d0ea[_0x4b40('0x25')];}_0x242eff[_0x4b40('0x15')](_0x4b0249)[_0x4b40('0x26')](_0x16d0ea);};}exports['index']=function(_0x293365,_0x2b33dd){var _0x264ae9={},_0x5b0e0f={},_0x2e2b78={'count':0x0,'rows':[]};var _0x39b810=_[_0x4b40('0x27')](db['FreshdeskConfiguration'][_0x4b40('0x28')],function(_0x508fe7){return{'name':_0x508fe7['fieldName'],'type':_0x508fe7[_0x4b40('0x29')]['key']};});_0x5b0e0f[_0x4b40('0x2a')]=_[_0x4b40('0x27')](_0x39b810,'name');_0x5b0e0f[_0x4b40('0x2b')]=_[_0x4b40('0x2c')](_0x293365['query']);_0x5b0e0f[_0x4b40('0x2d')]=_[_0x4b40('0x2e')](_0x5b0e0f[_0x4b40('0x2a')],_0x5b0e0f[_0x4b40('0x2b')]);_0x264ae9[_0x4b40('0x2f')]=_[_0x4b40('0x2e')](_0x5b0e0f[_0x4b40('0x2a')],qs[_0x4b40('0x30')](_0x293365['query'][_0x4b40('0x30')]));_0x264ae9[_0x4b40('0x2f')]=_0x264ae9[_0x4b40('0x2f')][_0x4b40('0x31')]?_0x264ae9['attributes']:_0x5b0e0f[_0x4b40('0x2a')];if(!_0x293365['query'][_0x4b40('0x32')](_0x4b40('0x33'))){_0x264ae9[_0x4b40('0x1a')]=qs[_0x4b40('0x1a')](_0x293365['query'][_0x4b40('0x1a')]);_0x264ae9[_0x4b40('0x18')]=qs[_0x4b40('0x18')](_0x293365['query'][_0x4b40('0x18')]);}_0x264ae9[_0x4b40('0x34')]=qs[_0x4b40('0x35')](_0x293365[_0x4b40('0x2b')][_0x4b40('0x35')]);_0x264ae9[_0x4b40('0x36')]=qs['filters'](_['pick'](_0x293365[_0x4b40('0x2b')],_0x5b0e0f['filters']),_0x39b810);if(_0x293365['query'][_0x4b40('0x37')]){_0x264ae9[_0x4b40('0x36')]=_[_0x4b40('0x38')](_0x264ae9['where'],{'$or':_['map'](_0x39b810,function(_0x5c71ec){if(_0x5c71ec[_0x4b40('0x29')]!==_0x4b40('0x39')){var _0x5824ea={};_0x5824ea[_0x5c71ec[_0x4b40('0x25')]]={'$like':'%'+_0x293365[_0x4b40('0x2b')][_0x4b40('0x37')]+'%'};return _0x5824ea;}})});}_0x264ae9=_['merge']({},_0x264ae9,_0x293365[_0x4b40('0x3a')]);var _0x5b71fa={'where':_0x264ae9[_0x4b40('0x36')]};return db['FreshdeskConfiguration'][_0x4b40('0x1b')](_0x5b71fa)[_0x4b40('0x21')](function(_0x51f9e0){_0x2e2b78['count']=_0x51f9e0;if(_0x293365[_0x4b40('0x2b')]['includeAll']){_0x264ae9[_0x4b40('0x3b')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x4b40('0x3c')](_0x264ae9);})[_0x4b40('0x21')](function(_0x7487fe){_0x2e2b78[_0x4b40('0x3d')]=_0x7487fe;return _0x2e2b78;})['then'](respondWithFilteredResult(_0x2b33dd,_0x264ae9))[_0x4b40('0x3e')](handleError(_0x2b33dd,null));};exports[_0x4b40('0x3f')]=function(_0x10e493,_0x46be2d){var _0x439ac3={'raw':![],'where':{'id':_0x10e493['params']['id']}},_0x46109d={};_0x46109d['model']=_['keys'](db[_0x4b40('0x40')]['rawAttributes']);_0x46109d[_0x4b40('0x2b')]=_['keys'](_0x10e493[_0x4b40('0x2b')]);_0x46109d[_0x4b40('0x2d')]=_[_0x4b40('0x2e')](_0x46109d['model'],_0x46109d[_0x4b40('0x2b')]);_0x439ac3[_0x4b40('0x2f')]=_[_0x4b40('0x2e')](_0x46109d[_0x4b40('0x2a')],qs[_0x4b40('0x30')](_0x10e493['query'][_0x4b40('0x30')]));_0x439ac3[_0x4b40('0x2f')]=_0x439ac3[_0x4b40('0x2f')][_0x4b40('0x31')]?_0x439ac3[_0x4b40('0x2f')]:_0x46109d[_0x4b40('0x2a')];if(_0x10e493[_0x4b40('0x2b')]['includeAll']){_0x439ac3[_0x4b40('0x3b')]=[{'all':!![]}];}_0x439ac3=_[_0x4b40('0x38')]({},_0x439ac3,_0x10e493[_0x4b40('0x3a')]);return db[_0x4b40('0x40')][_0x4b40('0x41')](_0x439ac3)[_0x4b40('0x21')](handleEntityNotFound(_0x46be2d,null))[_0x4b40('0x21')](respondWithResult(_0x46be2d,null))[_0x4b40('0x3e')](handleError(_0x46be2d,null));};exports[_0x4b40('0x42')]=function(_0x294b5a,_0x3c3339){return db['FreshdeskConfiguration']['create'](_0x294b5a['body'],{})[_0x4b40('0x21')](respondWithResult(_0x3c3339,0xc9))['catch'](handleError(_0x3c3339,null));};exports[_0x4b40('0x20')]=function(_0x30b820,_0x30123e){if(_0x30b820['body']['id']){delete _0x30b820[_0x4b40('0x43')]['id'];}return db['FreshdeskConfiguration'][_0x4b40('0x41')]({'where':{'id':_0x30b820['params']['id']}})[_0x4b40('0x21')](handleEntityNotFound(_0x30123e,null))[_0x4b40('0x21')](saveUpdates(_0x30b820[_0x4b40('0x43')],null))[_0x4b40('0x21')](respondWithResult(_0x30123e,null))[_0x4b40('0x3e')](handleError(_0x30123e,null));};exports[_0x4b40('0x22')]=function(_0xad80d4,_0x10beaa){return db[_0x4b40('0x40')][_0x4b40('0x41')]({'where':{'id':_0xad80d4[_0x4b40('0x44')]['id']}})[_0x4b40('0x21')](handleEntityNotFound(_0x10beaa,null))[_0x4b40('0x21')](removeEntity(_0x10beaa,null))['catch'](handleError(_0x10beaa,null));};exports[_0x4b40('0x45')]=function(_0x2bf44a,_0x2890ec,_0x3f3946){var _0xdf5a41={};var _0x44055f={};var _0x20b6c0;var _0x3fbc00;return db[_0x4b40('0x40')]['findOne']({'where':{'id':_0x2bf44a[_0x4b40('0x44')]['id']}})[_0x4b40('0x21')](handleEntityNotFound(_0x2890ec,null))['then'](function(_0x24b458){if(_0x24b458){_0x20b6c0=_0x24b458;_0x44055f[_0x4b40('0x2a')]=_[_0x4b40('0x2c')](db[_0x4b40('0x46')][_0x4b40('0x28')]);_0x44055f[_0x4b40('0x2b')]=_[_0x4b40('0x2c')](_0x2bf44a[_0x4b40('0x2b')]);_0x44055f[_0x4b40('0x2d')]=_[_0x4b40('0x2e')](_0x44055f[_0x4b40('0x2a')],_0x44055f[_0x4b40('0x2b')]);_0xdf5a41[_0x4b40('0x2f')]=_[_0x4b40('0x2e')](_0x44055f[_0x4b40('0x2a')],qs[_0x4b40('0x30')](_0x2bf44a[_0x4b40('0x2b')][_0x4b40('0x30')]));_0xdf5a41[_0x4b40('0x2f')]=_0xdf5a41[_0x4b40('0x2f')][_0x4b40('0x31')]?_0xdf5a41[_0x4b40('0x2f')]:_0x44055f['model'];_0xdf5a41[_0x4b40('0x34')]=qs['sort'](_0x2bf44a[_0x4b40('0x2b')]['sort']);_0xdf5a41[_0x4b40('0x36')]=qs[_0x4b40('0x2d')](_[_0x4b40('0x47')](_0x2bf44a[_0x4b40('0x2b')],_0x44055f['filters']));if(_0x2bf44a[_0x4b40('0x2b')][_0x4b40('0x37')]){_0xdf5a41[_0x4b40('0x36')]=_[_0x4b40('0x38')](_0xdf5a41[_0x4b40('0x36')],{'$or':_[_0x4b40('0x27')](_0xdf5a41[_0x4b40('0x2f')],function(_0x7b5478){var _0x243ad1={};_0x243ad1[_0x7b5478]={'$like':'%'+_0x2bf44a[_0x4b40('0x2b')][_0x4b40('0x37')]+'%'};return _0x243ad1;})});}_0xdf5a41=_[_0x4b40('0x38')]({},_0xdf5a41,_0x2bf44a['options']);return _0x20b6c0[_0x4b40('0x45')](_0xdf5a41);}})[_0x4b40('0x21')](function(_0x48e5fe){if(_0x48e5fe){_0x3fbc00=_0x48e5fe[_0x4b40('0x31')];if(!_0x2bf44a[_0x4b40('0x2b')]['hasOwnProperty'](_0x4b40('0x33'))){_0xdf5a41['limit']=qs[_0x4b40('0x1a')](_0x2bf44a[_0x4b40('0x2b')][_0x4b40('0x1a')]);_0xdf5a41['offset']=qs[_0x4b40('0x18')](_0x2bf44a[_0x4b40('0x2b')][_0x4b40('0x18')]);}return _0x20b6c0[_0x4b40('0x45')](_0xdf5a41);}})[_0x4b40('0x21')](function(_0x1b4de7){if(_0x1b4de7){return _0x1b4de7?{'count':_0x3fbc00,'rows':_0x1b4de7}:null;}})['then'](respondWithResult(_0x2890ec,null))[_0x4b40('0x3e')](handleError(_0x2890ec,null));};exports[_0x4b40('0x48')]=function(_0x2ac2d9,_0x32054c,_0x3fd97c){var _0x38cb5e={};var _0x5827f8={};var _0x111af6;var _0x4491f4;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x2ac2d9['params']['id']}})[_0x4b40('0x21')](handleEntityNotFound(_0x32054c,null))['then'](function(_0x2d7e86){if(_0x2d7e86){_0x111af6=_0x2d7e86;_0x5827f8[_0x4b40('0x2a')]=_[_0x4b40('0x2c')](db[_0x4b40('0x46')]['rawAttributes']);_0x5827f8[_0x4b40('0x2b')]=_[_0x4b40('0x2c')](_0x2ac2d9['query']);_0x5827f8['filters']=_[_0x4b40('0x2e')](_0x5827f8['model'],_0x5827f8[_0x4b40('0x2b')]);_0x38cb5e[_0x4b40('0x2f')]=_[_0x4b40('0x2e')](_0x5827f8['model'],qs[_0x4b40('0x30')](_0x2ac2d9['query'][_0x4b40('0x30')]));_0x38cb5e[_0x4b40('0x2f')]=_0x38cb5e[_0x4b40('0x2f')][_0x4b40('0x31')]?_0x38cb5e[_0x4b40('0x2f')]:_0x5827f8[_0x4b40('0x2a')];_0x38cb5e[_0x4b40('0x34')]=qs[_0x4b40('0x35')](_0x2ac2d9[_0x4b40('0x2b')][_0x4b40('0x35')]);_0x38cb5e[_0x4b40('0x36')]=qs[_0x4b40('0x2d')](_[_0x4b40('0x47')](_0x2ac2d9['query'],_0x5827f8['filters']));if(_0x2ac2d9[_0x4b40('0x2b')][_0x4b40('0x37')]){_0x38cb5e[_0x4b40('0x36')]=_[_0x4b40('0x38')](_0x38cb5e[_0x4b40('0x36')],{'$or':_[_0x4b40('0x27')](_0x38cb5e['attributes'],function(_0x4e1dba){var _0x937c9e={};_0x937c9e[_0x4e1dba]={'$like':'%'+_0x2ac2d9[_0x4b40('0x2b')][_0x4b40('0x37')]+'%'};return _0x937c9e;})});}_0x38cb5e=_['merge']({},_0x38cb5e,_0x2ac2d9[_0x4b40('0x3a')]);return _0x111af6[_0x4b40('0x48')](_0x38cb5e);}})[_0x4b40('0x21')](function(_0x160f27){if(_0x160f27){_0x4491f4=_0x160f27[_0x4b40('0x31')];if(!_0x2ac2d9[_0x4b40('0x2b')]['hasOwnProperty'](_0x4b40('0x33'))){_0x38cb5e[_0x4b40('0x1a')]=qs['limit'](_0x2ac2d9[_0x4b40('0x2b')][_0x4b40('0x1a')]);_0x38cb5e[_0x4b40('0x18')]=qs[_0x4b40('0x18')](_0x2ac2d9[_0x4b40('0x2b')]['offset']);}return _0x111af6['getSubjects'](_0x38cb5e);}})[_0x4b40('0x21')](function(_0x130891){if(_0x130891){return _0x130891?{'count':_0x4491f4,'rows':_0x130891}:null;}})['then'](respondWithResult(_0x32054c,null))[_0x4b40('0x3e')](handleError(_0x32054c,null));};exports[_0x4b40('0x49')]=function(_0x5c5720,_0x616bdd,_0x443d4b){var _0x206eff={};var _0x39b10b={};var _0x598120;var _0xc3771f;return db[_0x4b40('0x40')][_0x4b40('0x4a')]({'where':{'id':_0x5c5720[_0x4b40('0x44')]['id']}})[_0x4b40('0x21')](handleEntityNotFound(_0x616bdd,null))[_0x4b40('0x21')](function(_0xf8500f){if(_0xf8500f){_0x598120=_0xf8500f;_0x39b10b[_0x4b40('0x2a')]=_['keys'](db[_0x4b40('0x46')][_0x4b40('0x28')]);_0x39b10b[_0x4b40('0x2b')]=_[_0x4b40('0x2c')](_0x5c5720[_0x4b40('0x2b')]);_0x39b10b['filters']=_['intersection'](_0x39b10b['model'],_0x39b10b['query']);_0x206eff[_0x4b40('0x2f')]=_[_0x4b40('0x2e')](_0x39b10b[_0x4b40('0x2a')],qs['fields'](_0x5c5720[_0x4b40('0x2b')][_0x4b40('0x30')]));_0x206eff[_0x4b40('0x2f')]=_0x206eff[_0x4b40('0x2f')]['length']?_0x206eff[_0x4b40('0x2f')]:_0x39b10b[_0x4b40('0x2a')];_0x206eff[_0x4b40('0x34')]=qs[_0x4b40('0x35')](_0x5c5720[_0x4b40('0x2b')][_0x4b40('0x35')]);_0x206eff[_0x4b40('0x36')]=qs[_0x4b40('0x2d')](_[_0x4b40('0x47')](_0x5c5720[_0x4b40('0x2b')],_0x39b10b['filters']));if(_0x5c5720[_0x4b40('0x2b')]['filter']){_0x206eff[_0x4b40('0x36')]=_[_0x4b40('0x38')](_0x206eff[_0x4b40('0x36')],{'$or':_[_0x4b40('0x27')](_0x206eff[_0x4b40('0x2f')],function(_0x1e7941){var _0x4871a0={};_0x4871a0[_0x1e7941]={'$like':'%'+_0x5c5720[_0x4b40('0x2b')][_0x4b40('0x37')]+'%'};return _0x4871a0;})});}_0x206eff=_[_0x4b40('0x38')]({},_0x206eff,_0x5c5720[_0x4b40('0x3a')]);return _0x598120[_0x4b40('0x49')](_0x206eff);}})[_0x4b40('0x21')](function(_0x1f5ab1){if(_0x1f5ab1){_0xc3771f=_0x1f5ab1[_0x4b40('0x31')];if(!_0x5c5720[_0x4b40('0x2b')][_0x4b40('0x32')](_0x4b40('0x33'))){_0x206eff[_0x4b40('0x1a')]=qs['limit'](_0x5c5720[_0x4b40('0x2b')]['limit']);_0x206eff[_0x4b40('0x18')]=qs[_0x4b40('0x18')](_0x5c5720[_0x4b40('0x2b')][_0x4b40('0x18')]);}return _0x598120[_0x4b40('0x49')](_0x206eff);}})[_0x4b40('0x21')](function(_0xeaab3){if(_0xeaab3){return _0xeaab3?{'count':_0xc3771f,'rows':_0xeaab3}:null;}})[_0x4b40('0x21')](respondWithResult(_0x616bdd,null))[_0x4b40('0x3e')](handleError(_0x616bdd,null));};exports[_0x4b40('0x4b')]=function(_0x414ffe,_0x53532c,_0xa6cb72){var _0x492f45={};var _0x33a267={};var _0x13babf;var _0x394e81;return db[_0x4b40('0x40')]['findOne']({'where':{'id':_0x414ffe['params']['id']}})[_0x4b40('0x21')](handleEntityNotFound(_0x53532c,null))['then'](function(_0x57b9a0){if(_0x57b9a0){_0x13babf=_0x57b9a0;_0x33a267[_0x4b40('0x2a')]=_[_0x4b40('0x2c')](db['Tag'][_0x4b40('0x28')]);_0x33a267['query']=_['keys'](_0x414ffe[_0x4b40('0x2b')]);_0x33a267[_0x4b40('0x2d')]=_[_0x4b40('0x2e')](_0x33a267[_0x4b40('0x2a')],_0x33a267[_0x4b40('0x2b')]);_0x492f45[_0x4b40('0x2f')]=_[_0x4b40('0x2e')](_0x33a267['model'],qs[_0x4b40('0x30')](_0x414ffe[_0x4b40('0x2b')]['fields']));_0x492f45['attributes']=_0x492f45[_0x4b40('0x2f')][_0x4b40('0x31')]?_0x492f45['attributes']:_0x33a267['model'];_0x492f45[_0x4b40('0x34')]=qs[_0x4b40('0x35')](_0x414ffe[_0x4b40('0x2b')][_0x4b40('0x35')]);_0x492f45[_0x4b40('0x36')]=qs[_0x4b40('0x2d')](_[_0x4b40('0x47')](_0x414ffe[_0x4b40('0x2b')],_0x33a267[_0x4b40('0x2d')]));if(_0x414ffe[_0x4b40('0x2b')][_0x4b40('0x37')]){_0x492f45[_0x4b40('0x36')]=_[_0x4b40('0x38')](_0x492f45[_0x4b40('0x36')],{'$or':_[_0x4b40('0x27')](_0x492f45[_0x4b40('0x2f')],function(_0x11e663){var _0x351dcd={};_0x351dcd[_0x11e663]={'$like':'%'+_0x414ffe[_0x4b40('0x2b')][_0x4b40('0x37')]+'%'};return _0x351dcd;})});}_0x492f45=_[_0x4b40('0x38')]({},_0x492f45,_0x414ffe['options']);return _0x13babf[_0x4b40('0x4b')](_0x492f45);}})[_0x4b40('0x21')](function(_0x49b2ce){if(_0x49b2ce){_0x394e81=_0x49b2ce[_0x4b40('0x31')];if(!_0x414ffe[_0x4b40('0x2b')][_0x4b40('0x32')](_0x4b40('0x33'))){_0x492f45[_0x4b40('0x1a')]=qs[_0x4b40('0x1a')](_0x414ffe[_0x4b40('0x2b')]['limit']);_0x492f45[_0x4b40('0x18')]=qs['offset'](_0x414ffe['query'][_0x4b40('0x18')]);}return _0x13babf[_0x4b40('0x4b')](_0x492f45);}})[_0x4b40('0x21')](function(_0x444363){if(_0x444363){return _0x444363?{'count':_0x394e81,'rows':_0x444363}:null;}})[_0x4b40('0x21')](respondWithResult(_0x53532c,null))['catch'](handleError(_0x53532c,null));};exports[_0x4b40('0x4c')]=function(_0x554a7d,_0x554c56,_0x1a9792){if(_0x554a7d[_0x4b40('0x43')]['id']){delete _0x554a7d[_0x4b40('0x43')]['id'];}return db[_0x4b40('0x40')][_0x4b40('0x4a')]({'where':{'id':_0x554a7d[_0x4b40('0x44')]['id']}})['then'](handleEntityNotFound(_0x554c56,null))[_0x4b40('0x21')](function(_0x504df0){if(_0x504df0){return _0x504df0['setTags'](_0x554a7d['body'][_0x4b40('0x4d')]||[]);}return null;})[_0x4b40('0x21')](respondWithResult(_0x554c56,null))[_0x4b40('0x3e')](handleError(_0x554c56,null));};
\ No newline at end of file