Built motion from commit (unavailable).|2.5.13
[motion2.git] / server / api / intFreshdeskConfiguration / intFreshdeskConfiguration.controller.js
index 4423e73..7e10e08 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x210b=['error','message','result','catch','sendStatus','status','end','limit','set','Content-Range','json','apply','reject','update','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','where','type','VIRTUAL','options','count','include','rows','params','keys','includeAll','find','create','body','FreshdeskField','getFields','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x210b,0xfa));var _0xb210=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0x210b[_0x18a436];return _0x5c2cf8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb210('0x0'));var rimraf=require(_0xb210('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb210('0x2'));var rp=require(_0xb210('0x3'));var moment=require(_0xb210('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb210('0x5'));var util=require('util');var path=require(_0xb210('0x6'));var sox=require('sox');var csv=require(_0xb210('0x7'));var ejs=require(_0xb210('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb210('0x9'));var crypto=require(_0xb210('0xa'));var jsforce=require(_0xb210('0xb'));var deskjs=require(_0xb210('0xc'));var toCsv=require(_0xb210('0x7'));var querystring=require(_0xb210('0xd'));var Papa=require(_0xb210('0xe'));var Redis=require(_0xb210('0xf'));var authService=require(_0xb210('0x10'));var qs=require(_0xb210('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb210('0x12'));var utils=require(_0xb210('0x13'));var config=require('../../config/environment');var db=require(_0xb210('0x14'))['db'];var jayson=require(_0xb210('0x15'));var client=jayson[_0xb210('0x16')][_0xb210('0x17')]({'port':0x232a});function checkPasswordPattern(_0x4c2707,_0x189d4b,_0x395a74){if(_0x395a74){var _0x1ae717=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ae717[_0xb210('0x18')](_0x189d4b)){return _0x4c2707;}else{throw new db[(_0xb210('0x19'))][(_0xb210('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4c2707;}}function respondWithRpcPromise(_0x5b6e38,_0x3725a6,_0x4eafc1,_0x3a1898){return new BPromise(function(_0x12000a,_0x21c1db){var _0x15871d=_0x3a1898||client;return _0x15871d[_0xb210('0x1b')](_0x5b6e38,_0x4eafc1)[_0xb210('0x1c')](function(_0x25245c){logger[_0xb210('0x1d')](_0xb210('0x1e'),_0x3725a6,_0xb210('0x1f'));logger[_0xb210('0x20')](_0xb210('0x21'),_0x3725a6,'request\x20sent',JSON[_0xb210('0x22')](_0x25245c));if(_0x25245c[_0xb210('0x23')]){if(_0x25245c['error']['code']===0x1f4){logger[_0xb210('0x23')](_0xb210('0x1e'),_0x3725a6,_0x25245c[_0xb210('0x23')]['message']);return _0x21c1db(_0x25245c[_0xb210('0x23')][_0xb210('0x24')]);}logger['error'](_0xb210('0x1e'),_0x3725a6,_0x25245c[_0xb210('0x23')][_0xb210('0x24')]);return _0x12000a(_0x25245c[_0xb210('0x23')][_0xb210('0x24')]);}else{logger[_0xb210('0x1d')](_0xb210('0x1e'),_0x3725a6,_0xb210('0x1f'));_0x12000a(_0x25245c[_0xb210('0x25')]['message']);}})[_0xb210('0x26')](function(_0x4cf5fb){logger['error'](_0xb210('0x1e'),_0x3725a6,_0x4cf5fb);_0x21c1db(_0x4cf5fb);});});}function respondWithStatusCode(_0x1c28c4,_0x48e195){_0x48e195=_0x48e195||0xcc;return function(_0x3d7e28){if(_0x3d7e28){return _0x1c28c4[_0xb210('0x27')](_0x48e195);}return _0x1c28c4[_0xb210('0x28')](_0x48e195)[_0xb210('0x29')]();};}function respondWithResult(_0x4bb10b,_0x1da3d5){_0x1da3d5=_0x1da3d5||0xc8;return function(_0x4ac5b0){if(_0x4ac5b0){return _0x4bb10b[_0xb210('0x28')](_0x1da3d5)['json'](_0x4ac5b0);}};}function respondWithFilteredResult(_0x47ac43,_0x1a700f){return function(_0x23d449){if(_0x23d449){var _0x282535=_0x23d449['count'],_0x4a61a0=_0x1a700f['offset'],_0xaa89f2=_0x1a700f['offset']+_0x1a700f[_0xb210('0x2a')],_0x154558;if(_0xaa89f2>=_0x282535){_0xaa89f2=_0x282535;_0x154558=0xc8;}else{_0x154558=0xce;}_0x47ac43[_0xb210('0x28')](_0x154558);return _0x47ac43[_0xb210('0x2b')](_0xb210('0x2c'),_0x4a61a0+'-'+_0xaa89f2+'/'+_0x282535)[_0xb210('0x2d')](_0x23d449);}return null;};}function patchUpdates(_0x59d17c){return function(_0x44a384){try{jsonpatch[_0xb210('0x2e')](_0x44a384,_0x59d17c,!![]);}catch(_0x1b4c03){return BPromise[_0xb210('0x2f')](_0x1b4c03);}return _0x44a384['save']();};}function saveUpdates(_0x109369,_0x46572f){return function(_0x31d847){if(_0x31d847){return _0x31d847[_0xb210('0x30')](_0x109369)['then'](function(_0x1407c4){return _0x1407c4;});}return null;};}function removeEntity(_0x3ff072,_0x585146){return function(_0x430f41){if(_0x430f41){return _0x430f41[_0xb210('0x31')]()['then'](function(){_0x3ff072[_0xb210('0x28')](0xcc)[_0xb210('0x29')]();});}};}function handleEntityNotFound(_0x36fc5a,_0x5650fa){return function(_0x14a45d){if(!_0x14a45d){_0x36fc5a[_0xb210('0x27')](0x194);}return _0x14a45d;};}function handleError(_0x1c203a,_0x3bfac3){_0x3bfac3=_0x3bfac3||0x1f4;return function(_0x207372){logger[_0xb210('0x23')](_0x207372[_0xb210('0x32')]);if(_0x207372['name']){delete _0x207372[_0xb210('0x33')];}_0x1c203a['status'](_0x3bfac3)[_0xb210('0x34')](_0x207372);};}exports[_0xb210('0x35')]=function(_0x16d6b4,_0x80ba0c){var _0x11222e={},_0x2cd092={},_0x1495a2={'count':0x0,'rows':[]};var _0x59da11=_[_0xb210('0x36')](db[_0xb210('0x37')][_0xb210('0x38')],function(_0x564c33){return{'name':_0x564c33[_0xb210('0x39')],'type':_0x564c33['type'][_0xb210('0x3a')]};});_0x2cd092[_0xb210('0x3b')]=_[_0xb210('0x36')](_0x59da11,'name');_0x2cd092[_0xb210('0x3c')]=_['keys'](_0x16d6b4[_0xb210('0x3c')]);_0x2cd092[_0xb210('0x3d')]=_[_0xb210('0x3e')](_0x2cd092[_0xb210('0x3b')],_0x2cd092['query']);_0x11222e[_0xb210('0x3f')]=_[_0xb210('0x3e')](_0x2cd092[_0xb210('0x3b')],qs[_0xb210('0x40')](_0x16d6b4[_0xb210('0x3c')][_0xb210('0x40')]));_0x11222e[_0xb210('0x3f')]=_0x11222e[_0xb210('0x3f')][_0xb210('0x41')]?_0x11222e['attributes']:_0x2cd092[_0xb210('0x3b')];if(!_0x16d6b4[_0xb210('0x3c')][_0xb210('0x42')](_0xb210('0x43'))){_0x11222e[_0xb210('0x2a')]=qs[_0xb210('0x2a')](_0x16d6b4[_0xb210('0x3c')][_0xb210('0x2a')]);_0x11222e[_0xb210('0x44')]=qs[_0xb210('0x44')](_0x16d6b4[_0xb210('0x3c')]['offset']);}_0x11222e[_0xb210('0x45')]=qs[_0xb210('0x46')](_0x16d6b4[_0xb210('0x3c')]['sort']);_0x11222e['where']=qs[_0xb210('0x3d')](_[_0xb210('0x47')](_0x16d6b4['query'],_0x2cd092[_0xb210('0x3d')]));if(_0x16d6b4['query'][_0xb210('0x48')]){_0x11222e['where']=_[_0xb210('0x49')](_0x11222e[_0xb210('0x4a')],{'$or':_[_0xb210('0x36')](_0x59da11,function(_0x3e40cc){if(_0x3e40cc[_0xb210('0x4b')]!==_0xb210('0x4c')){var _0x5f4b51={};_0x5f4b51[_0x3e40cc[_0xb210('0x33')]]={'$like':'%'+_0x16d6b4[_0xb210('0x3c')]['filter']+'%'};return _0x5f4b51;}})});}_0x11222e=_['merge']({},_0x11222e,_0x16d6b4[_0xb210('0x4d')]);var _0x557ee4={'where':_0x11222e[_0xb210('0x4a')]};return db[_0xb210('0x37')][_0xb210('0x4e')](_0x557ee4)[_0xb210('0x1c')](function(_0x5aa616){_0x1495a2[_0xb210('0x4e')]=_0x5aa616;if(_0x16d6b4[_0xb210('0x3c')]['includeAll']){_0x11222e[_0xb210('0x4f')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x11222e);})[_0xb210('0x1c')](function(_0x649174){_0x1495a2[_0xb210('0x50')]=_0x649174;return _0x1495a2;})['then'](respondWithFilteredResult(_0x80ba0c,_0x11222e))[_0xb210('0x26')](handleError(_0x80ba0c,null));};exports['show']=function(_0x431dea,_0x937e96){var _0x494d20={'raw':![],'where':{'id':_0x431dea[_0xb210('0x51')]['id']}},_0x4a2723={};_0x4a2723[_0xb210('0x3b')]=_[_0xb210('0x52')](db[_0xb210('0x37')]['rawAttributes']);_0x4a2723[_0xb210('0x3c')]=_[_0xb210('0x52')](_0x431dea[_0xb210('0x3c')]);_0x4a2723[_0xb210('0x3d')]=_[_0xb210('0x3e')](_0x4a2723[_0xb210('0x3b')],_0x4a2723[_0xb210('0x3c')]);_0x494d20[_0xb210('0x3f')]=_['intersection'](_0x4a2723[_0xb210('0x3b')],qs[_0xb210('0x40')](_0x431dea[_0xb210('0x3c')][_0xb210('0x40')]));_0x494d20[_0xb210('0x3f')]=_0x494d20[_0xb210('0x3f')][_0xb210('0x41')]?_0x494d20['attributes']:_0x4a2723[_0xb210('0x3b')];if(_0x431dea[_0xb210('0x3c')][_0xb210('0x53')]){_0x494d20[_0xb210('0x4f')]=[{'all':!![]}];}_0x494d20=_[_0xb210('0x49')]({},_0x494d20,_0x431dea[_0xb210('0x4d')]);return db[_0xb210('0x37')][_0xb210('0x54')](_0x494d20)[_0xb210('0x1c')](handleEntityNotFound(_0x937e96,null))[_0xb210('0x1c')](respondWithResult(_0x937e96,null))[_0xb210('0x26')](handleError(_0x937e96,null));};exports[_0xb210('0x55')]=function(_0x3acd43,_0x380075){return db[_0xb210('0x37')][_0xb210('0x55')](_0x3acd43['body'],{})['then'](respondWithResult(_0x380075,0xc9))[_0xb210('0x26')](handleError(_0x380075,null));};exports[_0xb210('0x30')]=function(_0x69e446,_0x569eba){if(_0x69e446[_0xb210('0x56')]['id']){delete _0x69e446[_0xb210('0x56')]['id'];}return db[_0xb210('0x37')][_0xb210('0x54')]({'where':{'id':_0x69e446['params']['id']}})['then'](handleEntityNotFound(_0x569eba,null))[_0xb210('0x1c')](saveUpdates(_0x69e446['body'],null))[_0xb210('0x1c')](respondWithResult(_0x569eba,null))[_0xb210('0x26')](handleError(_0x569eba,null));};exports[_0xb210('0x31')]=function(_0x337a45,_0x275222){return db['FreshdeskConfiguration'][_0xb210('0x54')]({'where':{'id':_0x337a45[_0xb210('0x51')]['id']}})[_0xb210('0x1c')](handleEntityNotFound(_0x275222,null))[_0xb210('0x1c')](removeEntity(_0x275222,null))['catch'](handleError(_0x275222,null));};exports['getFields']=function(_0x49877a,_0xf84a94,_0x3cbb29){var _0x4758ff={};var _0x136cec={};var _0x32aed6;var _0x511966;return db[_0xb210('0x37')]['findOne']({'where':{'id':_0x49877a[_0xb210('0x51')]['id']}})[_0xb210('0x1c')](handleEntityNotFound(_0xf84a94,null))[_0xb210('0x1c')](function(_0x23a019){if(_0x23a019){_0x32aed6=_0x23a019;_0x136cec[_0xb210('0x3b')]=_['keys'](db[_0xb210('0x57')][_0xb210('0x38')]);_0x136cec[_0xb210('0x3c')]=_[_0xb210('0x52')](_0x49877a[_0xb210('0x3c')]);_0x136cec[_0xb210('0x3d')]=_[_0xb210('0x3e')](_0x136cec[_0xb210('0x3b')],_0x136cec[_0xb210('0x3c')]);_0x4758ff[_0xb210('0x3f')]=_[_0xb210('0x3e')](_0x136cec[_0xb210('0x3b')],qs[_0xb210('0x40')](_0x49877a[_0xb210('0x3c')]['fields']));_0x4758ff[_0xb210('0x3f')]=_0x4758ff[_0xb210('0x3f')][_0xb210('0x41')]?_0x4758ff[_0xb210('0x3f')]:_0x136cec[_0xb210('0x3b')];_0x4758ff[_0xb210('0x45')]=qs[_0xb210('0x46')](_0x49877a[_0xb210('0x3c')]['sort']);_0x4758ff[_0xb210('0x4a')]=qs['filters'](_['pick'](_0x49877a[_0xb210('0x3c')],_0x136cec[_0xb210('0x3d')]));if(_0x49877a[_0xb210('0x3c')][_0xb210('0x48')]){_0x4758ff['where']=_['merge'](_0x4758ff[_0xb210('0x4a')],{'$or':_['map'](_0x4758ff[_0xb210('0x3f')],function(_0x19a696){var _0x258e67={};_0x258e67[_0x19a696]={'$like':'%'+_0x49877a['query'][_0xb210('0x48')]+'%'};return _0x258e67;})});}_0x4758ff=_[_0xb210('0x49')]({},_0x4758ff,_0x49877a[_0xb210('0x4d')]);return _0x32aed6[_0xb210('0x58')](_0x4758ff);}})[_0xb210('0x1c')](function(_0x385775){if(_0x385775){_0x511966=_0x385775[_0xb210('0x41')];if(!_0x49877a[_0xb210('0x3c')][_0xb210('0x42')](_0xb210('0x43'))){_0x4758ff[_0xb210('0x2a')]=qs['limit'](_0x49877a[_0xb210('0x3c')]['limit']);_0x4758ff[_0xb210('0x44')]=qs[_0xb210('0x44')](_0x49877a[_0xb210('0x3c')]['offset']);}return _0x32aed6['getFields'](_0x4758ff);}})[_0xb210('0x1c')](function(_0x1fd07e){if(_0x1fd07e){return _0x1fd07e?{'count':_0x511966,'rows':_0x1fd07e}:null;}})[_0xb210('0x1c')](respondWithResult(_0xf84a94,null))[_0xb210('0x26')](handleError(_0xf84a94,null));};exports[_0xb210('0x59')]=function(_0x5cd75f,_0xef8847,_0x3e2d5c){var _0x582178={};var _0x130102={};var _0x27f7d6;var _0x40d8bb;return db[_0xb210('0x37')][_0xb210('0x5a')]({'where':{'id':_0x5cd75f[_0xb210('0x51')]['id']}})['then'](handleEntityNotFound(_0xef8847,null))[_0xb210('0x1c')](function(_0x531572){if(_0x531572){_0x27f7d6=_0x531572;_0x130102[_0xb210('0x3b')]=_['keys'](db[_0xb210('0x57')][_0xb210('0x38')]);_0x130102[_0xb210('0x3c')]=_[_0xb210('0x52')](_0x5cd75f[_0xb210('0x3c')]);_0x130102[_0xb210('0x3d')]=_[_0xb210('0x3e')](_0x130102['model'],_0x130102['query']);_0x582178[_0xb210('0x3f')]=_[_0xb210('0x3e')](_0x130102[_0xb210('0x3b')],qs[_0xb210('0x40')](_0x5cd75f[_0xb210('0x3c')][_0xb210('0x40')]));_0x582178[_0xb210('0x3f')]=_0x582178[_0xb210('0x3f')][_0xb210('0x41')]?_0x582178[_0xb210('0x3f')]:_0x130102[_0xb210('0x3b')];_0x582178[_0xb210('0x45')]=qs[_0xb210('0x46')](_0x5cd75f[_0xb210('0x3c')]['sort']);_0x582178['where']=qs[_0xb210('0x3d')](_[_0xb210('0x47')](_0x5cd75f[_0xb210('0x3c')],_0x130102[_0xb210('0x3d')]));if(_0x5cd75f[_0xb210('0x3c')][_0xb210('0x48')]){_0x582178[_0xb210('0x4a')]=_[_0xb210('0x49')](_0x582178[_0xb210('0x4a')],{'$or':_['map'](_0x582178['attributes'],function(_0x2fe3b1){var _0x2731d5={};_0x2731d5[_0x2fe3b1]={'$like':'%'+_0x5cd75f[_0xb210('0x3c')][_0xb210('0x48')]+'%'};return _0x2731d5;})});}_0x582178=_[_0xb210('0x49')]({},_0x582178,_0x5cd75f[_0xb210('0x4d')]);return _0x27f7d6['getSubjects'](_0x582178);}})['then'](function(_0x4817da){if(_0x4817da){_0x40d8bb=_0x4817da[_0xb210('0x41')];if(!_0x5cd75f[_0xb210('0x3c')][_0xb210('0x42')](_0xb210('0x43'))){_0x582178[_0xb210('0x2a')]=qs[_0xb210('0x2a')](_0x5cd75f['query'][_0xb210('0x2a')]);_0x582178[_0xb210('0x44')]=qs[_0xb210('0x44')](_0x5cd75f['query'][_0xb210('0x44')]);}return _0x27f7d6[_0xb210('0x59')](_0x582178);}})[_0xb210('0x1c')](function(_0x12cefb){if(_0x12cefb){return _0x12cefb?{'count':_0x40d8bb,'rows':_0x12cefb}:null;}})[_0xb210('0x1c')](respondWithResult(_0xef8847,null))[_0xb210('0x26')](handleError(_0xef8847,null));};exports['getDescriptions']=function(_0x1e936a,_0x4a8055,_0x1873ee){var _0x376173={};var _0x540158={};var _0x56ac03;var _0x227ea7;return db['FreshdeskConfiguration'][_0xb210('0x5a')]({'where':{'id':_0x1e936a[_0xb210('0x51')]['id']}})['then'](handleEntityNotFound(_0x4a8055,null))[_0xb210('0x1c')](function(_0x313ca0){if(_0x313ca0){_0x56ac03=_0x313ca0;_0x540158[_0xb210('0x3b')]=_[_0xb210('0x52')](db[_0xb210('0x57')]['rawAttributes']);_0x540158['query']=_['keys'](_0x1e936a[_0xb210('0x3c')]);_0x540158[_0xb210('0x3d')]=_[_0xb210('0x3e')](_0x540158[_0xb210('0x3b')],_0x540158[_0xb210('0x3c')]);_0x376173[_0xb210('0x3f')]=_[_0xb210('0x3e')](_0x540158[_0xb210('0x3b')],qs[_0xb210('0x40')](_0x1e936a[_0xb210('0x3c')][_0xb210('0x40')]));_0x376173[_0xb210('0x3f')]=_0x376173[_0xb210('0x3f')][_0xb210('0x41')]?_0x376173[_0xb210('0x3f')]:_0x540158['model'];_0x376173[_0xb210('0x45')]=qs[_0xb210('0x46')](_0x1e936a[_0xb210('0x3c')][_0xb210('0x46')]);_0x376173[_0xb210('0x4a')]=qs[_0xb210('0x3d')](_[_0xb210('0x47')](_0x1e936a['query'],_0x540158['filters']));if(_0x1e936a[_0xb210('0x3c')][_0xb210('0x48')]){_0x376173[_0xb210('0x4a')]=_[_0xb210('0x49')](_0x376173[_0xb210('0x4a')],{'$or':_[_0xb210('0x36')](_0x376173['attributes'],function(_0x3521b5){var _0x4cbcb2={};_0x4cbcb2[_0x3521b5]={'$like':'%'+_0x1e936a['query'][_0xb210('0x48')]+'%'};return _0x4cbcb2;})});}_0x376173=_[_0xb210('0x49')]({},_0x376173,_0x1e936a[_0xb210('0x4d')]);return _0x56ac03[_0xb210('0x5b')](_0x376173);}})[_0xb210('0x1c')](function(_0x2db6b3){if(_0x2db6b3){_0x227ea7=_0x2db6b3['length'];if(!_0x1e936a[_0xb210('0x3c')]['hasOwnProperty'](_0xb210('0x43'))){_0x376173[_0xb210('0x2a')]=qs[_0xb210('0x2a')](_0x1e936a[_0xb210('0x3c')]['limit']);_0x376173['offset']=qs[_0xb210('0x44')](_0x1e936a[_0xb210('0x3c')][_0xb210('0x44')]);}return _0x56ac03['getDescriptions'](_0x376173);}})[_0xb210('0x1c')](function(_0x1d86fa){if(_0x1d86fa){return _0x1d86fa?{'count':_0x227ea7,'rows':_0x1d86fa}:null;}})['then'](respondWithResult(_0x4a8055,null))[_0xb210('0x26')](handleError(_0x4a8055,null));};exports['getTags']=function(_0xe525e6,_0x3cf841,_0x5915d5){var _0x122046={};var _0x1dbe3d={};var _0x1a8f5e;var _0x527685;return db[_0xb210('0x37')][_0xb210('0x5a')]({'where':{'id':_0xe525e6[_0xb210('0x51')]['id']}})[_0xb210('0x1c')](handleEntityNotFound(_0x3cf841,null))[_0xb210('0x1c')](function(_0x1495ef){if(_0x1495ef){_0x1a8f5e=_0x1495ef;_0x1dbe3d[_0xb210('0x3b')]=_['keys'](db['Tag'][_0xb210('0x38')]);_0x1dbe3d['query']=_[_0xb210('0x52')](_0xe525e6[_0xb210('0x3c')]);_0x1dbe3d[_0xb210('0x3d')]=_[_0xb210('0x3e')](_0x1dbe3d[_0xb210('0x3b')],_0x1dbe3d[_0xb210('0x3c')]);_0x122046[_0xb210('0x3f')]=_['intersection'](_0x1dbe3d[_0xb210('0x3b')],qs['fields'](_0xe525e6[_0xb210('0x3c')]['fields']));_0x122046[_0xb210('0x3f')]=_0x122046['attributes'][_0xb210('0x41')]?_0x122046[_0xb210('0x3f')]:_0x1dbe3d[_0xb210('0x3b')];_0x122046[_0xb210('0x45')]=qs['sort'](_0xe525e6[_0xb210('0x3c')]['sort']);_0x122046[_0xb210('0x4a')]=qs[_0xb210('0x3d')](_['pick'](_0xe525e6['query'],_0x1dbe3d[_0xb210('0x3d')]));if(_0xe525e6[_0xb210('0x3c')][_0xb210('0x48')]){_0x122046[_0xb210('0x4a')]=_['merge'](_0x122046[_0xb210('0x4a')],{'$or':_[_0xb210('0x36')](_0x122046[_0xb210('0x3f')],function(_0x486c6e){var _0x1ac710={};_0x1ac710[_0x486c6e]={'$like':'%'+_0xe525e6[_0xb210('0x3c')]['filter']+'%'};return _0x1ac710;})});}_0x122046=_[_0xb210('0x49')]({},_0x122046,_0xe525e6[_0xb210('0x4d')]);return _0x1a8f5e[_0xb210('0x5c')](_0x122046);}})[_0xb210('0x1c')](function(_0x181963){if(_0x181963){_0x527685=_0x181963[_0xb210('0x41')];if(!_0xe525e6[_0xb210('0x3c')][_0xb210('0x42')](_0xb210('0x43'))){_0x122046[_0xb210('0x2a')]=qs[_0xb210('0x2a')](_0xe525e6[_0xb210('0x3c')]['limit']);_0x122046[_0xb210('0x44')]=qs[_0xb210('0x44')](_0xe525e6[_0xb210('0x3c')][_0xb210('0x44')]);}return _0x1a8f5e[_0xb210('0x5c')](_0x122046);}})[_0xb210('0x1c')](function(_0x5b9c8b){if(_0x5b9c8b){return _0x5b9c8b?{'count':_0x527685,'rows':_0x5b9c8b}:null;}})[_0xb210('0x1c')](respondWithResult(_0x3cf841,null))[_0xb210('0x26')](handleError(_0x3cf841,null));};exports[_0xb210('0x5d')]=function(_0x43bc49,_0xaece97,_0x171d2e){if(_0x43bc49['body']['id']){delete _0x43bc49[_0xb210('0x56')]['id'];}return db['FreshdeskConfiguration'][_0xb210('0x5a')]({'where':{'id':_0x43bc49[_0xb210('0x51')]['id']}})[_0xb210('0x1c')](handleEntityNotFound(_0xaece97,null))['then'](function(_0x22ae8f){if(_0x22ae8f){return _0x22ae8f['setTags'](_0x43bc49['body'][_0xb210('0x5e')]||[]);}return null;})[_0xb210('0x1c')](respondWithResult(_0xaece97,null))['catch'](handleError(_0xaece97,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