Built motion from commit (unavailable).|2.5.13
[motion2.git] / server / api / intFreshdeskConfiguration / intFreshdeskConfiguration.controller.js
index 8154cf0..7e10e08 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8cf2=['ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','include','findAll','catch','find','create','body','params','getFields','pick','getSubjects','findOne','FreshdeskField','order','getDescriptions','getTags','Tag','setTags'];(function(_0x4869a3,_0xc416f5){var _0x160137=function(_0x26f8e9){while(--_0x26f8e9){_0x4869a3['push'](_0x4869a3['shift']());}};_0x160137(++_0xc416f5);}(_0x8cf2,0x181));var _0x28cf=function(_0x121be5,_0x5eaad0){_0x121be5=_0x121be5-0x0;var _0x47feff=_0x8cf2[_0x121be5];return _0x47feff;};'use strict';var pdf=require(_0x28cf('0x0'));var emlformat=require(_0x28cf('0x1'));var rimraf=require(_0x28cf('0x2'));var zipdir=require(_0x28cf('0x3'));var jsonpatch=require(_0x28cf('0x4'));var rp=require(_0x28cf('0x5'));var moment=require(_0x28cf('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x28cf('0x7'));var util=require(_0x28cf('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x28cf('0x9'));var ejs=require(_0x28cf('0xa'));var fs=require('fs');var _=require(_0x28cf('0xb'));var squel=require(_0x28cf('0xc'));var crypto=require(_0x28cf('0xd'));var jsforce=require(_0x28cf('0xe'));var deskjs=require(_0x28cf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x28cf('0x10'));var Papa=require(_0x28cf('0x11'));var Redis=require(_0x28cf('0x12'));var authService=require(_0x28cf('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28cf('0x14'));var logger=require(_0x28cf('0x15'))('api');var utils=require(_0x28cf('0x16'));var config=require(_0x28cf('0x17'));var licenseUtil=require(_0x28cf('0x18'));var db=require(_0x28cf('0x19'))['db'];var jayson=require(_0x28cf('0x1a'));var client=jayson[_0x28cf('0x1b')][_0x28cf('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x478d51,_0x34beaa,_0x82dbf4,_0x4c1d6b){return new BPromise(function(_0x128f16,_0x3cd0f4){var _0x1796f6=_0x4c1d6b||client;return _0x1796f6[_0x28cf('0x1d')](_0x478d51,_0x82dbf4)['then'](function(_0x1db89a){logger[_0x28cf('0x1e')](_0x28cf('0x1f'),_0x34beaa,_0x28cf('0x20'));logger[_0x28cf('0x21')](_0x28cf('0x22'),_0x34beaa,_0x28cf('0x20'),JSON[_0x28cf('0x23')](_0x1db89a));if(_0x1db89a[_0x28cf('0x24')]){if(_0x1db89a[_0x28cf('0x24')][_0x28cf('0x25')]===0x1f4){logger['error'](_0x28cf('0x1f'),_0x34beaa,_0x1db89a[_0x28cf('0x24')]['message']);return _0x3cd0f4(_0x1db89a[_0x28cf('0x24')]['message']);}logger[_0x28cf('0x24')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x34beaa,_0x1db89a['error'][_0x28cf('0x26')]);return _0x128f16(_0x1db89a['error']['message']);}else{logger[_0x28cf('0x1e')](_0x28cf('0x1f'),_0x34beaa,'request\x20sent');_0x128f16(_0x1db89a[_0x28cf('0x27')][_0x28cf('0x26')]);}})['catch'](function(_0x36d103){logger[_0x28cf('0x24')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x34beaa,_0x36d103);_0x3cd0f4(_0x36d103);});});}function respondWithStatusCode(_0x3cd70c,_0x443dae){_0x443dae=_0x443dae||0xcc;return function(_0x444f62){if(_0x444f62){return _0x3cd70c[_0x28cf('0x28')](_0x443dae);}return _0x3cd70c[_0x28cf('0x29')](_0x443dae)[_0x28cf('0x2a')]();};}function respondWithResult(_0x592d8c,_0x1af492){_0x1af492=_0x1af492||0xc8;return function(_0x3604d3){if(_0x3604d3){return _0x592d8c['status'](_0x1af492)[_0x28cf('0x2b')](_0x3604d3);}};}function respondWithFilteredResult(_0x2935ca,_0x267d9a){return function(_0x57cdeb){if(_0x57cdeb){var _0x341006=_0x57cdeb[_0x28cf('0x2c')],_0x37c91d=_0x267d9a[_0x28cf('0x2d')],_0x1a45d3=_0x267d9a[_0x28cf('0x2d')]+_0x267d9a[_0x28cf('0x2e')],_0x359bb1;if(_0x1a45d3>=_0x341006){_0x1a45d3=_0x341006;_0x359bb1=0xc8;}else{_0x359bb1=0xce;}_0x2935ca[_0x28cf('0x29')](_0x359bb1);return _0x2935ca[_0x28cf('0x2f')](_0x28cf('0x30'),_0x37c91d+'-'+_0x1a45d3+'/'+_0x341006)[_0x28cf('0x2b')](_0x57cdeb);}return null;};}function patchUpdates(_0x4f6c89){return function(_0x2a3d1b){try{jsonpatch['apply'](_0x2a3d1b,_0x4f6c89,!![]);}catch(_0x5f133f){return BPromise[_0x28cf('0x31')](_0x5f133f);}return _0x2a3d1b[_0x28cf('0x32')]();};}function saveUpdates(_0x131e05,_0x468ef6){return function(_0x120a6c){if(_0x120a6c){return _0x120a6c[_0x28cf('0x33')](_0x131e05)[_0x28cf('0x34')](function(_0x25fb72){return _0x25fb72;});}return null;};}function removeEntity(_0x4114f7,_0x5a9f42){return function(_0x3eb33b){if(_0x3eb33b){return _0x3eb33b[_0x28cf('0x35')]()['then'](function(){_0x4114f7[_0x28cf('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dcbf4,_0x3f8531){return function(_0x484acc){if(!_0x484acc){_0x3dcbf4[_0x28cf('0x28')](0x194);}return _0x484acc;};}function handleError(_0x31268b,_0x26176c){_0x26176c=_0x26176c||0x1f4;return function(_0x295449){logger[_0x28cf('0x24')](_0x295449['stack']);if(_0x295449[_0x28cf('0x36')]){delete _0x295449['name'];}_0x31268b[_0x28cf('0x29')](_0x26176c)[_0x28cf('0x37')](_0x295449);};}exports[_0x28cf('0x38')]=function(_0x3184e8,_0x13ee99){var _0x34d599={},_0x14b6a6={},_0x12470c={'count':0x0,'rows':[]};var _0x10630b=_[_0x28cf('0x39')](db[_0x28cf('0x3a')][_0x28cf('0x3b')],function(_0x4ab1b3){return{'name':_0x4ab1b3['fieldName'],'type':_0x4ab1b3[_0x28cf('0x3c')][_0x28cf('0x3d')]};});_0x14b6a6[_0x28cf('0x3e')]=_[_0x28cf('0x39')](_0x10630b,_0x28cf('0x36'));_0x14b6a6['query']=_[_0x28cf('0x3f')](_0x3184e8['query']);_0x14b6a6[_0x28cf('0x40')]=_[_0x28cf('0x41')](_0x14b6a6['model'],_0x14b6a6[_0x28cf('0x42')]);_0x34d599[_0x28cf('0x43')]=_[_0x28cf('0x41')](_0x14b6a6['model'],qs[_0x28cf('0x44')](_0x3184e8['query'][_0x28cf('0x44')]));_0x34d599[_0x28cf('0x43')]=_0x34d599['attributes'][_0x28cf('0x45')]?_0x34d599[_0x28cf('0x43')]:_0x14b6a6['model'];if(!_0x3184e8[_0x28cf('0x42')][_0x28cf('0x46')](_0x28cf('0x47'))){_0x34d599[_0x28cf('0x2e')]=qs[_0x28cf('0x2e')](_0x3184e8[_0x28cf('0x42')][_0x28cf('0x2e')]);_0x34d599[_0x28cf('0x2d')]=qs['offset'](_0x3184e8[_0x28cf('0x42')][_0x28cf('0x2d')]);}_0x34d599['order']=qs['sort'](_0x3184e8[_0x28cf('0x42')][_0x28cf('0x48')]);_0x34d599[_0x28cf('0x49')]=qs[_0x28cf('0x40')](_['pick'](_0x3184e8[_0x28cf('0x42')],_0x14b6a6[_0x28cf('0x40')]),_0x10630b);if(_0x3184e8[_0x28cf('0x42')]['filter']){_0x34d599[_0x28cf('0x49')]=_[_0x28cf('0x4a')](_0x34d599[_0x28cf('0x49')],{'$or':_[_0x28cf('0x39')](_0x10630b,function(_0x5acef9){if(_0x5acef9['type']!==_0x28cf('0x4b')){var _0xa49857={};_0xa49857[_0x5acef9[_0x28cf('0x36')]]={'$like':'%'+_0x3184e8['query'][_0x28cf('0x4c')]+'%'};return _0xa49857;}})});}_0x34d599=_['merge']({},_0x34d599,_0x3184e8[_0x28cf('0x4d')]);var _0x2f7175={'where':_0x34d599[_0x28cf('0x49')]};return db[_0x28cf('0x3a')]['count'](_0x2f7175)[_0x28cf('0x34')](function(_0x493eb3){_0x12470c[_0x28cf('0x2c')]=_0x493eb3;if(_0x3184e8[_0x28cf('0x42')]['includeAll']){_0x34d599[_0x28cf('0x4e')]=[{'all':!![]}];}return db[_0x28cf('0x3a')][_0x28cf('0x4f')](_0x34d599);})[_0x28cf('0x34')](function(_0x59f234){_0x12470c['rows']=_0x59f234;return _0x12470c;})['then'](respondWithFilteredResult(_0x13ee99,_0x34d599))[_0x28cf('0x50')](handleError(_0x13ee99,null));};exports['show']=function(_0x2e51d3,_0x4cbc40){var _0x341c7c={'raw':![],'where':{'id':_0x2e51d3['params']['id']}},_0xb5f643={};_0xb5f643[_0x28cf('0x3e')]=_['keys'](db['FreshdeskConfiguration'][_0x28cf('0x3b')]);_0xb5f643[_0x28cf('0x42')]=_['keys'](_0x2e51d3[_0x28cf('0x42')]);_0xb5f643['filters']=_['intersection'](_0xb5f643[_0x28cf('0x3e')],_0xb5f643[_0x28cf('0x42')]);_0x341c7c[_0x28cf('0x43')]=_[_0x28cf('0x41')](_0xb5f643['model'],qs[_0x28cf('0x44')](_0x2e51d3[_0x28cf('0x42')][_0x28cf('0x44')]));_0x341c7c[_0x28cf('0x43')]=_0x341c7c[_0x28cf('0x43')][_0x28cf('0x45')]?_0x341c7c['attributes']:_0xb5f643[_0x28cf('0x3e')];if(_0x2e51d3[_0x28cf('0x42')]['includeAll']){_0x341c7c[_0x28cf('0x4e')]=[{'all':!![]}];}_0x341c7c=_['merge']({},_0x341c7c,_0x2e51d3[_0x28cf('0x4d')]);return db[_0x28cf('0x3a')][_0x28cf('0x51')](_0x341c7c)[_0x28cf('0x34')](handleEntityNotFound(_0x4cbc40,null))[_0x28cf('0x34')](respondWithResult(_0x4cbc40,null))[_0x28cf('0x50')](handleError(_0x4cbc40,null));};exports['create']=function(_0x236618,_0x242831){return db[_0x28cf('0x3a')][_0x28cf('0x52')](_0x236618[_0x28cf('0x53')],{})[_0x28cf('0x34')](respondWithResult(_0x242831,0xc9))[_0x28cf('0x50')](handleError(_0x242831,null));};exports[_0x28cf('0x33')]=function(_0x27b8ec,_0x178371){if(_0x27b8ec[_0x28cf('0x53')]['id']){delete _0x27b8ec[_0x28cf('0x53')]['id'];}return db[_0x28cf('0x3a')][_0x28cf('0x51')]({'where':{'id':_0x27b8ec[_0x28cf('0x54')]['id']}})[_0x28cf('0x34')](handleEntityNotFound(_0x178371,null))[_0x28cf('0x34')](saveUpdates(_0x27b8ec[_0x28cf('0x53')],null))['then'](respondWithResult(_0x178371,null))['catch'](handleError(_0x178371,null));};exports[_0x28cf('0x35')]=function(_0x1dbe89,_0x2e7b84){return db['FreshdeskConfiguration'][_0x28cf('0x51')]({'where':{'id':_0x1dbe89[_0x28cf('0x54')]['id']}})['then'](handleEntityNotFound(_0x2e7b84,null))[_0x28cf('0x34')](removeEntity(_0x2e7b84,null))[_0x28cf('0x50')](handleError(_0x2e7b84,null));};exports[_0x28cf('0x55')]=function(_0xeeea97,_0x10cc88,_0x547c28){var _0x3e3f78={};var _0x2c90a8={};var _0x958b12;var _0x4df944;return db[_0x28cf('0x3a')]['findOne']({'where':{'id':_0xeeea97[_0x28cf('0x54')]['id']}})[_0x28cf('0x34')](handleEntityNotFound(_0x10cc88,null))['then'](function(_0x586fca){if(_0x586fca){_0x958b12=_0x586fca;_0x2c90a8['model']=_['keys'](db['FreshdeskField']['rawAttributes']);_0x2c90a8['query']=_[_0x28cf('0x3f')](_0xeeea97[_0x28cf('0x42')]);_0x2c90a8[_0x28cf('0x40')]=_[_0x28cf('0x41')](_0x2c90a8[_0x28cf('0x3e')],_0x2c90a8[_0x28cf('0x42')]);_0x3e3f78[_0x28cf('0x43')]=_['intersection'](_0x2c90a8['model'],qs['fields'](_0xeeea97['query']['fields']));_0x3e3f78[_0x28cf('0x43')]=_0x3e3f78[_0x28cf('0x43')]['length']?_0x3e3f78['attributes']:_0x2c90a8[_0x28cf('0x3e')];_0x3e3f78['order']=qs[_0x28cf('0x48')](_0xeeea97['query'][_0x28cf('0x48')]);_0x3e3f78['where']=qs[_0x28cf('0x40')](_[_0x28cf('0x56')](_0xeeea97[_0x28cf('0x42')],_0x2c90a8[_0x28cf('0x40')]));if(_0xeeea97[_0x28cf('0x42')][_0x28cf('0x4c')]){_0x3e3f78[_0x28cf('0x49')]=_['merge'](_0x3e3f78['where'],{'$or':_[_0x28cf('0x39')](_0x3e3f78[_0x28cf('0x43')],function(_0x1fc8b0){var _0x13f9bb={};_0x13f9bb[_0x1fc8b0]={'$like':'%'+_0xeeea97['query'][_0x28cf('0x4c')]+'%'};return _0x13f9bb;})});}_0x3e3f78=_[_0x28cf('0x4a')]({},_0x3e3f78,_0xeeea97[_0x28cf('0x4d')]);return _0x958b12[_0x28cf('0x55')](_0x3e3f78);}})['then'](function(_0x216a2c){if(_0x216a2c){_0x4df944=_0x216a2c[_0x28cf('0x45')];if(!_0xeeea97[_0x28cf('0x42')][_0x28cf('0x46')](_0x28cf('0x47'))){_0x3e3f78['limit']=qs[_0x28cf('0x2e')](_0xeeea97['query'][_0x28cf('0x2e')]);_0x3e3f78[_0x28cf('0x2d')]=qs[_0x28cf('0x2d')](_0xeeea97[_0x28cf('0x42')][_0x28cf('0x2d')]);}return _0x958b12[_0x28cf('0x55')](_0x3e3f78);}})[_0x28cf('0x34')](function(_0x1a4e7a){if(_0x1a4e7a){return _0x1a4e7a?{'count':_0x4df944,'rows':_0x1a4e7a}:null;}})[_0x28cf('0x34')](respondWithResult(_0x10cc88,null))[_0x28cf('0x50')](handleError(_0x10cc88,null));};exports[_0x28cf('0x57')]=function(_0x4c7691,_0x10b6f4,_0x82997f){var _0x56c969={};var _0x109207={};var _0x11d3c8;var _0x200b37;return db[_0x28cf('0x3a')][_0x28cf('0x58')]({'where':{'id':_0x4c7691[_0x28cf('0x54')]['id']}})['then'](handleEntityNotFound(_0x10b6f4,null))[_0x28cf('0x34')](function(_0x345e09){if(_0x345e09){_0x11d3c8=_0x345e09;_0x109207[_0x28cf('0x3e')]=_['keys'](db[_0x28cf('0x59')][_0x28cf('0x3b')]);_0x109207[_0x28cf('0x42')]=_['keys'](_0x4c7691[_0x28cf('0x42')]);_0x109207[_0x28cf('0x40')]=_[_0x28cf('0x41')](_0x109207['model'],_0x109207['query']);_0x56c969['attributes']=_['intersection'](_0x109207[_0x28cf('0x3e')],qs[_0x28cf('0x44')](_0x4c7691[_0x28cf('0x42')][_0x28cf('0x44')]));_0x56c969[_0x28cf('0x43')]=_0x56c969[_0x28cf('0x43')]['length']?_0x56c969[_0x28cf('0x43')]:_0x109207['model'];_0x56c969[_0x28cf('0x5a')]=qs[_0x28cf('0x48')](_0x4c7691[_0x28cf('0x42')][_0x28cf('0x48')]);_0x56c969[_0x28cf('0x49')]=qs[_0x28cf('0x40')](_[_0x28cf('0x56')](_0x4c7691['query'],_0x109207[_0x28cf('0x40')]));if(_0x4c7691[_0x28cf('0x42')][_0x28cf('0x4c')]){_0x56c969[_0x28cf('0x49')]=_[_0x28cf('0x4a')](_0x56c969[_0x28cf('0x49')],{'$or':_[_0x28cf('0x39')](_0x56c969['attributes'],function(_0x8c77e0){var _0x12b22d={};_0x12b22d[_0x8c77e0]={'$like':'%'+_0x4c7691[_0x28cf('0x42')][_0x28cf('0x4c')]+'%'};return _0x12b22d;})});}_0x56c969=_[_0x28cf('0x4a')]({},_0x56c969,_0x4c7691[_0x28cf('0x4d')]);return _0x11d3c8[_0x28cf('0x57')](_0x56c969);}})[_0x28cf('0x34')](function(_0x375146){if(_0x375146){_0x200b37=_0x375146['length'];if(!_0x4c7691[_0x28cf('0x42')][_0x28cf('0x46')](_0x28cf('0x47'))){_0x56c969['limit']=qs[_0x28cf('0x2e')](_0x4c7691[_0x28cf('0x42')]['limit']);_0x56c969['offset']=qs[_0x28cf('0x2d')](_0x4c7691[_0x28cf('0x42')][_0x28cf('0x2d')]);}return _0x11d3c8[_0x28cf('0x57')](_0x56c969);}})[_0x28cf('0x34')](function(_0x317452){if(_0x317452){return _0x317452?{'count':_0x200b37,'rows':_0x317452}:null;}})[_0x28cf('0x34')](respondWithResult(_0x10b6f4,null))[_0x28cf('0x50')](handleError(_0x10b6f4,null));};exports[_0x28cf('0x5b')]=function(_0x5a0dbd,_0x2a3807,_0xe96563){var _0x77624b={};var _0x16da31={};var _0x302b66;var _0x282eeb;return db['FreshdeskConfiguration'][_0x28cf('0x58')]({'where':{'id':_0x5a0dbd[_0x28cf('0x54')]['id']}})['then'](handleEntityNotFound(_0x2a3807,null))[_0x28cf('0x34')](function(_0x296bde){if(_0x296bde){_0x302b66=_0x296bde;_0x16da31[_0x28cf('0x3e')]=_[_0x28cf('0x3f')](db[_0x28cf('0x59')][_0x28cf('0x3b')]);_0x16da31['query']=_['keys'](_0x5a0dbd[_0x28cf('0x42')]);_0x16da31[_0x28cf('0x40')]=_[_0x28cf('0x41')](_0x16da31['model'],_0x16da31['query']);_0x77624b[_0x28cf('0x43')]=_[_0x28cf('0x41')](_0x16da31[_0x28cf('0x3e')],qs['fields'](_0x5a0dbd[_0x28cf('0x42')][_0x28cf('0x44')]));_0x77624b['attributes']=_0x77624b['attributes'][_0x28cf('0x45')]?_0x77624b[_0x28cf('0x43')]:_0x16da31['model'];_0x77624b[_0x28cf('0x5a')]=qs[_0x28cf('0x48')](_0x5a0dbd[_0x28cf('0x42')]['sort']);_0x77624b['where']=qs[_0x28cf('0x40')](_['pick'](_0x5a0dbd[_0x28cf('0x42')],_0x16da31['filters']));if(_0x5a0dbd[_0x28cf('0x42')]['filter']){_0x77624b['where']=_[_0x28cf('0x4a')](_0x77624b[_0x28cf('0x49')],{'$or':_[_0x28cf('0x39')](_0x77624b[_0x28cf('0x43')],function(_0x1641b9){var _0x1706f8={};_0x1706f8[_0x1641b9]={'$like':'%'+_0x5a0dbd[_0x28cf('0x42')][_0x28cf('0x4c')]+'%'};return _0x1706f8;})});}_0x77624b=_[_0x28cf('0x4a')]({},_0x77624b,_0x5a0dbd['options']);return _0x302b66[_0x28cf('0x5b')](_0x77624b);}})[_0x28cf('0x34')](function(_0x48ebbd){if(_0x48ebbd){_0x282eeb=_0x48ebbd['length'];if(!_0x5a0dbd[_0x28cf('0x42')][_0x28cf('0x46')]('nolimit')){_0x77624b[_0x28cf('0x2e')]=qs[_0x28cf('0x2e')](_0x5a0dbd[_0x28cf('0x42')]['limit']);_0x77624b[_0x28cf('0x2d')]=qs[_0x28cf('0x2d')](_0x5a0dbd[_0x28cf('0x42')]['offset']);}return _0x302b66[_0x28cf('0x5b')](_0x77624b);}})[_0x28cf('0x34')](function(_0x550815){if(_0x550815){return _0x550815?{'count':_0x282eeb,'rows':_0x550815}:null;}})[_0x28cf('0x34')](respondWithResult(_0x2a3807,null))[_0x28cf('0x50')](handleError(_0x2a3807,null));};exports[_0x28cf('0x5c')]=function(_0x7e7dac,_0x2a02c9,_0x1f5072){var _0x2f0524={};var _0x577cff={};var _0x29009e;var _0x2b8090;return db[_0x28cf('0x3a')][_0x28cf('0x58')]({'where':{'id':_0x7e7dac[_0x28cf('0x54')]['id']}})[_0x28cf('0x34')](handleEntityNotFound(_0x2a02c9,null))[_0x28cf('0x34')](function(_0x33ae3e){if(_0x33ae3e){_0x29009e=_0x33ae3e;_0x577cff['model']=_['keys'](db[_0x28cf('0x5d')][_0x28cf('0x3b')]);_0x577cff[_0x28cf('0x42')]=_['keys'](_0x7e7dac[_0x28cf('0x42')]);_0x577cff[_0x28cf('0x40')]=_['intersection'](_0x577cff['model'],_0x577cff[_0x28cf('0x42')]);_0x2f0524['attributes']=_['intersection'](_0x577cff[_0x28cf('0x3e')],qs[_0x28cf('0x44')](_0x7e7dac['query']['fields']));_0x2f0524['attributes']=_0x2f0524[_0x28cf('0x43')][_0x28cf('0x45')]?_0x2f0524[_0x28cf('0x43')]:_0x577cff[_0x28cf('0x3e')];_0x2f0524[_0x28cf('0x5a')]=qs[_0x28cf('0x48')](_0x7e7dac['query']['sort']);_0x2f0524[_0x28cf('0x49')]=qs[_0x28cf('0x40')](_[_0x28cf('0x56')](_0x7e7dac[_0x28cf('0x42')],_0x577cff[_0x28cf('0x40')]));if(_0x7e7dac[_0x28cf('0x42')]['filter']){_0x2f0524['where']=_['merge'](_0x2f0524[_0x28cf('0x49')],{'$or':_[_0x28cf('0x39')](_0x2f0524['attributes'],function(_0x3b3a7a){var _0x139e70={};_0x139e70[_0x3b3a7a]={'$like':'%'+_0x7e7dac[_0x28cf('0x42')][_0x28cf('0x4c')]+'%'};return _0x139e70;})});}_0x2f0524=_['merge']({},_0x2f0524,_0x7e7dac[_0x28cf('0x4d')]);return _0x29009e[_0x28cf('0x5c')](_0x2f0524);}})[_0x28cf('0x34')](function(_0x354fe0){if(_0x354fe0){_0x2b8090=_0x354fe0['length'];if(!_0x7e7dac[_0x28cf('0x42')][_0x28cf('0x46')](_0x28cf('0x47'))){_0x2f0524[_0x28cf('0x2e')]=qs[_0x28cf('0x2e')](_0x7e7dac[_0x28cf('0x42')][_0x28cf('0x2e')]);_0x2f0524[_0x28cf('0x2d')]=qs[_0x28cf('0x2d')](_0x7e7dac[_0x28cf('0x42')][_0x28cf('0x2d')]);}return _0x29009e[_0x28cf('0x5c')](_0x2f0524);}})[_0x28cf('0x34')](function(_0x2362a7){if(_0x2362a7){return _0x2362a7?{'count':_0x2b8090,'rows':_0x2362a7}:null;}})[_0x28cf('0x34')](respondWithResult(_0x2a02c9,null))[_0x28cf('0x50')](handleError(_0x2a02c9,null));};exports[_0x28cf('0x5e')]=function(_0x328c2e,_0x473dd4,_0x25e45c){if(_0x328c2e['body']['id']){delete _0x328c2e['body']['id'];}return db[_0x28cf('0x3a')][_0x28cf('0x58')]({'where':{'id':_0x328c2e['params']['id']}})['then'](handleEntityNotFound(_0x473dd4,null))[_0x28cf('0x34')](function(_0x39e6d4){if(_0x39e6d4){return _0x39e6d4[_0x28cf('0x5e')](_0x328c2e[_0x28cf('0x53')][_0x28cf('0x5f')]||[]);}return null;})[_0x28cf('0x34')](respondWithResult(_0x473dd4,null))[_0x28cf('0x50')](handleError(_0x473dd4,null));};
\ No newline at end of file
+var _0x49f7=['sort','where','pick','filter','merge','options','includeAll','include','show','params','find','create','body','getFields','findOne','FreshdeskField','getSubjects','rawAttributes','getDescriptions','getTags','Tag','setTags','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FreshdeskConfiguration','fieldName','type','key','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order'];(function(_0x482214,_0x2550ff){var _0x38d0cb=function(_0x2ba281){while(--_0x2ba281){_0x482214['push'](_0x482214['shift']());}};_0x38d0cb(++_0x2550ff);}(_0x49f7,0xc8));var _0x749f=function(_0x3a57ac,_0x74a56a){_0x3a57ac=_0x3a57ac-0x0;var _0x3a7b1e=_0x49f7[_0x3a57ac];return _0x3a7b1e;};'use strict';var pdf=require(_0x749f('0x0'));var emlformat=require(_0x749f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x749f('0x2'));var jsonpatch=require(_0x749f('0x3'));var rp=require('request-promise');var moment=require(_0x749f('0x4'));var BPromise=require(_0x749f('0x5'));var Mustache=require('mustache');var util=require(_0x749f('0x6'));var path=require(_0x749f('0x7'));var sox=require(_0x749f('0x8'));var csv=require(_0x749f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x749f('0xa'));var squel=require('squel');var crypto=require(_0x749f('0xb'));var jsforce=require(_0x749f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x749f('0x9'));var querystring=require('querystring');var Papa=require(_0x749f('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x749f('0xe'));var as=require(_0x749f('0xf'));var hardwareService=require(_0x749f('0x10'));var logger=require(_0x749f('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x749f('0x12'));var db=require(_0x749f('0x13'))['db'];var jayson=require(_0x749f('0x14'));var client=jayson[_0x749f('0x15')][_0x749f('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x47b4ca,_0x38af07,_0x10c644,_0x38da37){return new BPromise(function(_0x40f977,_0x4f3b51){var _0x221171=_0x38da37||client;return _0x221171[_0x749f('0x17')](_0x47b4ca,_0x10c644)[_0x749f('0x18')](function(_0x8b4648){logger['info'](_0x749f('0x19'),_0x38af07,_0x749f('0x1a'));logger[_0x749f('0x1b')](_0x749f('0x1c'),_0x38af07,_0x749f('0x1a'),JSON['stringify'](_0x8b4648));if(_0x8b4648[_0x749f('0x1d')]){if(_0x8b4648[_0x749f('0x1d')][_0x749f('0x1e')]===0x1f4){logger[_0x749f('0x1d')](_0x749f('0x19'),_0x38af07,_0x8b4648[_0x749f('0x1d')][_0x749f('0x1f')]);return _0x4f3b51(_0x8b4648[_0x749f('0x1d')][_0x749f('0x1f')]);}logger[_0x749f('0x1d')](_0x749f('0x19'),_0x38af07,_0x8b4648[_0x749f('0x1d')]['message']);return _0x40f977(_0x8b4648[_0x749f('0x1d')][_0x749f('0x1f')]);}else{logger['info'](_0x749f('0x19'),_0x38af07,_0x749f('0x1a'));_0x40f977(_0x8b4648['result'][_0x749f('0x1f')]);}})[_0x749f('0x20')](function(_0x5efe94){logger[_0x749f('0x1d')](_0x749f('0x19'),_0x38af07,_0x5efe94);_0x4f3b51(_0x5efe94);});});}function respondWithStatusCode(_0x22d18b,_0x564975){_0x564975=_0x564975||0xcc;return function(_0x2ec86e){if(_0x2ec86e){return _0x22d18b[_0x749f('0x21')](_0x564975);}return _0x22d18b[_0x749f('0x22')](_0x564975)[_0x749f('0x23')]();};}function respondWithResult(_0x594ed7,_0x7bf4b0){_0x7bf4b0=_0x7bf4b0||0xc8;return function(_0x44ca8e){if(_0x44ca8e){return _0x594ed7[_0x749f('0x22')](_0x7bf4b0)[_0x749f('0x24')](_0x44ca8e);}};}function respondWithFilteredResult(_0x3fc8ed,_0x4604e4){return function(_0x216031){if(_0x216031){var _0x5b4e96=_0x216031[_0x749f('0x25')],_0x829b0d=_0x4604e4[_0x749f('0x26')],_0x21a238=_0x4604e4['offset']+_0x4604e4[_0x749f('0x27')],_0x503c2d;if(_0x21a238>=_0x5b4e96){_0x21a238=_0x5b4e96;_0x503c2d=0xc8;}else{_0x503c2d=0xce;}_0x3fc8ed[_0x749f('0x22')](_0x503c2d);return _0x3fc8ed[_0x749f('0x28')](_0x749f('0x29'),_0x829b0d+'-'+_0x21a238+'/'+_0x5b4e96)[_0x749f('0x24')](_0x216031);}return null;};}function patchUpdates(_0x9c7a83){return function(_0x3bcba7){try{jsonpatch[_0x749f('0x2a')](_0x3bcba7,_0x9c7a83,!![]);}catch(_0xdc252){return BPromise[_0x749f('0x2b')](_0xdc252);}return _0x3bcba7[_0x749f('0x2c')]();};}function saveUpdates(_0x1092e7,_0x3a07ab){return function(_0x1b3681){if(_0x1b3681){return _0x1b3681[_0x749f('0x2d')](_0x1092e7)[_0x749f('0x18')](function(_0x2610c3){return _0x2610c3;});}return null;};}function removeEntity(_0x2473a9,_0x263ab4){return function(_0x398bab){if(_0x398bab){return _0x398bab[_0x749f('0x2e')]()[_0x749f('0x18')](function(){_0x2473a9[_0x749f('0x22')](0xcc)[_0x749f('0x23')]();});}};}function handleEntityNotFound(_0x5d7d60,_0x21c7c6){return function(_0x5c5759){if(!_0x5c5759){_0x5d7d60[_0x749f('0x21')](0x194);}return _0x5c5759;};}function handleError(_0x202c7e,_0x303715){_0x303715=_0x303715||0x1f4;return function(_0x48e252){logger[_0x749f('0x1d')](_0x48e252[_0x749f('0x2f')]);if(_0x48e252[_0x749f('0x30')]){delete _0x48e252[_0x749f('0x30')];}_0x202c7e[_0x749f('0x22')](_0x303715)[_0x749f('0x31')](_0x48e252);};}exports[_0x749f('0x32')]=function(_0x3a6ec8,_0x2342d4){var _0x3ce5da={},_0x20321e={},_0x472c6f={'count':0x0,'rows':[]};var _0x1c2bba=_[_0x749f('0x33')](db[_0x749f('0x34')]['rawAttributes'],function(_0x477360){return{'name':_0x477360[_0x749f('0x35')],'type':_0x477360[_0x749f('0x36')][_0x749f('0x37')]};});_0x20321e['model']=_[_0x749f('0x33')](_0x1c2bba,_0x749f('0x30'));_0x20321e[_0x749f('0x38')]=_[_0x749f('0x39')](_0x3a6ec8[_0x749f('0x38')]);_0x20321e[_0x749f('0x3a')]=_['intersection'](_0x20321e['model'],_0x20321e[_0x749f('0x38')]);_0x3ce5da[_0x749f('0x3b')]=_[_0x749f('0x3c')](_0x20321e['model'],qs[_0x749f('0x3d')](_0x3a6ec8[_0x749f('0x38')][_0x749f('0x3d')]));_0x3ce5da[_0x749f('0x3b')]=_0x3ce5da[_0x749f('0x3b')][_0x749f('0x3e')]?_0x3ce5da[_0x749f('0x3b')]:_0x20321e[_0x749f('0x3f')];if(!_0x3a6ec8[_0x749f('0x38')][_0x749f('0x40')](_0x749f('0x41'))){_0x3ce5da[_0x749f('0x27')]=qs[_0x749f('0x27')](_0x3a6ec8['query']['limit']);_0x3ce5da['offset']=qs[_0x749f('0x26')](_0x3a6ec8['query'][_0x749f('0x26')]);}_0x3ce5da[_0x749f('0x42')]=qs[_0x749f('0x43')](_0x3a6ec8[_0x749f('0x38')][_0x749f('0x43')]);_0x3ce5da[_0x749f('0x44')]=qs[_0x749f('0x3a')](_[_0x749f('0x45')](_0x3a6ec8[_0x749f('0x38')],_0x20321e[_0x749f('0x3a')]),_0x1c2bba);if(_0x3a6ec8[_0x749f('0x38')][_0x749f('0x46')]){_0x3ce5da[_0x749f('0x44')]=_['merge'](_0x3ce5da[_0x749f('0x44')],{'$or':_[_0x749f('0x33')](_0x1c2bba,function(_0x3bec11){if(_0x3bec11[_0x749f('0x36')]!=='VIRTUAL'){var _0x58a906={};_0x58a906[_0x3bec11[_0x749f('0x30')]]={'$like':'%'+_0x3a6ec8[_0x749f('0x38')][_0x749f('0x46')]+'%'};return _0x58a906;}})});}_0x3ce5da=_[_0x749f('0x47')]({},_0x3ce5da,_0x3a6ec8[_0x749f('0x48')]);var _0x4794ab={'where':_0x3ce5da[_0x749f('0x44')]};return db['FreshdeskConfiguration'][_0x749f('0x25')](_0x4794ab)['then'](function(_0xf0b0fa){_0x472c6f[_0x749f('0x25')]=_0xf0b0fa;if(_0x3a6ec8['query'][_0x749f('0x49')]){_0x3ce5da[_0x749f('0x4a')]=[{'all':!![]}];}return db[_0x749f('0x34')]['findAll'](_0x3ce5da);})[_0x749f('0x18')](function(_0x6ba739){_0x472c6f['rows']=_0x6ba739;return _0x472c6f;})['then'](respondWithFilteredResult(_0x2342d4,_0x3ce5da))['catch'](handleError(_0x2342d4,null));};exports[_0x749f('0x4b')]=function(_0x423d4b,_0x175e33){var _0xd75f5={'raw':![],'where':{'id':_0x423d4b[_0x749f('0x4c')]['id']}},_0x103cd0={};_0x103cd0['model']=_[_0x749f('0x39')](db[_0x749f('0x34')]['rawAttributes']);_0x103cd0[_0x749f('0x38')]=_[_0x749f('0x39')](_0x423d4b['query']);_0x103cd0['filters']=_[_0x749f('0x3c')](_0x103cd0[_0x749f('0x3f')],_0x103cd0['query']);_0xd75f5['attributes']=_[_0x749f('0x3c')](_0x103cd0[_0x749f('0x3f')],qs[_0x749f('0x3d')](_0x423d4b[_0x749f('0x38')]['fields']));_0xd75f5[_0x749f('0x3b')]=_0xd75f5[_0x749f('0x3b')][_0x749f('0x3e')]?_0xd75f5[_0x749f('0x3b')]:_0x103cd0['model'];if(_0x423d4b[_0x749f('0x38')][_0x749f('0x49')]){_0xd75f5[_0x749f('0x4a')]=[{'all':!![]}];}_0xd75f5=_[_0x749f('0x47')]({},_0xd75f5,_0x423d4b['options']);return db['FreshdeskConfiguration'][_0x749f('0x4d')](_0xd75f5)[_0x749f('0x18')](handleEntityNotFound(_0x175e33,null))[_0x749f('0x18')](respondWithResult(_0x175e33,null))[_0x749f('0x20')](handleError(_0x175e33,null));};exports[_0x749f('0x4e')]=function(_0x1470ba,_0x283fd2){return db['FreshdeskConfiguration'][_0x749f('0x4e')](_0x1470ba[_0x749f('0x4f')],{})['then'](respondWithResult(_0x283fd2,0xc9))[_0x749f('0x20')](handleError(_0x283fd2,null));};exports[_0x749f('0x2d')]=function(_0x2159d3,_0x24f0f6){if(_0x2159d3[_0x749f('0x4f')]['id']){delete _0x2159d3[_0x749f('0x4f')]['id'];}return db[_0x749f('0x34')]['find']({'where':{'id':_0x2159d3[_0x749f('0x4c')]['id']}})[_0x749f('0x18')](handleEntityNotFound(_0x24f0f6,null))[_0x749f('0x18')](saveUpdates(_0x2159d3[_0x749f('0x4f')],null))[_0x749f('0x18')](respondWithResult(_0x24f0f6,null))[_0x749f('0x20')](handleError(_0x24f0f6,null));};exports[_0x749f('0x2e')]=function(_0x525cab,_0x58dd2c){return db[_0x749f('0x34')][_0x749f('0x4d')]({'where':{'id':_0x525cab['params']['id']}})[_0x749f('0x18')](handleEntityNotFound(_0x58dd2c,null))[_0x749f('0x18')](removeEntity(_0x58dd2c,null))[_0x749f('0x20')](handleError(_0x58dd2c,null));};exports[_0x749f('0x50')]=function(_0x4f7d04,_0x4fa359,_0x4f80dd){var _0x2a1758={};var _0x17d9ee={};var _0x1d2c62;var _0x1cf238;return db['FreshdeskConfiguration'][_0x749f('0x51')]({'where':{'id':_0x4f7d04[_0x749f('0x4c')]['id']}})[_0x749f('0x18')](handleEntityNotFound(_0x4fa359,null))[_0x749f('0x18')](function(_0x1babb3){if(_0x1babb3){_0x1d2c62=_0x1babb3;_0x17d9ee[_0x749f('0x3f')]=_[_0x749f('0x39')](db[_0x749f('0x52')]['rawAttributes']);_0x17d9ee['query']=_['keys'](_0x4f7d04[_0x749f('0x38')]);_0x17d9ee[_0x749f('0x3a')]=_[_0x749f('0x3c')](_0x17d9ee['model'],_0x17d9ee[_0x749f('0x38')]);_0x2a1758[_0x749f('0x3b')]=_[_0x749f('0x3c')](_0x17d9ee[_0x749f('0x3f')],qs[_0x749f('0x3d')](_0x4f7d04[_0x749f('0x38')]['fields']));_0x2a1758[_0x749f('0x3b')]=_0x2a1758['attributes']['length']?_0x2a1758[_0x749f('0x3b')]:_0x17d9ee[_0x749f('0x3f')];_0x2a1758[_0x749f('0x42')]=qs[_0x749f('0x43')](_0x4f7d04[_0x749f('0x38')][_0x749f('0x43')]);_0x2a1758['where']=qs[_0x749f('0x3a')](_[_0x749f('0x45')](_0x4f7d04[_0x749f('0x38')],_0x17d9ee[_0x749f('0x3a')]));if(_0x4f7d04[_0x749f('0x38')][_0x749f('0x46')]){_0x2a1758[_0x749f('0x44')]=_[_0x749f('0x47')](_0x2a1758['where'],{'$or':_[_0x749f('0x33')](_0x2a1758['attributes'],function(_0x12f586){var _0x56ad75={};_0x56ad75[_0x12f586]={'$like':'%'+_0x4f7d04['query'][_0x749f('0x46')]+'%'};return _0x56ad75;})});}_0x2a1758=_[_0x749f('0x47')]({},_0x2a1758,_0x4f7d04[_0x749f('0x48')]);return _0x1d2c62[_0x749f('0x50')](_0x2a1758);}})[_0x749f('0x18')](function(_0x28d14d){if(_0x28d14d){_0x1cf238=_0x28d14d['length'];if(!_0x4f7d04[_0x749f('0x38')]['hasOwnProperty'](_0x749f('0x41'))){_0x2a1758[_0x749f('0x27')]=qs[_0x749f('0x27')](_0x4f7d04[_0x749f('0x38')][_0x749f('0x27')]);_0x2a1758[_0x749f('0x26')]=qs[_0x749f('0x26')](_0x4f7d04[_0x749f('0x38')][_0x749f('0x26')]);}return _0x1d2c62['getFields'](_0x2a1758);}})[_0x749f('0x18')](function(_0x126539){if(_0x126539){return _0x126539?{'count':_0x1cf238,'rows':_0x126539}:null;}})['then'](respondWithResult(_0x4fa359,null))[_0x749f('0x20')](handleError(_0x4fa359,null));};exports[_0x749f('0x53')]=function(_0x558bf0,_0x1065e5,_0x17e8d6){var _0x549365={};var _0x3e885f={};var _0x5d3a36;var _0x442a19;return db[_0x749f('0x34')][_0x749f('0x51')]({'where':{'id':_0x558bf0[_0x749f('0x4c')]['id']}})[_0x749f('0x18')](handleEntityNotFound(_0x1065e5,null))['then'](function(_0x4e2586){if(_0x4e2586){_0x5d3a36=_0x4e2586;_0x3e885f[_0x749f('0x3f')]=_['keys'](db[_0x749f('0x52')][_0x749f('0x54')]);_0x3e885f['query']=_[_0x749f('0x39')](_0x558bf0['query']);_0x3e885f[_0x749f('0x3a')]=_['intersection'](_0x3e885f[_0x749f('0x3f')],_0x3e885f[_0x749f('0x38')]);_0x549365[_0x749f('0x3b')]=_[_0x749f('0x3c')](_0x3e885f['model'],qs[_0x749f('0x3d')](_0x558bf0[_0x749f('0x38')]['fields']));_0x549365[_0x749f('0x3b')]=_0x549365['attributes']['length']?_0x549365[_0x749f('0x3b')]:_0x3e885f[_0x749f('0x3f')];_0x549365[_0x749f('0x42')]=qs[_0x749f('0x43')](_0x558bf0[_0x749f('0x38')][_0x749f('0x43')]);_0x549365[_0x749f('0x44')]=qs['filters'](_[_0x749f('0x45')](_0x558bf0[_0x749f('0x38')],_0x3e885f[_0x749f('0x3a')]));if(_0x558bf0['query'][_0x749f('0x46')]){_0x549365[_0x749f('0x44')]=_['merge'](_0x549365[_0x749f('0x44')],{'$or':_[_0x749f('0x33')](_0x549365['attributes'],function(_0x5786fe){var _0x478129={};_0x478129[_0x5786fe]={'$like':'%'+_0x558bf0['query'][_0x749f('0x46')]+'%'};return _0x478129;})});}_0x549365=_[_0x749f('0x47')]({},_0x549365,_0x558bf0['options']);return _0x5d3a36['getSubjects'](_0x549365);}})[_0x749f('0x18')](function(_0x8db849){if(_0x8db849){_0x442a19=_0x8db849[_0x749f('0x3e')];if(!_0x558bf0[_0x749f('0x38')]['hasOwnProperty'](_0x749f('0x41'))){_0x549365['limit']=qs[_0x749f('0x27')](_0x558bf0[_0x749f('0x38')]['limit']);_0x549365['offset']=qs['offset'](_0x558bf0['query']['offset']);}return _0x5d3a36[_0x749f('0x53')](_0x549365);}})['then'](function(_0x538325){if(_0x538325){return _0x538325?{'count':_0x442a19,'rows':_0x538325}:null;}})[_0x749f('0x18')](respondWithResult(_0x1065e5,null))[_0x749f('0x20')](handleError(_0x1065e5,null));};exports[_0x749f('0x55')]=function(_0x5c1bb5,_0x4b5823,_0xa23b90){var _0x4ae932={};var _0x1482bf={};var _0x36b653;var _0x4b4b79;return db['FreshdeskConfiguration'][_0x749f('0x51')]({'where':{'id':_0x5c1bb5['params']['id']}})[_0x749f('0x18')](handleEntityNotFound(_0x4b5823,null))['then'](function(_0x5b7cca){if(_0x5b7cca){_0x36b653=_0x5b7cca;_0x1482bf[_0x749f('0x3f')]=_['keys'](db[_0x749f('0x52')][_0x749f('0x54')]);_0x1482bf[_0x749f('0x38')]=_[_0x749f('0x39')](_0x5c1bb5[_0x749f('0x38')]);_0x1482bf[_0x749f('0x3a')]=_[_0x749f('0x3c')](_0x1482bf['model'],_0x1482bf['query']);_0x4ae932['attributes']=_['intersection'](_0x1482bf[_0x749f('0x3f')],qs[_0x749f('0x3d')](_0x5c1bb5[_0x749f('0x38')][_0x749f('0x3d')]));_0x4ae932['attributes']=_0x4ae932['attributes'][_0x749f('0x3e')]?_0x4ae932[_0x749f('0x3b')]:_0x1482bf[_0x749f('0x3f')];_0x4ae932[_0x749f('0x42')]=qs[_0x749f('0x43')](_0x5c1bb5[_0x749f('0x38')]['sort']);_0x4ae932[_0x749f('0x44')]=qs['filters'](_[_0x749f('0x45')](_0x5c1bb5[_0x749f('0x38')],_0x1482bf[_0x749f('0x3a')]));if(_0x5c1bb5[_0x749f('0x38')][_0x749f('0x46')]){_0x4ae932[_0x749f('0x44')]=_['merge'](_0x4ae932[_0x749f('0x44')],{'$or':_[_0x749f('0x33')](_0x4ae932['attributes'],function(_0x583b43){var _0x40d8cd={};_0x40d8cd[_0x583b43]={'$like':'%'+_0x5c1bb5[_0x749f('0x38')][_0x749f('0x46')]+'%'};return _0x40d8cd;})});}_0x4ae932=_[_0x749f('0x47')]({},_0x4ae932,_0x5c1bb5[_0x749f('0x48')]);return _0x36b653[_0x749f('0x55')](_0x4ae932);}})[_0x749f('0x18')](function(_0x1f472a){if(_0x1f472a){_0x4b4b79=_0x1f472a[_0x749f('0x3e')];if(!_0x5c1bb5[_0x749f('0x38')]['hasOwnProperty'](_0x749f('0x41'))){_0x4ae932[_0x749f('0x27')]=qs[_0x749f('0x27')](_0x5c1bb5[_0x749f('0x38')][_0x749f('0x27')]);_0x4ae932[_0x749f('0x26')]=qs[_0x749f('0x26')](_0x5c1bb5[_0x749f('0x38')]['offset']);}return _0x36b653[_0x749f('0x55')](_0x4ae932);}})[_0x749f('0x18')](function(_0x43767a){if(_0x43767a){return _0x43767a?{'count':_0x4b4b79,'rows':_0x43767a}:null;}})[_0x749f('0x18')](respondWithResult(_0x4b5823,null))['catch'](handleError(_0x4b5823,null));};exports[_0x749f('0x56')]=function(_0x4d8003,_0x3108d9,_0x1ae578){var _0x21134d={};var _0x1475ed={};var _0xc2f55f;var _0x1cca24;return db[_0x749f('0x34')]['findOne']({'where':{'id':_0x4d8003[_0x749f('0x4c')]['id']}})[_0x749f('0x18')](handleEntityNotFound(_0x3108d9,null))[_0x749f('0x18')](function(_0x414f17){if(_0x414f17){_0xc2f55f=_0x414f17;_0x1475ed[_0x749f('0x3f')]=_[_0x749f('0x39')](db[_0x749f('0x57')][_0x749f('0x54')]);_0x1475ed['query']=_[_0x749f('0x39')](_0x4d8003[_0x749f('0x38')]);_0x1475ed[_0x749f('0x3a')]=_[_0x749f('0x3c')](_0x1475ed[_0x749f('0x3f')],_0x1475ed[_0x749f('0x38')]);_0x21134d[_0x749f('0x3b')]=_[_0x749f('0x3c')](_0x1475ed[_0x749f('0x3f')],qs[_0x749f('0x3d')](_0x4d8003['query'][_0x749f('0x3d')]));_0x21134d[_0x749f('0x3b')]=_0x21134d[_0x749f('0x3b')][_0x749f('0x3e')]?_0x21134d[_0x749f('0x3b')]:_0x1475ed[_0x749f('0x3f')];_0x21134d['order']=qs[_0x749f('0x43')](_0x4d8003[_0x749f('0x38')][_0x749f('0x43')]);_0x21134d['where']=qs[_0x749f('0x3a')](_[_0x749f('0x45')](_0x4d8003[_0x749f('0x38')],_0x1475ed[_0x749f('0x3a')]));if(_0x4d8003[_0x749f('0x38')]['filter']){_0x21134d[_0x749f('0x44')]=_['merge'](_0x21134d['where'],{'$or':_[_0x749f('0x33')](_0x21134d[_0x749f('0x3b')],function(_0x2e31b4){var _0x279257={};_0x279257[_0x2e31b4]={'$like':'%'+_0x4d8003[_0x749f('0x38')][_0x749f('0x46')]+'%'};return _0x279257;})});}_0x21134d=_['merge']({},_0x21134d,_0x4d8003[_0x749f('0x48')]);return _0xc2f55f[_0x749f('0x56')](_0x21134d);}})[_0x749f('0x18')](function(_0x233b57){if(_0x233b57){_0x1cca24=_0x233b57['length'];if(!_0x4d8003['query'][_0x749f('0x40')]('nolimit')){_0x21134d['limit']=qs['limit'](_0x4d8003['query'][_0x749f('0x27')]);_0x21134d['offset']=qs[_0x749f('0x26')](_0x4d8003[_0x749f('0x38')][_0x749f('0x26')]);}return _0xc2f55f['getTags'](_0x21134d);}})[_0x749f('0x18')](function(_0x2fbcae){if(_0x2fbcae){return _0x2fbcae?{'count':_0x1cca24,'rows':_0x2fbcae}:null;}})[_0x749f('0x18')](respondWithResult(_0x3108d9,null))[_0x749f('0x20')](handleError(_0x3108d9,null));};exports[_0x749f('0x58')]=function(_0x67bf5a,_0x3b61f4,_0x49c164){if(_0x67bf5a[_0x749f('0x4f')]['id']){delete _0x67bf5a[_0x749f('0x4f')]['id'];}return db[_0x749f('0x34')][_0x749f('0x51')]({'where':{'id':_0x67bf5a['params']['id']}})[_0x749f('0x18')](handleEntityNotFound(_0x3b61f4,null))[_0x749f('0x18')](function(_0x358456){if(_0x358456){return _0x358456[_0x749f('0x58')](_0x67bf5a[_0x749f('0x4f')]['ids']||[]);}return null;})[_0x749f('0x18')](respondWithResult(_0x3b61f4,null))[_0x749f('0x20')](handleError(_0x3b61f4,null));};
\ No newline at end of file