Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / api / intFreshdeskConfiguration / intFreshdeskConfiguration.controller.js
index 49e0767..d5a1367 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb09c=['type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','intersection','find','create','body','destroy','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','update','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge'];(function(_0x5a18bc,_0x3e7783){var _0xd861b9=function(_0x380e0b){while(--_0x380e0b){_0x5a18bc['push'](_0x5a18bc['shift']());}};_0xd861b9(++_0x3e7783);}(_0xb09c,0x77));var _0xcb09=function(_0xc4b2ac,_0x10f0d9){_0xc4b2ac=_0xc4b2ac-0x0;var _0x535c9d=_0xb09c[_0xc4b2ac];return _0x535c9d;};'use strict';var pdf=require(_0xcb09('0x0'));var emlformat=require(_0xcb09('0x1'));var rimraf=require(_0xcb09('0x2'));var zipdir=require(_0xcb09('0x3'));var jsonpatch=require(_0xcb09('0x4'));var rp=require('request-promise');var moment=require(_0xcb09('0x5'));var BPromise=require(_0xcb09('0x6'));var Mustache=require(_0xcb09('0x7'));var util=require(_0xcb09('0x8'));var path=require(_0xcb09('0x9'));var sox=require(_0xcb09('0xa'));var csv=require(_0xcb09('0xb'));var ejs=require(_0xcb09('0xc'));var fs=require('fs');var _=require(_0xcb09('0xd'));var squel=require('squel');var crypto=require(_0xcb09('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xcb09('0xf'));var toCsv=require(_0xcb09('0xb'));var querystring=require(_0xcb09('0x10'));var Papa=require(_0xcb09('0x11'));var Redis=require(_0xcb09('0x12'));var authService=require(_0xcb09('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xcb09('0x14'));var hardwareService=require(_0xcb09('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xcb09('0x16'));var licenseUtil=require(_0xcb09('0x17'));var db=require(_0xcb09('0x18'))['db'];var jayson=require(_0xcb09('0x19'));var client=jayson['client'][_0xcb09('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5094b8,_0x1fac63,_0x4ff8d4,_0x1c0b9c){return new BPromise(function(_0x127701,_0x1aebc8){var _0x5b816c=_0x1c0b9c||client;return _0x5b816c[_0xcb09('0x1b')](_0x5094b8,_0x4ff8d4)[_0xcb09('0x1c')](function(_0x56bffb){logger[_0xcb09('0x1d')](_0xcb09('0x1e'),_0x1fac63,'request\x20sent');logger['debug'](_0xcb09('0x1f'),_0x1fac63,'request\x20sent',JSON[_0xcb09('0x20')](_0x56bffb));if(_0x56bffb['error']){if(_0x56bffb[_0xcb09('0x21')]['code']===0x1f4){logger[_0xcb09('0x21')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1fac63,_0x56bffb['error'][_0xcb09('0x22')]);return _0x1aebc8(_0x56bffb['error'][_0xcb09('0x22')]);}logger[_0xcb09('0x21')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1fac63,_0x56bffb['error'][_0xcb09('0x22')]);return _0x127701(_0x56bffb[_0xcb09('0x21')][_0xcb09('0x22')]);}else{logger[_0xcb09('0x1d')](_0xcb09('0x1e'),_0x1fac63,_0xcb09('0x23'));_0x127701(_0x56bffb[_0xcb09('0x24')][_0xcb09('0x22')]);}})[_0xcb09('0x25')](function(_0x1bc197){logger[_0xcb09('0x21')](_0xcb09('0x1e'),_0x1fac63,_0x1bc197);_0x1aebc8(_0x1bc197);});});}function respondWithStatusCode(_0x51f9b2,_0x1c7dcd){_0x1c7dcd=_0x1c7dcd||0xcc;return function(_0x362d71){if(_0x362d71){return _0x51f9b2[_0xcb09('0x26')](_0x1c7dcd);}return _0x51f9b2['status'](_0x1c7dcd)[_0xcb09('0x27')]();};}function respondWithResult(_0x39368d,_0x2dd34d){_0x2dd34d=_0x2dd34d||0xc8;return function(_0xfe96b3){if(_0xfe96b3){return _0x39368d[_0xcb09('0x28')](_0x2dd34d)[_0xcb09('0x29')](_0xfe96b3);}};}function respondWithFilteredResult(_0x738db4,_0x3bbe83){return function(_0x3d6f32){if(_0x3d6f32){var _0x30c696=_0x3d6f32[_0xcb09('0x2a')],_0x47378d=_0x3bbe83[_0xcb09('0x2b')],_0x1876b4=_0x3bbe83[_0xcb09('0x2b')]+_0x3bbe83['limit'],_0x48e750;if(_0x1876b4>=_0x30c696){_0x1876b4=_0x30c696;_0x48e750=0xc8;}else{_0x48e750=0xce;}_0x738db4[_0xcb09('0x28')](_0x48e750);return _0x738db4[_0xcb09('0x2c')](_0xcb09('0x2d'),_0x47378d+'-'+_0x1876b4+'/'+_0x30c696)['json'](_0x3d6f32);}return null;};}function patchUpdates(_0x16b1c2){return function(_0x5ed4a7){try{jsonpatch[_0xcb09('0x2e')](_0x5ed4a7,_0x16b1c2,!![]);}catch(_0x1f0be6){return BPromise['reject'](_0x1f0be6);}return _0x5ed4a7['save']();};}function saveUpdates(_0x581bc3,_0x3c2662){return function(_0x32bf78){if(_0x32bf78){return _0x32bf78[_0xcb09('0x2f')](_0x581bc3)[_0xcb09('0x1c')](function(_0x4f490f){return _0x4f490f;});}return null;};}function removeEntity(_0x1a6611,_0x5eeb4e){return function(_0x324743){if(_0x324743){return _0x324743['destroy']()[_0xcb09('0x1c')](function(){_0x1a6611[_0xcb09('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a3d2,_0x2b7915){return function(_0x2a6942){if(!_0x2a6942){_0x28a3d2[_0xcb09('0x26')](0x194);}return _0x2a6942;};}function handleError(_0x2b757e,_0x49ee65){_0x49ee65=_0x49ee65||0x1f4;return function(_0x546978){logger['error'](_0x546978[_0xcb09('0x30')]);if(_0x546978[_0xcb09('0x31')]){delete _0x546978[_0xcb09('0x31')];}_0x2b757e[_0xcb09('0x28')](_0x49ee65)[_0xcb09('0x32')](_0x546978);};}exports['index']=function(_0x824228,_0x58a24f){var _0x19a233={},_0x40cb61={},_0x3b8764={'count':0x0,'rows':[]};var _0x4dc5fb=_[_0xcb09('0x33')](db[_0xcb09('0x34')][_0xcb09('0x35')],function(_0x4eb97f){return{'name':_0x4eb97f[_0xcb09('0x36')],'type':_0x4eb97f['type'][_0xcb09('0x37')]};});_0x40cb61[_0xcb09('0x38')]=_[_0xcb09('0x33')](_0x4dc5fb,_0xcb09('0x31'));_0x40cb61[_0xcb09('0x39')]=_[_0xcb09('0x3a')](_0x824228[_0xcb09('0x39')]);_0x40cb61['filters']=_['intersection'](_0x40cb61['model'],_0x40cb61[_0xcb09('0x39')]);_0x19a233[_0xcb09('0x3b')]=_['intersection'](_0x40cb61['model'],qs[_0xcb09('0x3c')](_0x824228[_0xcb09('0x39')][_0xcb09('0x3c')]));_0x19a233['attributes']=_0x19a233[_0xcb09('0x3b')][_0xcb09('0x3d')]?_0x19a233[_0xcb09('0x3b')]:_0x40cb61['model'];if(!_0x824228['query'][_0xcb09('0x3e')](_0xcb09('0x3f'))){_0x19a233['limit']=qs[_0xcb09('0x40')](_0x824228[_0xcb09('0x39')][_0xcb09('0x40')]);_0x19a233[_0xcb09('0x2b')]=qs[_0xcb09('0x2b')](_0x824228[_0xcb09('0x39')][_0xcb09('0x2b')]);}_0x19a233[_0xcb09('0x41')]=qs[_0xcb09('0x42')](_0x824228[_0xcb09('0x39')][_0xcb09('0x42')]);_0x19a233[_0xcb09('0x43')]=qs[_0xcb09('0x44')](_[_0xcb09('0x45')](_0x824228['query'],_0x40cb61[_0xcb09('0x44')]),_0x4dc5fb);if(_0x824228[_0xcb09('0x39')]['filter']){_0x19a233[_0xcb09('0x43')]=_[_0xcb09('0x46')](_0x19a233[_0xcb09('0x43')],{'$or':_[_0xcb09('0x33')](_0x4dc5fb,function(_0x44bbac){if(_0x44bbac[_0xcb09('0x47')]!==_0xcb09('0x48')){var _0x104edb={};_0x104edb[_0x44bbac[_0xcb09('0x31')]]={'$like':'%'+_0x824228['query'][_0xcb09('0x49')]+'%'};return _0x104edb;}})});}_0x19a233=_[_0xcb09('0x46')]({},_0x19a233,_0x824228[_0xcb09('0x4a')]);var _0xcf0925={'where':_0x19a233[_0xcb09('0x43')]};return db[_0xcb09('0x34')]['count'](_0xcf0925)[_0xcb09('0x1c')](function(_0x5db247){_0x3b8764[_0xcb09('0x2a')]=_0x5db247;if(_0x824228[_0xcb09('0x39')][_0xcb09('0x4b')]){_0x19a233[_0xcb09('0x4c')]=[{'all':!![]}];}return db[_0xcb09('0x34')][_0xcb09('0x4d')](_0x19a233);})[_0xcb09('0x1c')](function(_0x460835){_0x3b8764[_0xcb09('0x4e')]=_0x460835;return _0x3b8764;})['then'](respondWithFilteredResult(_0x58a24f,_0x19a233))[_0xcb09('0x25')](handleError(_0x58a24f,null));};exports[_0xcb09('0x4f')]=function(_0xb56f8e,_0x16a3e6){var _0x56b10e={'raw':![],'where':{'id':_0xb56f8e[_0xcb09('0x50')]['id']}},_0x55d983={};_0x55d983['model']=_[_0xcb09('0x3a')](db[_0xcb09('0x34')][_0xcb09('0x35')]);_0x55d983[_0xcb09('0x39')]=_[_0xcb09('0x3a')](_0xb56f8e[_0xcb09('0x39')]);_0x55d983['filters']=_[_0xcb09('0x51')](_0x55d983[_0xcb09('0x38')],_0x55d983['query']);_0x56b10e[_0xcb09('0x3b')]=_[_0xcb09('0x51')](_0x55d983[_0xcb09('0x38')],qs[_0xcb09('0x3c')](_0xb56f8e[_0xcb09('0x39')][_0xcb09('0x3c')]));_0x56b10e[_0xcb09('0x3b')]=_0x56b10e[_0xcb09('0x3b')][_0xcb09('0x3d')]?_0x56b10e[_0xcb09('0x3b')]:_0x55d983[_0xcb09('0x38')];if(_0xb56f8e[_0xcb09('0x39')][_0xcb09('0x4b')]){_0x56b10e[_0xcb09('0x4c')]=[{'all':!![]}];}_0x56b10e=_[_0xcb09('0x46')]({},_0x56b10e,_0xb56f8e[_0xcb09('0x4a')]);return db[_0xcb09('0x34')][_0xcb09('0x52')](_0x56b10e)[_0xcb09('0x1c')](handleEntityNotFound(_0x16a3e6,null))[_0xcb09('0x1c')](respondWithResult(_0x16a3e6,null))[_0xcb09('0x25')](handleError(_0x16a3e6,null));};exports['create']=function(_0x5246e7,_0x552c9a){return db['FreshdeskConfiguration'][_0xcb09('0x53')](_0x5246e7[_0xcb09('0x54')],{})[_0xcb09('0x1c')](respondWithResult(_0x552c9a,0xc9))[_0xcb09('0x25')](handleError(_0x552c9a,null));};exports[_0xcb09('0x2f')]=function(_0x124391,_0x53bfdb){if(_0x124391[_0xcb09('0x54')]['id']){delete _0x124391['body']['id'];}return db[_0xcb09('0x34')][_0xcb09('0x52')]({'where':{'id':_0x124391['params']['id']}})['then'](handleEntityNotFound(_0x53bfdb,null))[_0xcb09('0x1c')](saveUpdates(_0x124391[_0xcb09('0x54')],null))[_0xcb09('0x1c')](respondWithResult(_0x53bfdb,null))[_0xcb09('0x25')](handleError(_0x53bfdb,null));};exports[_0xcb09('0x55')]=function(_0x51bf39,_0xd0b90f){return db[_0xcb09('0x34')][_0xcb09('0x52')]({'where':{'id':_0x51bf39[_0xcb09('0x50')]['id']}})['then'](handleEntityNotFound(_0xd0b90f,null))[_0xcb09('0x1c')](removeEntity(_0xd0b90f,null))['catch'](handleError(_0xd0b90f,null));};exports[_0xcb09('0x56')]=function(_0x2bcd98,_0xc470a0,_0x5c2b92){var _0x37b61c={};var _0x2d7f84={};var _0x2b112c;var _0x164a08;return db[_0xcb09('0x34')][_0xcb09('0x57')]({'where':{'id':_0x2bcd98[_0xcb09('0x50')]['id']}})[_0xcb09('0x1c')](handleEntityNotFound(_0xc470a0,null))[_0xcb09('0x1c')](function(_0x22b997){if(_0x22b997){_0x2b112c=_0x22b997;_0x2d7f84[_0xcb09('0x38')]=_[_0xcb09('0x3a')](db[_0xcb09('0x58')]['rawAttributes']);_0x2d7f84[_0xcb09('0x39')]=_[_0xcb09('0x3a')](_0x2bcd98[_0xcb09('0x39')]);_0x2d7f84[_0xcb09('0x44')]=_[_0xcb09('0x51')](_0x2d7f84[_0xcb09('0x38')],_0x2d7f84[_0xcb09('0x39')]);_0x37b61c[_0xcb09('0x3b')]=_['intersection'](_0x2d7f84['model'],qs[_0xcb09('0x3c')](_0x2bcd98[_0xcb09('0x39')][_0xcb09('0x3c')]));_0x37b61c['attributes']=_0x37b61c['attributes']['length']?_0x37b61c[_0xcb09('0x3b')]:_0x2d7f84[_0xcb09('0x38')];_0x37b61c[_0xcb09('0x41')]=qs['sort'](_0x2bcd98['query'][_0xcb09('0x42')]);_0x37b61c[_0xcb09('0x43')]=qs[_0xcb09('0x44')](_[_0xcb09('0x45')](_0x2bcd98['query'],_0x2d7f84[_0xcb09('0x44')]));if(_0x2bcd98[_0xcb09('0x39')]['filter']){_0x37b61c[_0xcb09('0x43')]=_[_0xcb09('0x46')](_0x37b61c[_0xcb09('0x43')],{'$or':_[_0xcb09('0x33')](_0x37b61c['attributes'],function(_0x1b5cdc){var _0x273f7e={};_0x273f7e[_0x1b5cdc]={'$like':'%'+_0x2bcd98['query']['filter']+'%'};return _0x273f7e;})});}_0x37b61c=_[_0xcb09('0x46')]({},_0x37b61c,_0x2bcd98[_0xcb09('0x4a')]);return _0x2b112c[_0xcb09('0x56')](_0x37b61c);}})[_0xcb09('0x1c')](function(_0x5b8ebd){if(_0x5b8ebd){_0x164a08=_0x5b8ebd[_0xcb09('0x3d')];if(!_0x2bcd98[_0xcb09('0x39')][_0xcb09('0x3e')]('nolimit')){_0x37b61c['limit']=qs['limit'](_0x2bcd98[_0xcb09('0x39')]['limit']);_0x37b61c[_0xcb09('0x2b')]=qs[_0xcb09('0x2b')](_0x2bcd98[_0xcb09('0x39')][_0xcb09('0x2b')]);}return _0x2b112c[_0xcb09('0x56')](_0x37b61c);}})[_0xcb09('0x1c')](function(_0x1f6be1){if(_0x1f6be1){return _0x1f6be1?{'count':_0x164a08,'rows':_0x1f6be1}:null;}})[_0xcb09('0x1c')](respondWithResult(_0xc470a0,null))[_0xcb09('0x25')](handleError(_0xc470a0,null));};exports['getSubjects']=function(_0x21c429,_0x57cac7,_0x1038cb){var _0x4560f0={};var _0x3cf03d={};var _0xef7d9b;var _0x1064a2;return db[_0xcb09('0x34')][_0xcb09('0x57')]({'where':{'id':_0x21c429[_0xcb09('0x50')]['id']}})[_0xcb09('0x1c')](handleEntityNotFound(_0x57cac7,null))[_0xcb09('0x1c')](function(_0x5e2fb7){if(_0x5e2fb7){_0xef7d9b=_0x5e2fb7;_0x3cf03d[_0xcb09('0x38')]=_['keys'](db['FreshdeskField'][_0xcb09('0x35')]);_0x3cf03d[_0xcb09('0x39')]=_[_0xcb09('0x3a')](_0x21c429[_0xcb09('0x39')]);_0x3cf03d[_0xcb09('0x44')]=_['intersection'](_0x3cf03d['model'],_0x3cf03d[_0xcb09('0x39')]);_0x4560f0[_0xcb09('0x3b')]=_[_0xcb09('0x51')](_0x3cf03d[_0xcb09('0x38')],qs['fields'](_0x21c429[_0xcb09('0x39')][_0xcb09('0x3c')]));_0x4560f0['attributes']=_0x4560f0[_0xcb09('0x3b')][_0xcb09('0x3d')]?_0x4560f0[_0xcb09('0x3b')]:_0x3cf03d[_0xcb09('0x38')];_0x4560f0[_0xcb09('0x41')]=qs['sort'](_0x21c429['query'][_0xcb09('0x42')]);_0x4560f0[_0xcb09('0x43')]=qs['filters'](_[_0xcb09('0x45')](_0x21c429[_0xcb09('0x39')],_0x3cf03d[_0xcb09('0x44')]));if(_0x21c429[_0xcb09('0x39')][_0xcb09('0x49')]){_0x4560f0[_0xcb09('0x43')]=_[_0xcb09('0x46')](_0x4560f0[_0xcb09('0x43')],{'$or':_[_0xcb09('0x33')](_0x4560f0[_0xcb09('0x3b')],function(_0x535a5d){var _0x231226={};_0x231226[_0x535a5d]={'$like':'%'+_0x21c429[_0xcb09('0x39')][_0xcb09('0x49')]+'%'};return _0x231226;})});}_0x4560f0=_['merge']({},_0x4560f0,_0x21c429[_0xcb09('0x4a')]);return _0xef7d9b[_0xcb09('0x59')](_0x4560f0);}})['then'](function(_0x1a7f09){if(_0x1a7f09){_0x1064a2=_0x1a7f09[_0xcb09('0x3d')];if(!_0x21c429[_0xcb09('0x39')]['hasOwnProperty'](_0xcb09('0x3f'))){_0x4560f0[_0xcb09('0x40')]=qs[_0xcb09('0x40')](_0x21c429['query'][_0xcb09('0x40')]);_0x4560f0[_0xcb09('0x2b')]=qs[_0xcb09('0x2b')](_0x21c429[_0xcb09('0x39')]['offset']);}return _0xef7d9b[_0xcb09('0x59')](_0x4560f0);}})['then'](function(_0x1a830a){if(_0x1a830a){return _0x1a830a?{'count':_0x1064a2,'rows':_0x1a830a}:null;}})['then'](respondWithResult(_0x57cac7,null))[_0xcb09('0x25')](handleError(_0x57cac7,null));};exports[_0xcb09('0x5a')]=function(_0x428e89,_0x360a17,_0x5742f2){var _0x55c10d={};var _0x5cf307={};var _0x4abb3a;var _0x13bfdb;return db[_0xcb09('0x34')][_0xcb09('0x57')]({'where':{'id':_0x428e89[_0xcb09('0x50')]['id']}})[_0xcb09('0x1c')](handleEntityNotFound(_0x360a17,null))[_0xcb09('0x1c')](function(_0x38796f){if(_0x38796f){_0x4abb3a=_0x38796f;_0x5cf307[_0xcb09('0x38')]=_['keys'](db[_0xcb09('0x58')][_0xcb09('0x35')]);_0x5cf307[_0xcb09('0x39')]=_[_0xcb09('0x3a')](_0x428e89[_0xcb09('0x39')]);_0x5cf307['filters']=_[_0xcb09('0x51')](_0x5cf307[_0xcb09('0x38')],_0x5cf307[_0xcb09('0x39')]);_0x55c10d[_0xcb09('0x3b')]=_[_0xcb09('0x51')](_0x5cf307[_0xcb09('0x38')],qs['fields'](_0x428e89[_0xcb09('0x39')]['fields']));_0x55c10d[_0xcb09('0x3b')]=_0x55c10d[_0xcb09('0x3b')][_0xcb09('0x3d')]?_0x55c10d[_0xcb09('0x3b')]:_0x5cf307[_0xcb09('0x38')];_0x55c10d[_0xcb09('0x41')]=qs[_0xcb09('0x42')](_0x428e89[_0xcb09('0x39')][_0xcb09('0x42')]);_0x55c10d[_0xcb09('0x43')]=qs[_0xcb09('0x44')](_[_0xcb09('0x45')](_0x428e89[_0xcb09('0x39')],_0x5cf307[_0xcb09('0x44')]));if(_0x428e89[_0xcb09('0x39')][_0xcb09('0x49')]){_0x55c10d[_0xcb09('0x43')]=_[_0xcb09('0x46')](_0x55c10d['where'],{'$or':_[_0xcb09('0x33')](_0x55c10d[_0xcb09('0x3b')],function(_0x14e3ef){var _0x42827a={};_0x42827a[_0x14e3ef]={'$like':'%'+_0x428e89[_0xcb09('0x39')][_0xcb09('0x49')]+'%'};return _0x42827a;})});}_0x55c10d=_[_0xcb09('0x46')]({},_0x55c10d,_0x428e89[_0xcb09('0x4a')]);return _0x4abb3a[_0xcb09('0x5a')](_0x55c10d);}})[_0xcb09('0x1c')](function(_0x294404){if(_0x294404){_0x13bfdb=_0x294404['length'];if(!_0x428e89['query'][_0xcb09('0x3e')](_0xcb09('0x3f'))){_0x55c10d['limit']=qs[_0xcb09('0x40')](_0x428e89['query'][_0xcb09('0x40')]);_0x55c10d[_0xcb09('0x2b')]=qs['offset'](_0x428e89[_0xcb09('0x39')]['offset']);}return _0x4abb3a['getDescriptions'](_0x55c10d);}})[_0xcb09('0x1c')](function(_0x422465){if(_0x422465){return _0x422465?{'count':_0x13bfdb,'rows':_0x422465}:null;}})[_0xcb09('0x1c')](respondWithResult(_0x360a17,null))[_0xcb09('0x25')](handleError(_0x360a17,null));};exports[_0xcb09('0x5b')]=function(_0x1865d1,_0x391b53,_0x50111b){var _0x2d352d={};var _0x26c37f={};var _0x46d042;var _0xe68e40;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x1865d1[_0xcb09('0x50')]['id']}})[_0xcb09('0x1c')](handleEntityNotFound(_0x391b53,null))['then'](function(_0x4b5271){if(_0x4b5271){_0x46d042=_0x4b5271;_0x26c37f[_0xcb09('0x38')]=_[_0xcb09('0x3a')](db[_0xcb09('0x5c')]['rawAttributes']);_0x26c37f['query']=_['keys'](_0x1865d1['query']);_0x26c37f[_0xcb09('0x44')]=_[_0xcb09('0x51')](_0x26c37f[_0xcb09('0x38')],_0x26c37f[_0xcb09('0x39')]);_0x2d352d[_0xcb09('0x3b')]=_[_0xcb09('0x51')](_0x26c37f[_0xcb09('0x38')],qs[_0xcb09('0x3c')](_0x1865d1['query'][_0xcb09('0x3c')]));_0x2d352d[_0xcb09('0x3b')]=_0x2d352d['attributes'][_0xcb09('0x3d')]?_0x2d352d['attributes']:_0x26c37f['model'];_0x2d352d[_0xcb09('0x41')]=qs[_0xcb09('0x42')](_0x1865d1['query']['sort']);_0x2d352d[_0xcb09('0x43')]=qs[_0xcb09('0x44')](_[_0xcb09('0x45')](_0x1865d1['query'],_0x26c37f[_0xcb09('0x44')]));if(_0x1865d1[_0xcb09('0x39')][_0xcb09('0x49')]){_0x2d352d[_0xcb09('0x43')]=_[_0xcb09('0x46')](_0x2d352d[_0xcb09('0x43')],{'$or':_['map'](_0x2d352d[_0xcb09('0x3b')],function(_0x982951){var _0x577660={};_0x577660[_0x982951]={'$like':'%'+_0x1865d1['query'][_0xcb09('0x49')]+'%'};return _0x577660;})});}_0x2d352d=_[_0xcb09('0x46')]({},_0x2d352d,_0x1865d1[_0xcb09('0x4a')]);return _0x46d042[_0xcb09('0x5b')](_0x2d352d);}})[_0xcb09('0x1c')](function(_0x55b3ef){if(_0x55b3ef){_0xe68e40=_0x55b3ef[_0xcb09('0x3d')];if(!_0x1865d1['query']['hasOwnProperty'](_0xcb09('0x3f'))){_0x2d352d[_0xcb09('0x40')]=qs[_0xcb09('0x40')](_0x1865d1['query'][_0xcb09('0x40')]);_0x2d352d[_0xcb09('0x2b')]=qs[_0xcb09('0x2b')](_0x1865d1[_0xcb09('0x39')][_0xcb09('0x2b')]);}return _0x46d042[_0xcb09('0x5b')](_0x2d352d);}})['then'](function(_0x5d4b56){if(_0x5d4b56){return _0x5d4b56?{'count':_0xe68e40,'rows':_0x5d4b56}:null;}})[_0xcb09('0x1c')](respondWithResult(_0x391b53,null))[_0xcb09('0x25')](handleError(_0x391b53,null));};exports[_0xcb09('0x5d')]=function(_0x7264a2,_0xdcc38,_0x42ea29){if(_0x7264a2['body']['id']){delete _0x7264a2['body']['id'];}return db[_0xcb09('0x34')]['findOne']({'where':{'id':_0x7264a2['params']['id']}})[_0xcb09('0x1c')](handleEntityNotFound(_0xdcc38,null))[_0xcb09('0x1c')](function(_0x581061){if(_0x581061){return _0x581061[_0xcb09('0x5d')](_0x7264a2[_0xcb09('0x54')][_0xcb09('0x5e')]||[]);}return null;})[_0xcb09('0x1c')](respondWithResult(_0xdcc38,null))['catch'](handleError(_0xdcc38,null));};
\ No newline at end of file
+var _0xd117=['../../config/license/util','../../mysqldb','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','update','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FreshdeskConfiguration','rows','show','keys','find','create','body','params','getFields','findOne','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x32814c,_0x2a68f5){var _0x394c8d=function(_0x10d48e){while(--_0x10d48e){_0x32814c['push'](_0x32814c['shift']());}};_0x394c8d(++_0x2a68f5);}(_0xd117,0x1c8));var _0x7d11=function(_0x872b02,_0x4f4458){_0x872b02=_0x872b02-0x0;var _0x1a6b24=_0xd117[_0x872b02];return _0x1a6b24;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7d11('0x2'));var rp=require('request-promise');var moment=require(_0x7d11('0x3'));var BPromise=require(_0x7d11('0x4'));var Mustache=require('mustache');var util=require(_0x7d11('0x5'));var path=require(_0x7d11('0x6'));var sox=require('sox');var csv=require(_0x7d11('0x7'));var ejs=require(_0x7d11('0x8'));var fs=require('fs');var fs_extra=require(_0x7d11('0x9'));var _=require('lodash');var squel=require(_0x7d11('0xa'));var crypto=require(_0x7d11('0xb'));var jsforce=require(_0x7d11('0xc'));var deskjs=require(_0x7d11('0xd'));var toCsv=require(_0x7d11('0x7'));var querystring=require(_0x7d11('0xe'));var Papa=require(_0x7d11('0xf'));var Redis=require(_0x7d11('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7d11('0x11'));var as=require(_0x7d11('0x12'));var hardwareService=require(_0x7d11('0x13'));var logger=require(_0x7d11('0x14'))(_0x7d11('0x15'));var utils=require(_0x7d11('0x16'));var config=require(_0x7d11('0x17'));var licenseUtil=require(_0x7d11('0x18'));var db=require(_0x7d11('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7d11('0x1a')][_0x7d11('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3291fa,_0x2d7176,_0x25bdc8,_0x3f8910){return new BPromise(function(_0x314a3b,_0x33004d){var _0x5d1eb4=_0x3f8910||client;return _0x5d1eb4[_0x7d11('0x1c')](_0x3291fa,_0x25bdc8)[_0x7d11('0x1d')](function(_0x5a36cd){logger[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x2d7176,'request\x20sent');logger[_0x7d11('0x20')](_0x7d11('0x21'),_0x2d7176,_0x7d11('0x22'),JSON[_0x7d11('0x23')](_0x5a36cd));if(_0x5a36cd[_0x7d11('0x24')]){if(_0x5a36cd[_0x7d11('0x24')][_0x7d11('0x25')]===0x1f4){logger[_0x7d11('0x24')](_0x7d11('0x1f'),_0x2d7176,_0x5a36cd['error'][_0x7d11('0x26')]);return _0x33004d(_0x5a36cd[_0x7d11('0x24')][_0x7d11('0x26')]);}logger[_0x7d11('0x24')](_0x7d11('0x1f'),_0x2d7176,_0x5a36cd[_0x7d11('0x24')][_0x7d11('0x26')]);return _0x314a3b(_0x5a36cd[_0x7d11('0x24')][_0x7d11('0x26')]);}else{logger[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x2d7176,'request\x20sent');_0x314a3b(_0x5a36cd[_0x7d11('0x27')][_0x7d11('0x26')]);}})[_0x7d11('0x28')](function(_0x4e7311){logger[_0x7d11('0x24')](_0x7d11('0x1f'),_0x2d7176,_0x4e7311);_0x33004d(_0x4e7311);});});}function respondWithStatusCode(_0x354684,_0x1e4e22){_0x1e4e22=_0x1e4e22||0xcc;return function(_0x27df09){if(_0x27df09){return _0x354684[_0x7d11('0x29')](_0x1e4e22);}return _0x354684['status'](_0x1e4e22)[_0x7d11('0x2a')]();};}function respondWithResult(_0x162d24,_0x212a38){_0x212a38=_0x212a38||0xc8;return function(_0x593de0){if(_0x593de0){return _0x162d24[_0x7d11('0x2b')](_0x212a38)[_0x7d11('0x2c')](_0x593de0);}};}function respondWithFilteredResult(_0x113fd8,_0x56db93){return function(_0x3f2ac8){if(_0x3f2ac8){var _0x4fc367=typeof _0x56db93[_0x7d11('0x2d')]===_0x7d11('0x2e')&&typeof _0x56db93[_0x7d11('0x2f')]==='undefined';var _0x44bebe=_0x3f2ac8['count'];var _0x3d915c=_0x4fc367?0x0:_0x56db93['offset'];var _0x4db1e0=_0x4fc367?_0x3f2ac8[_0x7d11('0x30')]:_0x56db93[_0x7d11('0x2d')]+_0x56db93['limit'];var _0x5ce484;if(_0x4db1e0>=_0x44bebe){_0x4db1e0=_0x44bebe;_0x5ce484=0xc8;}else{_0x5ce484=0xce;}_0x113fd8[_0x7d11('0x2b')](_0x5ce484);return _0x113fd8['set']('Content-Range',_0x3d915c+'-'+_0x4db1e0+'/'+_0x44bebe)[_0x7d11('0x2c')](_0x3f2ac8);}return null;};}function patchUpdates(_0x2b06ab){return function(_0x49870f){try{jsonpatch[_0x7d11('0x31')](_0x49870f,_0x2b06ab,!![]);}catch(_0x279e86){return BPromise[_0x7d11('0x32')](_0x279e86);}return _0x49870f['save']();};}function saveUpdates(_0x359b19,_0x1ca4e0){return function(_0x15927e){if(_0x15927e){return _0x15927e[_0x7d11('0x33')](_0x359b19)[_0x7d11('0x1d')](function(_0x271efb){return _0x271efb;});}return null;};}function removeEntity(_0xd24ff,_0x333af9){return function(_0x508505){if(_0x508505){return _0x508505[_0x7d11('0x34')]()[_0x7d11('0x1d')](function(){_0xd24ff[_0x7d11('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45c1ef,_0x40a0ea){return function(_0x3205f0){if(!_0x3205f0){_0x45c1ef[_0x7d11('0x29')](0x194);}return _0x3205f0;};}function handleError(_0x447d3d,_0x224310){_0x224310=_0x224310||0x1f4;return function(_0x202829){logger[_0x7d11('0x24')](_0x202829[_0x7d11('0x35')]);if(_0x202829[_0x7d11('0x36')]){delete _0x202829[_0x7d11('0x36')];}_0x447d3d[_0x7d11('0x2b')](_0x224310)['send'](_0x202829);};}exports[_0x7d11('0x37')]=function(_0x42d3a6,_0x1ea05f){var _0x2633f2={},_0x4e5544={},_0x28fc26={'count':0x0,'rows':[]};var _0x567a7=_[_0x7d11('0x38')](db['FreshdeskConfiguration'][_0x7d11('0x39')],function(_0x49c34f){return{'name':_0x49c34f[_0x7d11('0x3a')],'type':_0x49c34f[_0x7d11('0x3b')][_0x7d11('0x3c')]};});_0x4e5544[_0x7d11('0x3d')]=_[_0x7d11('0x38')](_0x567a7,_0x7d11('0x36'));_0x4e5544[_0x7d11('0x3e')]=_['keys'](_0x42d3a6['query']);_0x4e5544[_0x7d11('0x3f')]=_[_0x7d11('0x40')](_0x4e5544[_0x7d11('0x3d')],_0x4e5544[_0x7d11('0x3e')]);_0x2633f2[_0x7d11('0x41')]=_[_0x7d11('0x40')](_0x4e5544[_0x7d11('0x3d')],qs['fields'](_0x42d3a6['query'][_0x7d11('0x42')]));_0x2633f2[_0x7d11('0x41')]=_0x2633f2[_0x7d11('0x41')][_0x7d11('0x43')]?_0x2633f2[_0x7d11('0x41')]:_0x4e5544[_0x7d11('0x3d')];if(!_0x42d3a6[_0x7d11('0x3e')][_0x7d11('0x44')](_0x7d11('0x45'))){_0x2633f2[_0x7d11('0x2f')]=qs[_0x7d11('0x2f')](_0x42d3a6[_0x7d11('0x3e')][_0x7d11('0x2f')]);_0x2633f2[_0x7d11('0x2d')]=qs[_0x7d11('0x2d')](_0x42d3a6[_0x7d11('0x3e')][_0x7d11('0x2d')]);}_0x2633f2[_0x7d11('0x46')]=qs[_0x7d11('0x47')](_0x42d3a6['query'][_0x7d11('0x47')]);_0x2633f2[_0x7d11('0x48')]=qs[_0x7d11('0x3f')](_[_0x7d11('0x49')](_0x42d3a6['query'],_0x4e5544[_0x7d11('0x3f')]),_0x567a7);if(_0x42d3a6[_0x7d11('0x3e')][_0x7d11('0x4a')]){_0x2633f2[_0x7d11('0x48')]=_[_0x7d11('0x4b')](_0x2633f2[_0x7d11('0x48')],{'$or':_[_0x7d11('0x38')](_0x567a7,function(_0x44b490){if(_0x44b490['type']!==_0x7d11('0x4c')){var _0x18c368={};_0x18c368[_0x44b490['name']]={'$like':'%'+_0x42d3a6[_0x7d11('0x3e')]['filter']+'%'};return _0x18c368;}})});}_0x2633f2=_[_0x7d11('0x4b')]({},_0x2633f2,_0x42d3a6[_0x7d11('0x4d')]);var _0x230646={'where':_0x2633f2[_0x7d11('0x48')]};return db['FreshdeskConfiguration']['count'](_0x230646)['then'](function(_0x404a13){_0x28fc26[_0x7d11('0x30')]=_0x404a13;if(_0x42d3a6['query'][_0x7d11('0x4e')]){_0x2633f2[_0x7d11('0x4f')]=[{'all':!![]}];}return db[_0x7d11('0x50')]['findAll'](_0x2633f2);})[_0x7d11('0x1d')](function(_0x1dca74){_0x28fc26[_0x7d11('0x51')]=_0x1dca74;return _0x28fc26;})[_0x7d11('0x1d')](respondWithFilteredResult(_0x1ea05f,_0x2633f2))[_0x7d11('0x28')](handleError(_0x1ea05f,null));};exports[_0x7d11('0x52')]=function(_0x15d709,_0x234e67){var _0x53b2d4={'raw':![],'where':{'id':_0x15d709['params']['id']}},_0x450c6a={};_0x450c6a[_0x7d11('0x3d')]=_[_0x7d11('0x53')](db['FreshdeskConfiguration']['rawAttributes']);_0x450c6a['query']=_[_0x7d11('0x53')](_0x15d709['query']);_0x450c6a[_0x7d11('0x3f')]=_[_0x7d11('0x40')](_0x450c6a[_0x7d11('0x3d')],_0x450c6a[_0x7d11('0x3e')]);_0x53b2d4[_0x7d11('0x41')]=_[_0x7d11('0x40')](_0x450c6a['model'],qs[_0x7d11('0x42')](_0x15d709[_0x7d11('0x3e')][_0x7d11('0x42')]));_0x53b2d4['attributes']=_0x53b2d4['attributes'][_0x7d11('0x43')]?_0x53b2d4['attributes']:_0x450c6a['model'];if(_0x15d709[_0x7d11('0x3e')]['includeAll']){_0x53b2d4['include']=[{'all':!![]}];}_0x53b2d4=_['merge']({},_0x53b2d4,_0x15d709[_0x7d11('0x4d')]);return db[_0x7d11('0x50')][_0x7d11('0x54')](_0x53b2d4)['then'](handleEntityNotFound(_0x234e67,null))[_0x7d11('0x1d')](respondWithResult(_0x234e67,null))[_0x7d11('0x28')](handleError(_0x234e67,null));};exports[_0x7d11('0x55')]=function(_0x31c680,_0x48be14){return db['FreshdeskConfiguration'][_0x7d11('0x55')](_0x31c680[_0x7d11('0x56')],{})[_0x7d11('0x1d')](respondWithResult(_0x48be14,0xc9))[_0x7d11('0x28')](handleError(_0x48be14,null));};exports[_0x7d11('0x33')]=function(_0x488810,_0x333c31){if(_0x488810['body']['id']){delete _0x488810['body']['id'];}return db['FreshdeskConfiguration'][_0x7d11('0x54')]({'where':{'id':_0x488810[_0x7d11('0x57')]['id']}})['then'](handleEntityNotFound(_0x333c31,null))[_0x7d11('0x1d')](saveUpdates(_0x488810['body'],null))[_0x7d11('0x1d')](respondWithResult(_0x333c31,null))[_0x7d11('0x28')](handleError(_0x333c31,null));};exports[_0x7d11('0x34')]=function(_0x1fdc14,_0xc51f7c){return db[_0x7d11('0x50')][_0x7d11('0x54')]({'where':{'id':_0x1fdc14[_0x7d11('0x57')]['id']}})[_0x7d11('0x1d')](handleEntityNotFound(_0xc51f7c,null))[_0x7d11('0x1d')](removeEntity(_0xc51f7c,null))[_0x7d11('0x28')](handleError(_0xc51f7c,null));};exports[_0x7d11('0x58')]=function(_0x2d5a41,_0x53f48e,_0x732d9f){var _0x2a4c84={};var _0x13f5cb={};var _0x57d03c;var _0x1ba34c;return db[_0x7d11('0x50')][_0x7d11('0x59')]({'where':{'id':_0x2d5a41[_0x7d11('0x57')]['id']}})[_0x7d11('0x1d')](handleEntityNotFound(_0x53f48e,null))['then'](function(_0x5ac14c){if(_0x5ac14c){_0x57d03c=_0x5ac14c;_0x13f5cb[_0x7d11('0x3d')]=_[_0x7d11('0x53')](db['FreshdeskField'][_0x7d11('0x39')]);_0x13f5cb[_0x7d11('0x3e')]=_[_0x7d11('0x53')](_0x2d5a41[_0x7d11('0x3e')]);_0x13f5cb[_0x7d11('0x3f')]=_['intersection'](_0x13f5cb['model'],_0x13f5cb[_0x7d11('0x3e')]);_0x2a4c84[_0x7d11('0x41')]=_[_0x7d11('0x40')](_0x13f5cb[_0x7d11('0x3d')],qs[_0x7d11('0x42')](_0x2d5a41['query'][_0x7d11('0x42')]));_0x2a4c84[_0x7d11('0x41')]=_0x2a4c84[_0x7d11('0x41')]['length']?_0x2a4c84[_0x7d11('0x41')]:_0x13f5cb[_0x7d11('0x3d')];_0x2a4c84[_0x7d11('0x46')]=qs[_0x7d11('0x47')](_0x2d5a41[_0x7d11('0x3e')][_0x7d11('0x47')]);_0x2a4c84[_0x7d11('0x48')]=qs['filters'](_[_0x7d11('0x49')](_0x2d5a41[_0x7d11('0x3e')],_0x13f5cb[_0x7d11('0x3f')]));if(_0x2d5a41['query'][_0x7d11('0x4a')]){_0x2a4c84[_0x7d11('0x48')]=_[_0x7d11('0x4b')](_0x2a4c84[_0x7d11('0x48')],{'$or':_['map'](_0x2a4c84[_0x7d11('0x41')],function(_0x392ea7){var _0x5b139c={};_0x5b139c[_0x392ea7]={'$like':'%'+_0x2d5a41['query'][_0x7d11('0x4a')]+'%'};return _0x5b139c;})});}_0x2a4c84=_[_0x7d11('0x4b')]({},_0x2a4c84,_0x2d5a41['options']);return _0x57d03c['getFields'](_0x2a4c84);}})[_0x7d11('0x1d')](function(_0x849835){if(_0x849835){_0x1ba34c=_0x849835[_0x7d11('0x43')];if(!_0x2d5a41[_0x7d11('0x3e')][_0x7d11('0x44')]('nolimit')){_0x2a4c84[_0x7d11('0x2f')]=qs[_0x7d11('0x2f')](_0x2d5a41[_0x7d11('0x3e')][_0x7d11('0x2f')]);_0x2a4c84[_0x7d11('0x2d')]=qs[_0x7d11('0x2d')](_0x2d5a41[_0x7d11('0x3e')][_0x7d11('0x2d')]);}return _0x57d03c[_0x7d11('0x58')](_0x2a4c84);}})[_0x7d11('0x1d')](function(_0x135860){if(_0x135860){return _0x135860?{'count':_0x1ba34c,'rows':_0x135860}:null;}})['then'](respondWithResult(_0x53f48e,null))[_0x7d11('0x28')](handleError(_0x53f48e,null));};exports[_0x7d11('0x5a')]=function(_0x2d9cbb,_0x180a82,_0x17e103){var _0x3d3582={};var _0x289c72={};var _0x4e3946;var _0x20e761;return db[_0x7d11('0x50')][_0x7d11('0x59')]({'where':{'id':_0x2d9cbb[_0x7d11('0x57')]['id']}})[_0x7d11('0x1d')](handleEntityNotFound(_0x180a82,null))[_0x7d11('0x1d')](function(_0x128ac7){if(_0x128ac7){_0x4e3946=_0x128ac7;_0x289c72[_0x7d11('0x3d')]=_[_0x7d11('0x53')](db[_0x7d11('0x5b')]['rawAttributes']);_0x289c72[_0x7d11('0x3e')]=_[_0x7d11('0x53')](_0x2d9cbb[_0x7d11('0x3e')]);_0x289c72[_0x7d11('0x3f')]=_[_0x7d11('0x40')](_0x289c72[_0x7d11('0x3d')],_0x289c72['query']);_0x3d3582['attributes']=_[_0x7d11('0x40')](_0x289c72[_0x7d11('0x3d')],qs[_0x7d11('0x42')](_0x2d9cbb[_0x7d11('0x3e')][_0x7d11('0x42')]));_0x3d3582['attributes']=_0x3d3582['attributes']['length']?_0x3d3582[_0x7d11('0x41')]:_0x289c72['model'];_0x3d3582[_0x7d11('0x46')]=qs['sort'](_0x2d9cbb['query'][_0x7d11('0x47')]);_0x3d3582[_0x7d11('0x48')]=qs[_0x7d11('0x3f')](_[_0x7d11('0x49')](_0x2d9cbb[_0x7d11('0x3e')],_0x289c72[_0x7d11('0x3f')]));if(_0x2d9cbb[_0x7d11('0x3e')]['filter']){_0x3d3582[_0x7d11('0x48')]=_['merge'](_0x3d3582[_0x7d11('0x48')],{'$or':_[_0x7d11('0x38')](_0x3d3582[_0x7d11('0x41')],function(_0x582a47){var _0x5d8329={};_0x5d8329[_0x582a47]={'$like':'%'+_0x2d9cbb['query']['filter']+'%'};return _0x5d8329;})});}_0x3d3582=_[_0x7d11('0x4b')]({},_0x3d3582,_0x2d9cbb[_0x7d11('0x4d')]);return _0x4e3946[_0x7d11('0x5a')](_0x3d3582);}})[_0x7d11('0x1d')](function(_0x58e46a){if(_0x58e46a){_0x20e761=_0x58e46a[_0x7d11('0x43')];if(!_0x2d9cbb[_0x7d11('0x3e')][_0x7d11('0x44')](_0x7d11('0x45'))){_0x3d3582[_0x7d11('0x2f')]=qs[_0x7d11('0x2f')](_0x2d9cbb['query'][_0x7d11('0x2f')]);_0x3d3582['offset']=qs['offset'](_0x2d9cbb[_0x7d11('0x3e')][_0x7d11('0x2d')]);}return _0x4e3946[_0x7d11('0x5a')](_0x3d3582);}})['then'](function(_0x14dd62){if(_0x14dd62){return _0x14dd62?{'count':_0x20e761,'rows':_0x14dd62}:null;}})[_0x7d11('0x1d')](respondWithResult(_0x180a82,null))[_0x7d11('0x28')](handleError(_0x180a82,null));};exports['getDescriptions']=function(_0x288748,_0x21f846,_0x175f8a){var _0x594f53={};var _0x10f12d={};var _0x53f2b6;var _0x55a7f4;return db[_0x7d11('0x50')][_0x7d11('0x59')]({'where':{'id':_0x288748[_0x7d11('0x57')]['id']}})[_0x7d11('0x1d')](handleEntityNotFound(_0x21f846,null))[_0x7d11('0x1d')](function(_0x384e07){if(_0x384e07){_0x53f2b6=_0x384e07;_0x10f12d[_0x7d11('0x3d')]=_[_0x7d11('0x53')](db[_0x7d11('0x5b')][_0x7d11('0x39')]);_0x10f12d[_0x7d11('0x3e')]=_[_0x7d11('0x53')](_0x288748['query']);_0x10f12d['filters']=_['intersection'](_0x10f12d[_0x7d11('0x3d')],_0x10f12d[_0x7d11('0x3e')]);_0x594f53[_0x7d11('0x41')]=_['intersection'](_0x10f12d[_0x7d11('0x3d')],qs['fields'](_0x288748[_0x7d11('0x3e')][_0x7d11('0x42')]));_0x594f53[_0x7d11('0x41')]=_0x594f53[_0x7d11('0x41')][_0x7d11('0x43')]?_0x594f53['attributes']:_0x10f12d[_0x7d11('0x3d')];_0x594f53[_0x7d11('0x46')]=qs[_0x7d11('0x47')](_0x288748[_0x7d11('0x3e')][_0x7d11('0x47')]);_0x594f53[_0x7d11('0x48')]=qs[_0x7d11('0x3f')](_[_0x7d11('0x49')](_0x288748[_0x7d11('0x3e')],_0x10f12d['filters']));if(_0x288748[_0x7d11('0x3e')][_0x7d11('0x4a')]){_0x594f53[_0x7d11('0x48')]=_[_0x7d11('0x4b')](_0x594f53[_0x7d11('0x48')],{'$or':_['map'](_0x594f53[_0x7d11('0x41')],function(_0x49cfdf){var _0x2e8cd4={};_0x2e8cd4[_0x49cfdf]={'$like':'%'+_0x288748[_0x7d11('0x3e')]['filter']+'%'};return _0x2e8cd4;})});}_0x594f53=_[_0x7d11('0x4b')]({},_0x594f53,_0x288748['options']);return _0x53f2b6[_0x7d11('0x5c')](_0x594f53);}})['then'](function(_0x563241){if(_0x563241){_0x55a7f4=_0x563241['length'];if(!_0x288748['query'][_0x7d11('0x44')]('nolimit')){_0x594f53[_0x7d11('0x2f')]=qs[_0x7d11('0x2f')](_0x288748[_0x7d11('0x3e')][_0x7d11('0x2f')]);_0x594f53[_0x7d11('0x2d')]=qs['offset'](_0x288748['query'][_0x7d11('0x2d')]);}return _0x53f2b6['getDescriptions'](_0x594f53);}})[_0x7d11('0x1d')](function(_0x31bb58){if(_0x31bb58){return _0x31bb58?{'count':_0x55a7f4,'rows':_0x31bb58}:null;}})[_0x7d11('0x1d')](respondWithResult(_0x21f846,null))[_0x7d11('0x28')](handleError(_0x21f846,null));};exports[_0x7d11('0x5d')]=function(_0x55a69e,_0x391921,_0x518a50){var _0x38a042={};var _0x4becec={};var _0x5dce59;var _0x4bf6b3;return db[_0x7d11('0x50')]['findOne']({'where':{'id':_0x55a69e[_0x7d11('0x57')]['id']}})[_0x7d11('0x1d')](handleEntityNotFound(_0x391921,null))[_0x7d11('0x1d')](function(_0x2287c5){if(_0x2287c5){_0x5dce59=_0x2287c5;_0x4becec[_0x7d11('0x3d')]=_[_0x7d11('0x53')](db[_0x7d11('0x5e')]['rawAttributes']);_0x4becec[_0x7d11('0x3e')]=_['keys'](_0x55a69e[_0x7d11('0x3e')]);_0x4becec[_0x7d11('0x3f')]=_[_0x7d11('0x40')](_0x4becec[_0x7d11('0x3d')],_0x4becec['query']);_0x38a042['attributes']=_[_0x7d11('0x40')](_0x4becec[_0x7d11('0x3d')],qs[_0x7d11('0x42')](_0x55a69e['query']['fields']));_0x38a042[_0x7d11('0x41')]=_0x38a042[_0x7d11('0x41')][_0x7d11('0x43')]?_0x38a042[_0x7d11('0x41')]:_0x4becec['model'];_0x38a042['order']=qs[_0x7d11('0x47')](_0x55a69e[_0x7d11('0x3e')]['sort']);_0x38a042[_0x7d11('0x48')]=qs[_0x7d11('0x3f')](_[_0x7d11('0x49')](_0x55a69e[_0x7d11('0x3e')],_0x4becec['filters']));if(_0x55a69e[_0x7d11('0x3e')][_0x7d11('0x4a')]){_0x38a042[_0x7d11('0x48')]=_['merge'](_0x38a042[_0x7d11('0x48')],{'$or':_[_0x7d11('0x38')](_0x38a042['attributes'],function(_0x267cb2){var _0x5d7788={};_0x5d7788[_0x267cb2]={'$like':'%'+_0x55a69e['query'][_0x7d11('0x4a')]+'%'};return _0x5d7788;})});}_0x38a042=_['merge']({},_0x38a042,_0x55a69e[_0x7d11('0x4d')]);return _0x5dce59[_0x7d11('0x5d')](_0x38a042);}})['then'](function(_0x2ffe2e){if(_0x2ffe2e){_0x4bf6b3=_0x2ffe2e['length'];if(!_0x55a69e['query'][_0x7d11('0x44')](_0x7d11('0x45'))){_0x38a042[_0x7d11('0x2f')]=qs[_0x7d11('0x2f')](_0x55a69e['query']['limit']);_0x38a042['offset']=qs[_0x7d11('0x2d')](_0x55a69e[_0x7d11('0x3e')]['offset']);}return _0x5dce59[_0x7d11('0x5d')](_0x38a042);}})[_0x7d11('0x1d')](function(_0x49d3c5){if(_0x49d3c5){return _0x49d3c5?{'count':_0x4bf6b3,'rows':_0x49d3c5}:null;}})[_0x7d11('0x1d')](respondWithResult(_0x391921,null))['catch'](handleError(_0x391921,null));};exports[_0x7d11('0x5f')]=function(_0x29218b,_0x241c4a,_0x5673a0){if(_0x29218b['body']['id']){delete _0x29218b[_0x7d11('0x56')]['id'];}return db[_0x7d11('0x50')][_0x7d11('0x59')]({'where':{'id':_0x29218b['params']['id']}})['then'](handleEntityNotFound(_0x241c4a,null))[_0x7d11('0x1d')](function(_0x593635){if(_0x593635){return _0x593635[_0x7d11('0x5f')](_0x29218b['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x241c4a,null))[_0x7d11('0x28')](handleError(_0x241c4a,null));};
\ No newline at end of file