Built motion from commit 092f8824.|2.5.49
[motion2.git] / server / api / intZendeskConfiguration / intZendeskConfiguration.controller.js
index 8c46a92..1442b95 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfc3f=['../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','index','ZendeskConfiguration','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','name','merge','includeAll','include','findAll','rows','find','catch','create','body','params','destroy','getFields','ZendeskField','filters','getSubjects','findOne','options','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','jsforce','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x2ac9b2,_0x58e483){var _0x4bca19=function(_0x302f60){while(--_0x302f60){_0x2ac9b2['push'](_0x2ac9b2['shift']());}};_0x4bca19(++_0x58e483);}(_0xfc3f,0x93));var _0xffc3=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xfc3f[_0x2576d7];return _0x16a08c;};'use strict';var emlformat=require(_0xffc3('0x0'));var rimraf=require(_0xffc3('0x1'));var zipdir=require(_0xffc3('0x2'));var jsonpatch=require(_0xffc3('0x3'));var rp=require(_0xffc3('0x4'));var moment=require(_0xffc3('0x5'));var BPromise=require(_0xffc3('0x6'));var Mustache=require(_0xffc3('0x7'));var util=require(_0xffc3('0x8'));var path=require(_0xffc3('0x9'));var sox=require(_0xffc3('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xffc3('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xffc3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xffc3('0xd'));var querystring=require(_0xffc3('0xe'));var Papa=require('papaparse');var Redis=require(_0xffc3('0xf'));var authService=require(_0xffc3('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xffc3('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xffc3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xffc3('0x13'))['db'];function respondWithStatusCode(_0x352f72,_0x3645d6){_0x3645d6=_0x3645d6||0xcc;return function(_0x26ab33){if(_0x26ab33){return _0x352f72[_0xffc3('0x14')](_0x3645d6);}return _0x352f72[_0xffc3('0x15')](_0x3645d6)[_0xffc3('0x16')]();};}function respondWithResult(_0x117f35,_0xbb0690){_0xbb0690=_0xbb0690||0xc8;return function(_0x2d18c1){if(_0x2d18c1){return _0x117f35[_0xffc3('0x15')](_0xbb0690)[_0xffc3('0x17')](_0x2d18c1);}};}function respondWithFilteredResult(_0x51bb28,_0x1c9642){return function(_0x552a90){if(_0x552a90){var _0x7042e8=typeof _0x1c9642[_0xffc3('0x18')]==='undefined'&&typeof _0x1c9642[_0xffc3('0x19')]===_0xffc3('0x1a');var _0x3f3a04=_0x552a90[_0xffc3('0x1b')];var _0x3ae5d7=_0x7042e8?0x0:_0x1c9642['offset'];var _0x294f59=_0x7042e8?_0x552a90[_0xffc3('0x1b')]:_0x1c9642['offset']+_0x1c9642[_0xffc3('0x19')];var _0x4c5d06;if(_0x294f59>=_0x3f3a04){_0x294f59=_0x3f3a04;_0x4c5d06=0xc8;}else{_0x4c5d06=0xce;}_0x51bb28[_0xffc3('0x15')](_0x4c5d06);return _0x51bb28[_0xffc3('0x1c')](_0xffc3('0x1d'),_0x3ae5d7+'-'+_0x294f59+'/'+_0x3f3a04)['json'](_0x552a90);}return null;};}function patchUpdates(_0x4ee073){return function(_0x3feefa){try{jsonpatch[_0xffc3('0x1e')](_0x3feefa,_0x4ee073,!![]);}catch(_0x944e44){return BPromise[_0xffc3('0x1f')](_0x944e44);}return _0x3feefa[_0xffc3('0x20')]();};}function saveUpdates(_0x22229c,_0x5511f0){return function(_0x2b1590){if(_0x2b1590){return _0x2b1590[_0xffc3('0x21')](_0x22229c)[_0xffc3('0x22')](function(_0x11b4ac){return _0x11b4ac;});}return null;};}function removeEntity(_0x47bf6f,_0x25c838){return function(_0x4b7dd2){if(_0x4b7dd2){return _0x4b7dd2['destroy']()[_0xffc3('0x22')](function(){_0x47bf6f[_0xffc3('0x15')](0xcc)[_0xffc3('0x16')]();});}};}function handleEntityNotFound(_0x4f742f,_0x12344b){return function(_0xe9ae1b){if(!_0xe9ae1b){_0x4f742f['sendStatus'](0x194);}return _0xe9ae1b;};}function handleError(_0x231e8b,_0x2ac772){_0x2ac772=_0x2ac772||0x1f4;return function(_0x222a54){logger[_0xffc3('0x23')](_0x222a54[_0xffc3('0x24')]);if(_0x222a54['name']){delete _0x222a54['name'];}_0x231e8b[_0xffc3('0x15')](_0x2ac772)['send'](_0x222a54);};}exports[_0xffc3('0x25')]=function(_0x214bbe,_0x2dc6d9){var _0x5df468={},_0x1f7be2={},_0x55deda={'count':0x0,'rows':[]};var _0x518f42=_['map'](db[_0xffc3('0x26')][_0xffc3('0x27')],function(_0x58f0f5){return{'name':_0x58f0f5[_0xffc3('0x28')],'type':_0x58f0f5['type'][_0xffc3('0x29')]};});_0x1f7be2[_0xffc3('0x2a')]=_[_0xffc3('0x2b')](_0x518f42,'name');_0x1f7be2[_0xffc3('0x2c')]=_[_0xffc3('0x2d')](_0x214bbe[_0xffc3('0x2c')]);_0x1f7be2['filters']=_[_0xffc3('0x2e')](_0x1f7be2[_0xffc3('0x2a')],_0x1f7be2[_0xffc3('0x2c')]);_0x5df468[_0xffc3('0x2f')]=_[_0xffc3('0x2e')](_0x1f7be2[_0xffc3('0x2a')],qs[_0xffc3('0x30')](_0x214bbe['query'][_0xffc3('0x30')]));_0x5df468['attributes']=_0x5df468[_0xffc3('0x2f')][_0xffc3('0x31')]?_0x5df468['attributes']:_0x1f7be2[_0xffc3('0x2a')];if(!_0x214bbe['query'][_0xffc3('0x32')](_0xffc3('0x33'))){_0x5df468[_0xffc3('0x19')]=qs[_0xffc3('0x19')](_0x214bbe['query'][_0xffc3('0x19')]);_0x5df468[_0xffc3('0x18')]=qs[_0xffc3('0x18')](_0x214bbe[_0xffc3('0x2c')][_0xffc3('0x18')]);}_0x5df468[_0xffc3('0x34')]=qs[_0xffc3('0x35')](_0x214bbe['query']['sort']);_0x5df468[_0xffc3('0x36')]=qs['filters'](_[_0xffc3('0x37')](_0x214bbe['query'],_0x1f7be2['filters']),_0x518f42);if(_0x214bbe[_0xffc3('0x2c')][_0xffc3('0x38')]){_0x5df468[_0xffc3('0x36')]=_['merge'](_0x5df468[_0xffc3('0x36')],{'$or':_[_0xffc3('0x2b')](_0x518f42,function(_0xdb6cf0){if(_0xdb6cf0[_0xffc3('0x39')]!==_0xffc3('0x3a')){var _0x219808={};_0x219808[_0xdb6cf0[_0xffc3('0x3b')]]={'$like':'%'+_0x214bbe[_0xffc3('0x2c')][_0xffc3('0x38')]+'%'};return _0x219808;}})});}_0x5df468=_[_0xffc3('0x3c')]({},_0x5df468,_0x214bbe['options']);var _0xce7977={'where':_0x5df468[_0xffc3('0x36')]};return db[_0xffc3('0x26')][_0xffc3('0x1b')](_0xce7977)[_0xffc3('0x22')](function(_0x21d2a7){_0x55deda[_0xffc3('0x1b')]=_0x21d2a7;if(_0x214bbe[_0xffc3('0x2c')][_0xffc3('0x3d')]){_0x5df468[_0xffc3('0x3e')]=[{'all':!![]}];}return db[_0xffc3('0x26')][_0xffc3('0x3f')](_0x5df468);})[_0xffc3('0x22')](function(_0xb186a4){_0x55deda[_0xffc3('0x40')]=_0xb186a4;return _0x55deda;})[_0xffc3('0x22')](respondWithFilteredResult(_0x2dc6d9,_0x5df468))['catch'](handleError(_0x2dc6d9,null));};exports['show']=function(_0x52da35,_0x706d7d){var _0x488627={'raw':![],'where':{'id':_0x52da35['params']['id']}},_0x5d6eb0={};_0x5d6eb0[_0xffc3('0x2a')]=_[_0xffc3('0x2d')](db[_0xffc3('0x26')][_0xffc3('0x27')]);_0x5d6eb0[_0xffc3('0x2c')]=_['keys'](_0x52da35[_0xffc3('0x2c')]);_0x5d6eb0['filters']=_[_0xffc3('0x2e')](_0x5d6eb0[_0xffc3('0x2a')],_0x5d6eb0[_0xffc3('0x2c')]);_0x488627[_0xffc3('0x2f')]=_['intersection'](_0x5d6eb0[_0xffc3('0x2a')],qs[_0xffc3('0x30')](_0x52da35[_0xffc3('0x2c')]['fields']));_0x488627['attributes']=_0x488627[_0xffc3('0x2f')][_0xffc3('0x31')]?_0x488627[_0xffc3('0x2f')]:_0x5d6eb0['model'];if(_0x52da35['query']['includeAll']){_0x488627['include']=[{'all':!![]}];}_0x488627=_['merge']({},_0x488627,_0x52da35['options']);return db[_0xffc3('0x26')][_0xffc3('0x41')](_0x488627)[_0xffc3('0x22')](handleEntityNotFound(_0x706d7d,null))[_0xffc3('0x22')](respondWithResult(_0x706d7d,null))[_0xffc3('0x42')](handleError(_0x706d7d,null));};exports[_0xffc3('0x43')]=function(_0x3ff3f5,_0x38090d){return db[_0xffc3('0x26')]['create'](_0x3ff3f5[_0xffc3('0x44')],{})[_0xffc3('0x22')](respondWithResult(_0x38090d,0xc9))[_0xffc3('0x42')](handleError(_0x38090d,null));};exports[_0xffc3('0x21')]=function(_0x1f47f1,_0x4ff464){if(_0x1f47f1[_0xffc3('0x44')]['id']){delete _0x1f47f1['body']['id'];}return db[_0xffc3('0x26')][_0xffc3('0x41')]({'where':{'id':_0x1f47f1[_0xffc3('0x45')]['id']}})['then'](handleEntityNotFound(_0x4ff464,null))[_0xffc3('0x22')](saveUpdates(_0x1f47f1[_0xffc3('0x44')],null))[_0xffc3('0x22')](respondWithResult(_0x4ff464,null))['catch'](handleError(_0x4ff464,null));};exports[_0xffc3('0x46')]=function(_0x4b36bf,_0x256e58){return db[_0xffc3('0x26')][_0xffc3('0x41')]({'where':{'id':_0x4b36bf['params']['id']}})[_0xffc3('0x22')](handleEntityNotFound(_0x256e58,null))[_0xffc3('0x22')](removeEntity(_0x256e58,null))[_0xffc3('0x42')](handleError(_0x256e58,null));};exports[_0xffc3('0x47')]=function(_0x483481,_0x1884f2,_0x816b67){var _0x375e03={};var _0x20d013={};var _0x150b68;var _0x34c6d1;return db[_0xffc3('0x26')]['findOne']({'where':{'id':_0x483481[_0xffc3('0x45')]['id']}})[_0xffc3('0x22')](handleEntityNotFound(_0x1884f2,null))[_0xffc3('0x22')](function(_0x4b76c4){if(_0x4b76c4){_0x150b68=_0x4b76c4;_0x20d013[_0xffc3('0x2a')]=_['keys'](db[_0xffc3('0x48')][_0xffc3('0x27')]);_0x20d013[_0xffc3('0x2c')]=_[_0xffc3('0x2d')](_0x483481[_0xffc3('0x2c')]);_0x20d013[_0xffc3('0x49')]=_[_0xffc3('0x2e')](_0x20d013['model'],_0x20d013[_0xffc3('0x2c')]);_0x375e03['attributes']=_[_0xffc3('0x2e')](_0x20d013[_0xffc3('0x2a')],qs[_0xffc3('0x30')](_0x483481[_0xffc3('0x2c')]['fields']));_0x375e03[_0xffc3('0x2f')]=_0x375e03[_0xffc3('0x2f')][_0xffc3('0x31')]?_0x375e03[_0xffc3('0x2f')]:_0x20d013[_0xffc3('0x2a')];_0x375e03[_0xffc3('0x34')]=qs[_0xffc3('0x35')](_0x483481[_0xffc3('0x2c')][_0xffc3('0x35')]);_0x375e03[_0xffc3('0x36')]=qs[_0xffc3('0x49')](_[_0xffc3('0x37')](_0x483481['query'],_0x20d013[_0xffc3('0x49')]));if(_0x483481[_0xffc3('0x2c')][_0xffc3('0x38')]){_0x375e03[_0xffc3('0x36')]=_['merge'](_0x375e03[_0xffc3('0x36')],{'$or':_[_0xffc3('0x2b')](_0x375e03[_0xffc3('0x2f')],function(_0x372a4b){var _0x389b2a={};_0x389b2a[_0x372a4b]={'$like':'%'+_0x483481['query']['filter']+'%'};return _0x389b2a;})});}_0x375e03=_[_0xffc3('0x3c')]({},_0x375e03,_0x483481['options']);return _0x150b68['getFields'](_0x375e03);}})[_0xffc3('0x22')](function(_0x383623){if(_0x383623){_0x34c6d1=_0x383623[_0xffc3('0x31')];if(!_0x483481[_0xffc3('0x2c')][_0xffc3('0x32')](_0xffc3('0x33'))){_0x375e03[_0xffc3('0x19')]=qs['limit'](_0x483481['query']['limit']);_0x375e03[_0xffc3('0x18')]=qs[_0xffc3('0x18')](_0x483481['query'][_0xffc3('0x18')]);}return _0x150b68[_0xffc3('0x47')](_0x375e03);}})['then'](function(_0x5c32df){if(_0x5c32df){return _0x5c32df?{'count':_0x34c6d1,'rows':_0x5c32df}:null;}})[_0xffc3('0x22')](respondWithResult(_0x1884f2,null))['catch'](handleError(_0x1884f2,null));};exports[_0xffc3('0x4a')]=function(_0x4caddd,_0x30b2d1,_0x5f0dfa){var _0x2040e4={};var _0x447e8b={};var _0x24789c;var _0x39ef28;return db['ZendeskConfiguration'][_0xffc3('0x4b')]({'where':{'id':_0x4caddd['params']['id']}})[_0xffc3('0x22')](handleEntityNotFound(_0x30b2d1,null))[_0xffc3('0x22')](function(_0x4a06cd){if(_0x4a06cd){_0x24789c=_0x4a06cd;_0x447e8b[_0xffc3('0x2a')]=_['keys'](db[_0xffc3('0x48')][_0xffc3('0x27')]);_0x447e8b[_0xffc3('0x2c')]=_['keys'](_0x4caddd[_0xffc3('0x2c')]);_0x447e8b[_0xffc3('0x49')]=_[_0xffc3('0x2e')](_0x447e8b[_0xffc3('0x2a')],_0x447e8b[_0xffc3('0x2c')]);_0x2040e4[_0xffc3('0x2f')]=_[_0xffc3('0x2e')](_0x447e8b[_0xffc3('0x2a')],qs[_0xffc3('0x30')](_0x4caddd[_0xffc3('0x2c')][_0xffc3('0x30')]));_0x2040e4['attributes']=_0x2040e4[_0xffc3('0x2f')]['length']?_0x2040e4['attributes']:_0x447e8b[_0xffc3('0x2a')];_0x2040e4['order']=qs['sort'](_0x4caddd[_0xffc3('0x2c')][_0xffc3('0x35')]);_0x2040e4[_0xffc3('0x36')]=qs[_0xffc3('0x49')](_[_0xffc3('0x37')](_0x4caddd[_0xffc3('0x2c')],_0x447e8b[_0xffc3('0x49')]));if(_0x4caddd[_0xffc3('0x2c')]['filter']){_0x2040e4[_0xffc3('0x36')]=_[_0xffc3('0x3c')](_0x2040e4[_0xffc3('0x36')],{'$or':_[_0xffc3('0x2b')](_0x2040e4[_0xffc3('0x2f')],function(_0x38a360){var _0x1ae664={};_0x1ae664[_0x38a360]={'$like':'%'+_0x4caddd[_0xffc3('0x2c')]['filter']+'%'};return _0x1ae664;})});}_0x2040e4=_['merge']({},_0x2040e4,_0x4caddd[_0xffc3('0x4c')]);return _0x24789c[_0xffc3('0x4a')](_0x2040e4);}})[_0xffc3('0x22')](function(_0x2f5e91){if(_0x2f5e91){_0x39ef28=_0x2f5e91[_0xffc3('0x31')];if(!_0x4caddd[_0xffc3('0x2c')]['hasOwnProperty'](_0xffc3('0x33'))){_0x2040e4[_0xffc3('0x19')]=qs[_0xffc3('0x19')](_0x4caddd['query'][_0xffc3('0x19')]);_0x2040e4['offset']=qs[_0xffc3('0x18')](_0x4caddd[_0xffc3('0x2c')][_0xffc3('0x18')]);}return _0x24789c[_0xffc3('0x4a')](_0x2040e4);}})[_0xffc3('0x22')](function(_0x44e7d5){if(_0x44e7d5){return _0x44e7d5?{'count':_0x39ef28,'rows':_0x44e7d5}:null;}})[_0xffc3('0x22')](respondWithResult(_0x30b2d1,null))[_0xffc3('0x42')](handleError(_0x30b2d1,null));};exports[_0xffc3('0x4d')]=function(_0x38d23c,_0x3add86,_0x22fa18){var _0x1e3cc2={};var _0x3f31c3={};var _0x1529f2;var _0xbbc465;return db[_0xffc3('0x26')][_0xffc3('0x4b')]({'where':{'id':_0x38d23c[_0xffc3('0x45')]['id']}})[_0xffc3('0x22')](handleEntityNotFound(_0x3add86,null))[_0xffc3('0x22')](function(_0x596480){if(_0x596480){_0x1529f2=_0x596480;_0x3f31c3[_0xffc3('0x2a')]=_[_0xffc3('0x2d')](db['ZendeskField'][_0xffc3('0x27')]);_0x3f31c3[_0xffc3('0x2c')]=_[_0xffc3('0x2d')](_0x38d23c[_0xffc3('0x2c')]);_0x3f31c3[_0xffc3('0x49')]=_[_0xffc3('0x2e')](_0x3f31c3[_0xffc3('0x2a')],_0x3f31c3[_0xffc3('0x2c')]);_0x1e3cc2[_0xffc3('0x2f')]=_[_0xffc3('0x2e')](_0x3f31c3['model'],qs[_0xffc3('0x30')](_0x38d23c[_0xffc3('0x2c')][_0xffc3('0x30')]));_0x1e3cc2[_0xffc3('0x2f')]=_0x1e3cc2[_0xffc3('0x2f')][_0xffc3('0x31')]?_0x1e3cc2[_0xffc3('0x2f')]:_0x3f31c3[_0xffc3('0x2a')];_0x1e3cc2[_0xffc3('0x34')]=qs[_0xffc3('0x35')](_0x38d23c[_0xffc3('0x2c')][_0xffc3('0x35')]);_0x1e3cc2[_0xffc3('0x36')]=qs[_0xffc3('0x49')](_[_0xffc3('0x37')](_0x38d23c[_0xffc3('0x2c')],_0x3f31c3[_0xffc3('0x49')]));if(_0x38d23c['query']['filter']){_0x1e3cc2[_0xffc3('0x36')]=_['merge'](_0x1e3cc2[_0xffc3('0x36')],{'$or':_[_0xffc3('0x2b')](_0x1e3cc2[_0xffc3('0x2f')],function(_0x16f0b2){var _0x51bf90={};_0x51bf90[_0x16f0b2]={'$like':'%'+_0x38d23c[_0xffc3('0x2c')][_0xffc3('0x38')]+'%'};return _0x51bf90;})});}_0x1e3cc2=_[_0xffc3('0x3c')]({},_0x1e3cc2,_0x38d23c[_0xffc3('0x4c')]);return _0x1529f2[_0xffc3('0x4d')](_0x1e3cc2);}})[_0xffc3('0x22')](function(_0x17444b){if(_0x17444b){_0xbbc465=_0x17444b[_0xffc3('0x31')];if(!_0x38d23c[_0xffc3('0x2c')][_0xffc3('0x32')](_0xffc3('0x33'))){_0x1e3cc2['limit']=qs[_0xffc3('0x19')](_0x38d23c['query']['limit']);_0x1e3cc2['offset']=qs[_0xffc3('0x18')](_0x38d23c[_0xffc3('0x2c')][_0xffc3('0x18')]);}return _0x1529f2[_0xffc3('0x4d')](_0x1e3cc2);}})['then'](function(_0x25af7e){if(_0x25af7e){return _0x25af7e?{'count':_0xbbc465,'rows':_0x25af7e}:null;}})[_0xffc3('0x22')](respondWithResult(_0x3add86,null))[_0xffc3('0x42')](handleError(_0x3add86,null));};exports[_0xffc3('0x4e')]=function(_0x3f4db6,_0x40e542,_0x613996){var _0x1d50a9={};var _0x119d12={};var _0x41853d;var _0x1bd2b9;return db[_0xffc3('0x26')][_0xffc3('0x4b')]({'where':{'id':_0x3f4db6[_0xffc3('0x45')]['id']}})[_0xffc3('0x22')](handleEntityNotFound(_0x40e542,null))[_0xffc3('0x22')](function(_0x222b0e){if(_0x222b0e){_0x41853d=_0x222b0e;_0x119d12[_0xffc3('0x2a')]=_[_0xffc3('0x2d')](db[_0xffc3('0x4f')][_0xffc3('0x27')]);_0x119d12['query']=_[_0xffc3('0x2d')](_0x3f4db6[_0xffc3('0x2c')]);_0x119d12[_0xffc3('0x49')]=_['intersection'](_0x119d12['model'],_0x119d12[_0xffc3('0x2c')]);_0x1d50a9['attributes']=_[_0xffc3('0x2e')](_0x119d12[_0xffc3('0x2a')],qs[_0xffc3('0x30')](_0x3f4db6[_0xffc3('0x2c')][_0xffc3('0x30')]));_0x1d50a9['attributes']=_0x1d50a9['attributes'][_0xffc3('0x31')]?_0x1d50a9[_0xffc3('0x2f')]:_0x119d12[_0xffc3('0x2a')];_0x1d50a9[_0xffc3('0x34')]=qs[_0xffc3('0x35')](_0x3f4db6[_0xffc3('0x2c')][_0xffc3('0x35')]);_0x1d50a9[_0xffc3('0x36')]=qs[_0xffc3('0x49')](_[_0xffc3('0x37')](_0x3f4db6[_0xffc3('0x2c')],_0x119d12['filters']));if(_0x3f4db6[_0xffc3('0x2c')][_0xffc3('0x38')]){_0x1d50a9[_0xffc3('0x36')]=_[_0xffc3('0x3c')](_0x1d50a9[_0xffc3('0x36')],{'$or':_[_0xffc3('0x2b')](_0x1d50a9[_0xffc3('0x2f')],function(_0x1054c0){var _0x336030={};_0x336030[_0x1054c0]={'$like':'%'+_0x3f4db6[_0xffc3('0x2c')][_0xffc3('0x38')]+'%'};return _0x336030;})});}_0x1d50a9=_[_0xffc3('0x3c')]({},_0x1d50a9,_0x3f4db6[_0xffc3('0x4c')]);return _0x41853d[_0xffc3('0x4e')](_0x1d50a9);}})[_0xffc3('0x22')](function(_0x203031){if(_0x203031){_0x1bd2b9=_0x203031[_0xffc3('0x31')];if(!_0x3f4db6['query'][_0xffc3('0x32')](_0xffc3('0x33'))){_0x1d50a9[_0xffc3('0x19')]=qs[_0xffc3('0x19')](_0x3f4db6[_0xffc3('0x2c')]['limit']);_0x1d50a9[_0xffc3('0x18')]=qs[_0xffc3('0x18')](_0x3f4db6['query'][_0xffc3('0x18')]);}return _0x41853d['getTags'](_0x1d50a9);}})['then'](function(_0x43bf6f){if(_0x43bf6f){return _0x43bf6f?{'count':_0x1bd2b9,'rows':_0x43bf6f}:null;}})[_0xffc3('0x22')](respondWithResult(_0x40e542,null))[_0xffc3('0x42')](handleError(_0x40e542,null));};exports[_0xffc3('0x50')]=function(_0x44ecf9,_0x313310,_0x455cf4){if(_0x44ecf9[_0xffc3('0x44')]['id']){delete _0x44ecf9[_0xffc3('0x44')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x44ecf9[_0xffc3('0x45')]['id']}})[_0xffc3('0x22')](handleEntityNotFound(_0x313310,null))[_0xffc3('0x22')](function(_0x4591f1){if(_0x4591f1){return _0x4591f1[_0xffc3('0x50')](_0x44ecf9[_0xffc3('0x44')][_0xffc3('0x51')]||[]);}return null;})['then'](respondWithResult(_0x313310,null))[_0xffc3('0x42')](handleError(_0x313310,null));};
\ No newline at end of file
+var _0xa531=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','update','body','find','filter','getFields','ZendeskField','getSubjects','getDescriptions','getTags','findOne','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','error','stack','name','send','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters'];(function(_0x47d42a,_0x582563){var _0x39eaac=function(_0x563dff){while(--_0x563dff){_0x47d42a['push'](_0x47d42a['shift']());}};_0x39eaac(++_0x582563);}(_0xa531,0x74));var _0x1a53=function(_0x1bb822,_0x541a92){_0x1bb822=_0x1bb822-0x0;var _0x465272=_0xa531[_0x1bb822];return _0x465272;};'use strict';var emlformat=require(_0x1a53('0x0'));var rimraf=require(_0x1a53('0x1'));var zipdir=require(_0x1a53('0x2'));var jsonpatch=require(_0x1a53('0x3'));var rp=require(_0x1a53('0x4'));var moment=require(_0x1a53('0x5'));var BPromise=require(_0x1a53('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1a53('0x7'));var sox=require(_0x1a53('0x8'));var csv=require(_0x1a53('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a53('0xa'));var _=require('lodash');var squel=require(_0x1a53('0xb'));var crypto=require(_0x1a53('0xc'));var jsforce=require(_0x1a53('0xd'));var deskjs=require(_0x1a53('0xe'));var toCsv=require(_0x1a53('0x9'));var querystring=require(_0x1a53('0xf'));var Papa=require(_0x1a53('0x10'));var Redis=require('ioredis');var authService=require(_0x1a53('0x11'));var qs=require(_0x1a53('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1a53('0x13'));var logger=require('../../config/logger')(_0x1a53('0x14'));var utils=require(_0x1a53('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1a53('0x16'));var db=require(_0x1a53('0x17'))['db'];function respondWithStatusCode(_0x1bbbb9,_0x3b461a){_0x3b461a=_0x3b461a||0xcc;return function(_0x16554c){if(_0x16554c){return _0x1bbbb9['sendStatus'](_0x3b461a);}return _0x1bbbb9[_0x1a53('0x18')](_0x3b461a)[_0x1a53('0x19')]();};}function respondWithResult(_0x572780,_0x174b5f){_0x174b5f=_0x174b5f||0xc8;return function(_0x52ae1a){if(_0x52ae1a){return _0x572780[_0x1a53('0x18')](_0x174b5f)[_0x1a53('0x1a')](_0x52ae1a);}};}function respondWithFilteredResult(_0x2422d9,_0x399c59){return function(_0x481b08){if(_0x481b08){var _0x50288d=typeof _0x399c59[_0x1a53('0x1b')]===_0x1a53('0x1c')&&typeof _0x399c59['limit']==='undefined';var _0x117982=_0x481b08[_0x1a53('0x1d')];var _0x3c119d=_0x50288d?0x0:_0x399c59['offset'];var _0x2432e5=_0x50288d?_0x481b08[_0x1a53('0x1d')]:_0x399c59[_0x1a53('0x1b')]+_0x399c59[_0x1a53('0x1e')];var _0x10cee6;if(_0x2432e5>=_0x117982){_0x2432e5=_0x117982;_0x10cee6=0xc8;}else{_0x10cee6=0xce;}_0x2422d9[_0x1a53('0x18')](_0x10cee6);return _0x2422d9['set'](_0x1a53('0x1f'),_0x3c119d+'-'+_0x2432e5+'/'+_0x117982)[_0x1a53('0x1a')](_0x481b08);}return null;};}function patchUpdates(_0xe5271b){return function(_0x3c8893){try{jsonpatch[_0x1a53('0x20')](_0x3c8893,_0xe5271b,!![]);}catch(_0xc1d5ef){return BPromise[_0x1a53('0x21')](_0xc1d5ef);}return _0x3c8893[_0x1a53('0x22')]();};}function saveUpdates(_0x3a20de,_0xf41110){return function(_0x2d5ca9){if(_0x2d5ca9){return _0x2d5ca9['update'](_0x3a20de)['then'](function(_0x3fb223){return _0x3fb223;});}return null;};}function removeEntity(_0x4a7fc,_0x1ff8e9){return function(_0x3f5089){if(_0x3f5089){return _0x3f5089['destroy']()[_0x1a53('0x23')](function(){_0x4a7fc[_0x1a53('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10c260,_0x58ca8c){return function(_0x271dc2){if(!_0x271dc2){_0x10c260['sendStatus'](0x194);}return _0x271dc2;};}function handleError(_0x324ee0,_0x90f8fa){_0x90f8fa=_0x90f8fa||0x1f4;return function(_0x1449dd){logger[_0x1a53('0x24')](_0x1449dd[_0x1a53('0x25')]);if(_0x1449dd['name']){delete _0x1449dd[_0x1a53('0x26')];}_0x324ee0[_0x1a53('0x18')](_0x90f8fa)[_0x1a53('0x27')](_0x1449dd);};}exports['index']=function(_0x4be324,_0x324c04){var _0x4c1184={},_0x4510d3={},_0x2943a4={'count':0x0,'rows':[]};var _0xef5746=_['map'](db[_0x1a53('0x28')][_0x1a53('0x29')],function(_0x2e0153){return{'name':_0x2e0153[_0x1a53('0x2a')],'type':_0x2e0153[_0x1a53('0x2b')]['key']};});_0x4510d3[_0x1a53('0x2c')]=_['map'](_0xef5746,_0x1a53('0x26'));_0x4510d3[_0x1a53('0x2d')]=_[_0x1a53('0x2e')](_0x4be324[_0x1a53('0x2d')]);_0x4510d3[_0x1a53('0x2f')]=_[_0x1a53('0x30')](_0x4510d3[_0x1a53('0x2c')],_0x4510d3[_0x1a53('0x2d')]);_0x4c1184[_0x1a53('0x31')]=_[_0x1a53('0x30')](_0x4510d3[_0x1a53('0x2c')],qs[_0x1a53('0x32')](_0x4be324[_0x1a53('0x2d')][_0x1a53('0x32')]));_0x4c1184[_0x1a53('0x31')]=_0x4c1184[_0x1a53('0x31')][_0x1a53('0x33')]?_0x4c1184[_0x1a53('0x31')]:_0x4510d3[_0x1a53('0x2c')];if(!_0x4be324['query'][_0x1a53('0x34')](_0x1a53('0x35'))){_0x4c1184[_0x1a53('0x1e')]=qs[_0x1a53('0x1e')](_0x4be324[_0x1a53('0x2d')][_0x1a53('0x1e')]);_0x4c1184['offset']=qs[_0x1a53('0x1b')](_0x4be324[_0x1a53('0x2d')]['offset']);}_0x4c1184[_0x1a53('0x36')]=qs[_0x1a53('0x37')](_0x4be324[_0x1a53('0x2d')][_0x1a53('0x37')]);_0x4c1184['where']=qs[_0x1a53('0x2f')](_[_0x1a53('0x38')](_0x4be324[_0x1a53('0x2d')],_0x4510d3[_0x1a53('0x2f')]),_0xef5746);if(_0x4be324[_0x1a53('0x2d')]['filter']){_0x4c1184['where']=_[_0x1a53('0x39')](_0x4c1184[_0x1a53('0x3a')],{'$or':_[_0x1a53('0x3b')](_0xef5746,function(_0x3f110e){if(_0x3f110e['type']!==_0x1a53('0x3c')){var _0x3e5931={};_0x3e5931[_0x3f110e[_0x1a53('0x26')]]={'$like':'%'+_0x4be324[_0x1a53('0x2d')]['filter']+'%'};return _0x3e5931;}})});}_0x4c1184=_[_0x1a53('0x39')]({},_0x4c1184,_0x4be324[_0x1a53('0x3d')]);var _0x4e00ca={'where':_0x4c1184[_0x1a53('0x3a')]};return db[_0x1a53('0x28')][_0x1a53('0x1d')](_0x4e00ca)[_0x1a53('0x23')](function(_0x39feb3){_0x2943a4[_0x1a53('0x1d')]=_0x39feb3;if(_0x4be324[_0x1a53('0x2d')][_0x1a53('0x3e')]){_0x4c1184[_0x1a53('0x3f')]=[{'all':!![]}];}return db[_0x1a53('0x28')][_0x1a53('0x40')](_0x4c1184);})[_0x1a53('0x23')](function(_0x1b742c){_0x2943a4['rows']=_0x1b742c;return _0x2943a4;})[_0x1a53('0x23')](respondWithFilteredResult(_0x324c04,_0x4c1184))[_0x1a53('0x41')](handleError(_0x324c04,null));};exports[_0x1a53('0x42')]=function(_0x5dabc3,_0x475617){var _0x2b63a9={'raw':![],'where':{'id':_0x5dabc3[_0x1a53('0x43')]['id']}},_0x4b6fbc={};_0x4b6fbc[_0x1a53('0x2c')]=_[_0x1a53('0x2e')](db['ZendeskConfiguration'][_0x1a53('0x29')]);_0x4b6fbc[_0x1a53('0x2d')]=_[_0x1a53('0x2e')](_0x5dabc3[_0x1a53('0x2d')]);_0x4b6fbc[_0x1a53('0x2f')]=_[_0x1a53('0x30')](_0x4b6fbc[_0x1a53('0x2c')],_0x4b6fbc[_0x1a53('0x2d')]);_0x2b63a9['attributes']=_[_0x1a53('0x30')](_0x4b6fbc['model'],qs[_0x1a53('0x32')](_0x5dabc3[_0x1a53('0x2d')][_0x1a53('0x32')]));_0x2b63a9[_0x1a53('0x31')]=_0x2b63a9[_0x1a53('0x31')][_0x1a53('0x33')]?_0x2b63a9['attributes']:_0x4b6fbc[_0x1a53('0x2c')];if(_0x5dabc3[_0x1a53('0x2d')][_0x1a53('0x3e')]){_0x2b63a9[_0x1a53('0x3f')]=[{'all':!![]}];}_0x2b63a9=_[_0x1a53('0x39')]({},_0x2b63a9,_0x5dabc3[_0x1a53('0x3d')]);return db[_0x1a53('0x28')]['find'](_0x2b63a9)[_0x1a53('0x23')](handleEntityNotFound(_0x475617,null))[_0x1a53('0x23')](respondWithResult(_0x475617,null))[_0x1a53('0x41')](handleError(_0x475617,null));};exports[_0x1a53('0x44')]=function(_0xdff04e,_0x5095d2){return db[_0x1a53('0x28')][_0x1a53('0x44')](_0xdff04e['body'],{})[_0x1a53('0x23')](respondWithResult(_0x5095d2,0xc9))[_0x1a53('0x41')](handleError(_0x5095d2,null));};exports[_0x1a53('0x45')]=function(_0x35fb41,_0x5efec5){if(_0x35fb41['body']['id']){delete _0x35fb41[_0x1a53('0x46')]['id'];}return db[_0x1a53('0x28')][_0x1a53('0x47')]({'where':{'id':_0x35fb41[_0x1a53('0x43')]['id']}})[_0x1a53('0x23')](handleEntityNotFound(_0x5efec5,null))['then'](saveUpdates(_0x35fb41[_0x1a53('0x46')],null))[_0x1a53('0x23')](respondWithResult(_0x5efec5,null))[_0x1a53('0x41')](handleError(_0x5efec5,null));};exports['destroy']=function(_0x550a36,_0x3c12d2){return db[_0x1a53('0x28')]['find']({'where':{'id':_0x550a36[_0x1a53('0x43')]['id']}})[_0x1a53('0x23')](handleEntityNotFound(_0x3c12d2,null))[_0x1a53('0x23')](removeEntity(_0x3c12d2,null))[_0x1a53('0x41')](handleError(_0x3c12d2,null));};exports['getFields']=function(_0x52f1a8,_0x185245,_0x3d581e){var _0x309e66={};var _0xf764ce={};var _0x210cb6;var _0x52699e;return db[_0x1a53('0x28')]['findOne']({'where':{'id':_0x52f1a8['params']['id']}})[_0x1a53('0x23')](handleEntityNotFound(_0x185245,null))[_0x1a53('0x23')](function(_0x2353bf){if(_0x2353bf){_0x210cb6=_0x2353bf;_0xf764ce[_0x1a53('0x2c')]=_[_0x1a53('0x2e')](db['ZendeskField'][_0x1a53('0x29')]);_0xf764ce[_0x1a53('0x2d')]=_[_0x1a53('0x2e')](_0x52f1a8[_0x1a53('0x2d')]);_0xf764ce[_0x1a53('0x2f')]=_[_0x1a53('0x30')](_0xf764ce[_0x1a53('0x2c')],_0xf764ce[_0x1a53('0x2d')]);_0x309e66['attributes']=_[_0x1a53('0x30')](_0xf764ce[_0x1a53('0x2c')],qs[_0x1a53('0x32')](_0x52f1a8[_0x1a53('0x2d')]['fields']));_0x309e66['attributes']=_0x309e66[_0x1a53('0x31')][_0x1a53('0x33')]?_0x309e66['attributes']:_0xf764ce[_0x1a53('0x2c')];_0x309e66['order']=qs[_0x1a53('0x37')](_0x52f1a8['query'][_0x1a53('0x37')]);_0x309e66['where']=qs[_0x1a53('0x2f')](_[_0x1a53('0x38')](_0x52f1a8[_0x1a53('0x2d')],_0xf764ce[_0x1a53('0x2f')]));if(_0x52f1a8['query'][_0x1a53('0x48')]){_0x309e66['where']=_['merge'](_0x309e66[_0x1a53('0x3a')],{'$or':_['map'](_0x309e66[_0x1a53('0x31')],function(_0x4056b5){var _0x4de3b3={};_0x4de3b3[_0x4056b5]={'$like':'%'+_0x52f1a8[_0x1a53('0x2d')][_0x1a53('0x48')]+'%'};return _0x4de3b3;})});}_0x309e66=_[_0x1a53('0x39')]({},_0x309e66,_0x52f1a8[_0x1a53('0x3d')]);return _0x210cb6[_0x1a53('0x49')](_0x309e66);}})[_0x1a53('0x23')](function(_0x44e675){if(_0x44e675){_0x52699e=_0x44e675[_0x1a53('0x33')];if(!_0x52f1a8[_0x1a53('0x2d')]['hasOwnProperty'](_0x1a53('0x35'))){_0x309e66[_0x1a53('0x1e')]=qs[_0x1a53('0x1e')](_0x52f1a8[_0x1a53('0x2d')]['limit']);_0x309e66['offset']=qs[_0x1a53('0x1b')](_0x52f1a8[_0x1a53('0x2d')][_0x1a53('0x1b')]);}return _0x210cb6['getFields'](_0x309e66);}})[_0x1a53('0x23')](function(_0x98d007){if(_0x98d007){return _0x98d007?{'count':_0x52699e,'rows':_0x98d007}:null;}})['then'](respondWithResult(_0x185245,null))[_0x1a53('0x41')](handleError(_0x185245,null));};exports['getSubjects']=function(_0x5eeb0f,_0x1acca7,_0xcfc4fa){var _0x914277={};var _0x1014a5={};var _0x5193d2;var _0x20bb4d;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x5eeb0f['params']['id']}})[_0x1a53('0x23')](handleEntityNotFound(_0x1acca7,null))[_0x1a53('0x23')](function(_0x33b3fc){if(_0x33b3fc){_0x5193d2=_0x33b3fc;_0x1014a5[_0x1a53('0x2c')]=_[_0x1a53('0x2e')](db[_0x1a53('0x4a')][_0x1a53('0x29')]);_0x1014a5[_0x1a53('0x2d')]=_[_0x1a53('0x2e')](_0x5eeb0f[_0x1a53('0x2d')]);_0x1014a5[_0x1a53('0x2f')]=_[_0x1a53('0x30')](_0x1014a5[_0x1a53('0x2c')],_0x1014a5[_0x1a53('0x2d')]);_0x914277['attributes']=_[_0x1a53('0x30')](_0x1014a5['model'],qs['fields'](_0x5eeb0f[_0x1a53('0x2d')][_0x1a53('0x32')]));_0x914277[_0x1a53('0x31')]=_0x914277[_0x1a53('0x31')][_0x1a53('0x33')]?_0x914277[_0x1a53('0x31')]:_0x1014a5[_0x1a53('0x2c')];_0x914277['order']=qs['sort'](_0x5eeb0f['query'][_0x1a53('0x37')]);_0x914277[_0x1a53('0x3a')]=qs[_0x1a53('0x2f')](_[_0x1a53('0x38')](_0x5eeb0f[_0x1a53('0x2d')],_0x1014a5[_0x1a53('0x2f')]));if(_0x5eeb0f['query']['filter']){_0x914277[_0x1a53('0x3a')]=_[_0x1a53('0x39')](_0x914277[_0x1a53('0x3a')],{'$or':_['map'](_0x914277[_0x1a53('0x31')],function(_0x48de40){var _0x4378ed={};_0x4378ed[_0x48de40]={'$like':'%'+_0x5eeb0f[_0x1a53('0x2d')][_0x1a53('0x48')]+'%'};return _0x4378ed;})});}_0x914277=_['merge']({},_0x914277,_0x5eeb0f[_0x1a53('0x3d')]);return _0x5193d2[_0x1a53('0x4b')](_0x914277);}})[_0x1a53('0x23')](function(_0x2e1e28){if(_0x2e1e28){_0x20bb4d=_0x2e1e28[_0x1a53('0x33')];if(!_0x5eeb0f[_0x1a53('0x2d')][_0x1a53('0x34')](_0x1a53('0x35'))){_0x914277[_0x1a53('0x1e')]=qs[_0x1a53('0x1e')](_0x5eeb0f[_0x1a53('0x2d')]['limit']);_0x914277[_0x1a53('0x1b')]=qs['offset'](_0x5eeb0f[_0x1a53('0x2d')][_0x1a53('0x1b')]);}return _0x5193d2[_0x1a53('0x4b')](_0x914277);}})['then'](function(_0x36c65a){if(_0x36c65a){return _0x36c65a?{'count':_0x20bb4d,'rows':_0x36c65a}:null;}})[_0x1a53('0x23')](respondWithResult(_0x1acca7,null))[_0x1a53('0x41')](handleError(_0x1acca7,null));};exports['getDescriptions']=function(_0x6d8f01,_0x1a140d,_0x3cdc5f){var _0x1a1013={};var _0xab3fe={};var _0xecab5c;var _0x25b708;return db[_0x1a53('0x28')]['findOne']({'where':{'id':_0x6d8f01['params']['id']}})[_0x1a53('0x23')](handleEntityNotFound(_0x1a140d,null))['then'](function(_0x2f7706){if(_0x2f7706){_0xecab5c=_0x2f7706;_0xab3fe[_0x1a53('0x2c')]=_[_0x1a53('0x2e')](db[_0x1a53('0x4a')][_0x1a53('0x29')]);_0xab3fe['query']=_[_0x1a53('0x2e')](_0x6d8f01['query']);_0xab3fe[_0x1a53('0x2f')]=_[_0x1a53('0x30')](_0xab3fe[_0x1a53('0x2c')],_0xab3fe[_0x1a53('0x2d')]);_0x1a1013[_0x1a53('0x31')]=_[_0x1a53('0x30')](_0xab3fe[_0x1a53('0x2c')],qs[_0x1a53('0x32')](_0x6d8f01[_0x1a53('0x2d')][_0x1a53('0x32')]));_0x1a1013[_0x1a53('0x31')]=_0x1a1013['attributes'][_0x1a53('0x33')]?_0x1a1013[_0x1a53('0x31')]:_0xab3fe[_0x1a53('0x2c')];_0x1a1013[_0x1a53('0x36')]=qs[_0x1a53('0x37')](_0x6d8f01[_0x1a53('0x2d')][_0x1a53('0x37')]);_0x1a1013['where']=qs['filters'](_[_0x1a53('0x38')](_0x6d8f01[_0x1a53('0x2d')],_0xab3fe[_0x1a53('0x2f')]));if(_0x6d8f01[_0x1a53('0x2d')]['filter']){_0x1a1013['where']=_['merge'](_0x1a1013['where'],{'$or':_[_0x1a53('0x3b')](_0x1a1013[_0x1a53('0x31')],function(_0x43fbf2){var _0x2e19b1={};_0x2e19b1[_0x43fbf2]={'$like':'%'+_0x6d8f01[_0x1a53('0x2d')][_0x1a53('0x48')]+'%'};return _0x2e19b1;})});}_0x1a1013=_[_0x1a53('0x39')]({},_0x1a1013,_0x6d8f01[_0x1a53('0x3d')]);return _0xecab5c['getDescriptions'](_0x1a1013);}})[_0x1a53('0x23')](function(_0x410ed2){if(_0x410ed2){_0x25b708=_0x410ed2['length'];if(!_0x6d8f01[_0x1a53('0x2d')][_0x1a53('0x34')](_0x1a53('0x35'))){_0x1a1013[_0x1a53('0x1e')]=qs['limit'](_0x6d8f01[_0x1a53('0x2d')][_0x1a53('0x1e')]);_0x1a1013[_0x1a53('0x1b')]=qs[_0x1a53('0x1b')](_0x6d8f01[_0x1a53('0x2d')][_0x1a53('0x1b')]);}return _0xecab5c[_0x1a53('0x4c')](_0x1a1013);}})['then'](function(_0x5d1a40){if(_0x5d1a40){return _0x5d1a40?{'count':_0x25b708,'rows':_0x5d1a40}:null;}})[_0x1a53('0x23')](respondWithResult(_0x1a140d,null))[_0x1a53('0x41')](handleError(_0x1a140d,null));};exports[_0x1a53('0x4d')]=function(_0x4bea1a,_0x363c4c,_0x47244c){var _0x14b871={};var _0x381543={};var _0x26e4b8;var _0x4c9707;return db[_0x1a53('0x28')][_0x1a53('0x4e')]({'where':{'id':_0x4bea1a['params']['id']}})[_0x1a53('0x23')](handleEntityNotFound(_0x363c4c,null))[_0x1a53('0x23')](function(_0xb1e99c){if(_0xb1e99c){_0x26e4b8=_0xb1e99c;_0x381543[_0x1a53('0x2c')]=_[_0x1a53('0x2e')](db[_0x1a53('0x4f')]['rawAttributes']);_0x381543[_0x1a53('0x2d')]=_[_0x1a53('0x2e')](_0x4bea1a[_0x1a53('0x2d')]);_0x381543[_0x1a53('0x2f')]=_[_0x1a53('0x30')](_0x381543[_0x1a53('0x2c')],_0x381543['query']);_0x14b871[_0x1a53('0x31')]=_[_0x1a53('0x30')](_0x381543[_0x1a53('0x2c')],qs['fields'](_0x4bea1a[_0x1a53('0x2d')][_0x1a53('0x32')]));_0x14b871[_0x1a53('0x31')]=_0x14b871[_0x1a53('0x31')]['length']?_0x14b871['attributes']:_0x381543['model'];_0x14b871[_0x1a53('0x36')]=qs['sort'](_0x4bea1a['query'][_0x1a53('0x37')]);_0x14b871[_0x1a53('0x3a')]=qs[_0x1a53('0x2f')](_[_0x1a53('0x38')](_0x4bea1a[_0x1a53('0x2d')],_0x381543['filters']));if(_0x4bea1a[_0x1a53('0x2d')][_0x1a53('0x48')]){_0x14b871[_0x1a53('0x3a')]=_[_0x1a53('0x39')](_0x14b871[_0x1a53('0x3a')],{'$or':_[_0x1a53('0x3b')](_0x14b871[_0x1a53('0x31')],function(_0x525553){var _0x3df169={};_0x3df169[_0x525553]={'$like':'%'+_0x4bea1a[_0x1a53('0x2d')][_0x1a53('0x48')]+'%'};return _0x3df169;})});}_0x14b871=_[_0x1a53('0x39')]({},_0x14b871,_0x4bea1a[_0x1a53('0x3d')]);return _0x26e4b8[_0x1a53('0x4d')](_0x14b871);}})['then'](function(_0x7ddce1){if(_0x7ddce1){_0x4c9707=_0x7ddce1['length'];if(!_0x4bea1a['query'][_0x1a53('0x34')]('nolimit')){_0x14b871['limit']=qs[_0x1a53('0x1e')](_0x4bea1a[_0x1a53('0x2d')][_0x1a53('0x1e')]);_0x14b871['offset']=qs[_0x1a53('0x1b')](_0x4bea1a[_0x1a53('0x2d')]['offset']);}return _0x26e4b8['getTags'](_0x14b871);}})[_0x1a53('0x23')](function(_0x23e550){if(_0x23e550){return _0x23e550?{'count':_0x4c9707,'rows':_0x23e550}:null;}})[_0x1a53('0x23')](respondWithResult(_0x363c4c,null))['catch'](handleError(_0x363c4c,null));};exports[_0x1a53('0x50')]=function(_0x429a7a,_0x4cf957,_0x44dfbe){if(_0x429a7a[_0x1a53('0x46')]['id']){delete _0x429a7a[_0x1a53('0x46')]['id'];}return db[_0x1a53('0x28')][_0x1a53('0x4e')]({'where':{'id':_0x429a7a[_0x1a53('0x43')]['id']}})[_0x1a53('0x23')](handleEntityNotFound(_0x4cf957,null))['then'](function(_0x41f830){if(_0x41f830){return _0x41f830[_0x1a53('0x50')](_0x429a7a[_0x1a53('0x46')][_0x1a53('0x51')]||[]);}return null;})[_0x1a53('0x23')](respondWithResult(_0x4cf957,null))[_0x1a53('0x41')](handleError(_0x4cf957,null));};
\ No newline at end of file