Built motion from commit (unavailable).|2.5.8
[motion2.git] / server / api / intZendeskConfiguration / intZendeskConfiguration.controller.js
index d2f3cd4..d4b2e29 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x326f=['VIRTUAL','filter','ZendeskConfiguration','count','includeAll','include','findAll','rows','show','params','options','find','create','body','destroy','getFields','findOne','hasOwnProperty','getSubjects','ZendeskField','getDescriptions','Tag','getTags','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','client','http','test','ValidationError','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','name','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge'];(function(_0x537f7f,_0x26e3e5){var _0x26c36f=function(_0x5b3f3f){while(--_0x5b3f3f){_0x537f7f['push'](_0x537f7f['shift']());}};_0x26c36f(++_0x26e3e5);}(_0x326f,0xd1));var _0xf326=function(_0x230042,_0x2a01dd){_0x230042=_0x230042-0x0;var _0x1844af=_0x326f[_0x230042];return _0x1844af;};'use strict';var pdf=require(_0xf326('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf326('0x1'));var jsonpatch=require(_0xf326('0x2'));var rp=require(_0xf326('0x3'));var moment=require(_0xf326('0x4'));var BPromise=require(_0xf326('0x5'));var Mustache=require(_0xf326('0x6'));var util=require(_0xf326('0x7'));var path=require(_0xf326('0x8'));var sox=require(_0xf326('0x9'));var csv=require(_0xf326('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var db=require(_0xf326('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xf326('0x17')][_0xf326('0x18')]({'port':0x232a});function checkPasswordPattern(_0x4b3966,_0x342fe5,_0x472632){if(_0x472632){var _0x3504eb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3504eb[_0xf326('0x19')](_0x342fe5)){return _0x4b3966;}else{throw new db['Sequelize'][(_0xf326('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 _0x4b3966;}}function respondWithRpcPromise(_0x54bd1a,_0xdf21d9,_0x11f6d2,_0x1f2e5a){return new BPromise(function(_0xa63d1a,_0x292f4b){var _0x287a2a=_0x1f2e5a||client;return _0x287a2a[_0xf326('0x1b')](_0x54bd1a,_0x11f6d2)[_0xf326('0x1c')](function(_0x5a682a){logger[_0xf326('0x1d')](_0xf326('0x1e'),_0xdf21d9,_0xf326('0x1f'));logger[_0xf326('0x20')](_0xf326('0x21'),_0xdf21d9,_0xf326('0x1f'),JSON['stringify'](_0x5a682a));if(_0x5a682a['error']){if(_0x5a682a['error'][_0xf326('0x22')]===0x1f4){logger[_0xf326('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0xdf21d9,_0x5a682a['error'][_0xf326('0x24')]);return _0x292f4b(_0x5a682a['error']['message']);}logger[_0xf326('0x23')](_0xf326('0x1e'),_0xdf21d9,_0x5a682a['error']['message']);return _0xa63d1a(_0x5a682a[_0xf326('0x23')][_0xf326('0x24')]);}else{logger['info'](_0xf326('0x1e'),_0xdf21d9,_0xf326('0x1f'));_0xa63d1a(_0x5a682a[_0xf326('0x25')][_0xf326('0x24')]);}})[_0xf326('0x26')](function(_0x2049ec){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0xdf21d9,_0x2049ec);_0x292f4b(_0x2049ec);});});}function respondWithStatusCode(_0x4f31f6,_0x520d85){_0x520d85=_0x520d85||0xcc;return function(_0x1a2c4e){if(_0x1a2c4e){return _0x4f31f6[_0xf326('0x27')](_0x520d85);}return _0x4f31f6[_0xf326('0x28')](_0x520d85)[_0xf326('0x29')]();};}function respondWithResult(_0x410237,_0x5217d4){_0x5217d4=_0x5217d4||0xc8;return function(_0x201d28){if(_0x201d28){return _0x410237[_0xf326('0x28')](_0x5217d4)[_0xf326('0x2a')](_0x201d28);}};}function respondWithFilteredResult(_0x581531,_0x1617d2){return function(_0x55ad0f){if(_0x55ad0f){var _0x4a9abf=_0x55ad0f['count'],_0x6a8e89=_0x1617d2[_0xf326('0x2b')],_0x1ae23a=_0x1617d2[_0xf326('0x2b')]+_0x1617d2['limit'],_0x2fa28e;if(_0x1ae23a>=_0x4a9abf){_0x1ae23a=_0x4a9abf;_0x2fa28e=0xc8;}else{_0x2fa28e=0xce;}_0x581531[_0xf326('0x28')](_0x2fa28e);return _0x581531[_0xf326('0x2c')](_0xf326('0x2d'),_0x6a8e89+'-'+_0x1ae23a+'/'+_0x4a9abf)[_0xf326('0x2a')](_0x55ad0f);}return null;};}function patchUpdates(_0xa80156){return function(_0x269be9){try{jsonpatch[_0xf326('0x2e')](_0x269be9,_0xa80156,!![]);}catch(_0x39a1e2){return BPromise[_0xf326('0x2f')](_0x39a1e2);}return _0x269be9[_0xf326('0x30')]();};}function saveUpdates(_0x4b52f2,_0x1035ed){return function(_0x424104){if(_0x424104){return _0x424104[_0xf326('0x31')](_0x4b52f2)['then'](function(_0x2c0cac){return _0x2c0cac;});}return null;};}function removeEntity(_0x1721fd,_0x303dc6){return function(_0x4df451){if(_0x4df451){return _0x4df451['destroy']()[_0xf326('0x1c')](function(){_0x1721fd[_0xf326('0x28')](0xcc)[_0xf326('0x29')]();});}};}function handleEntityNotFound(_0xf53cf3,_0x30694f){return function(_0x2e8a64){if(!_0x2e8a64){_0xf53cf3[_0xf326('0x27')](0x194);}return _0x2e8a64;};}function handleError(_0x2d5f20,_0x580374){_0x580374=_0x580374||0x1f4;return function(_0x461e93){logger[_0xf326('0x23')](_0x461e93['stack']);if(_0x461e93[_0xf326('0x32')]){delete _0x461e93['name'];}_0x2d5f20[_0xf326('0x28')](_0x580374)['send'](_0x461e93);};}exports['index']=function(_0xadb020,_0x4d8eac){var _0x40dcb4={},_0x57aa27={},_0x310dbb={'count':0x0,'rows':[]};var _0x409260=_[_0xf326('0x33')](db['ZendeskConfiguration'][_0xf326('0x34')],function(_0x4095e6){return{'name':_0x4095e6['fieldName'],'type':_0x4095e6[_0xf326('0x35')][_0xf326('0x36')]};});_0x57aa27[_0xf326('0x37')]=_[_0xf326('0x33')](_0x409260,'name');_0x57aa27[_0xf326('0x38')]=_[_0xf326('0x39')](_0xadb020[_0xf326('0x38')]);_0x57aa27[_0xf326('0x3a')]=_[_0xf326('0x3b')](_0x57aa27['model'],_0x57aa27[_0xf326('0x38')]);_0x40dcb4[_0xf326('0x3c')]=_['intersection'](_0x57aa27['model'],qs[_0xf326('0x3d')](_0xadb020['query']['fields']));_0x40dcb4[_0xf326('0x3c')]=_0x40dcb4['attributes'][_0xf326('0x3e')]?_0x40dcb4[_0xf326('0x3c')]:_0x57aa27[_0xf326('0x37')];if(!_0xadb020[_0xf326('0x38')]['hasOwnProperty'](_0xf326('0x3f'))){_0x40dcb4[_0xf326('0x40')]=qs[_0xf326('0x40')](_0xadb020[_0xf326('0x38')][_0xf326('0x40')]);_0x40dcb4[_0xf326('0x2b')]=qs[_0xf326('0x2b')](_0xadb020[_0xf326('0x38')][_0xf326('0x2b')]);}_0x40dcb4[_0xf326('0x41')]=qs[_0xf326('0x42')](_0xadb020[_0xf326('0x38')]['sort']);_0x40dcb4[_0xf326('0x43')]=qs[_0xf326('0x3a')](_[_0xf326('0x44')](_0xadb020[_0xf326('0x38')],_0x57aa27[_0xf326('0x3a')]));if(_0xadb020[_0xf326('0x38')]['filter']){_0x40dcb4[_0xf326('0x43')]=_[_0xf326('0x45')](_0x40dcb4['where'],{'$or':_[_0xf326('0x33')](_0x409260,function(_0x819bf6){if(_0x819bf6[_0xf326('0x35')]!==_0xf326('0x46')){var _0x427c34={};_0x427c34[_0x819bf6['name']]={'$like':'%'+_0xadb020['query'][_0xf326('0x47')]+'%'};return _0x427c34;}})});}_0x40dcb4=_[_0xf326('0x45')]({},_0x40dcb4,_0xadb020['options']);var _0x4bd865={'where':_0x40dcb4[_0xf326('0x43')]};return db[_0xf326('0x48')][_0xf326('0x49')](_0x4bd865)['then'](function(_0x301e65){_0x310dbb[_0xf326('0x49')]=_0x301e65;if(_0xadb020[_0xf326('0x38')][_0xf326('0x4a')]){_0x40dcb4[_0xf326('0x4b')]=[{'all':!![]}];}return db[_0xf326('0x48')][_0xf326('0x4c')](_0x40dcb4);})[_0xf326('0x1c')](function(_0x3df9a8){_0x310dbb[_0xf326('0x4d')]=_0x3df9a8;return _0x310dbb;})[_0xf326('0x1c')](respondWithFilteredResult(_0x4d8eac,_0x40dcb4))[_0xf326('0x26')](handleError(_0x4d8eac,null));};exports[_0xf326('0x4e')]=function(_0x395b1e,_0xeac1a1){var _0x59f9a7={'raw':![],'where':{'id':_0x395b1e[_0xf326('0x4f')]['id']}},_0x199f8b={};_0x199f8b[_0xf326('0x37')]=_[_0xf326('0x39')](db['ZendeskConfiguration'][_0xf326('0x34')]);_0x199f8b[_0xf326('0x38')]=_[_0xf326('0x39')](_0x395b1e[_0xf326('0x38')]);_0x199f8b['filters']=_[_0xf326('0x3b')](_0x199f8b[_0xf326('0x37')],_0x199f8b[_0xf326('0x38')]);_0x59f9a7[_0xf326('0x3c')]=_[_0xf326('0x3b')](_0x199f8b['model'],qs['fields'](_0x395b1e[_0xf326('0x38')][_0xf326('0x3d')]));_0x59f9a7[_0xf326('0x3c')]=_0x59f9a7['attributes'][_0xf326('0x3e')]?_0x59f9a7[_0xf326('0x3c')]:_0x199f8b[_0xf326('0x37')];if(_0x395b1e['query']['includeAll']){_0x59f9a7[_0xf326('0x4b')]=[{'all':!![]}];}_0x59f9a7=_['merge']({},_0x59f9a7,_0x395b1e[_0xf326('0x50')]);return db['ZendeskConfiguration'][_0xf326('0x51')](_0x59f9a7)[_0xf326('0x1c')](handleEntityNotFound(_0xeac1a1,null))[_0xf326('0x1c')](respondWithResult(_0xeac1a1,null))[_0xf326('0x26')](handleError(_0xeac1a1,null));};exports[_0xf326('0x52')]=function(_0x35d3c8,_0x7f7ece){return db['ZendeskConfiguration'][_0xf326('0x52')](_0x35d3c8[_0xf326('0x53')],{})[_0xf326('0x1c')](respondWithResult(_0x7f7ece,0xc9))['catch'](handleError(_0x7f7ece,null));};exports[_0xf326('0x31')]=function(_0x3a832f,_0x3b8635){if(_0x3a832f[_0xf326('0x53')]['id']){delete _0x3a832f[_0xf326('0x53')]['id'];}return db['ZendeskConfiguration'][_0xf326('0x51')]({'where':{'id':_0x3a832f[_0xf326('0x4f')]['id']}})[_0xf326('0x1c')](handleEntityNotFound(_0x3b8635,null))[_0xf326('0x1c')](saveUpdates(_0x3a832f['body'],null))[_0xf326('0x1c')](respondWithResult(_0x3b8635,null))[_0xf326('0x26')](handleError(_0x3b8635,null));};exports[_0xf326('0x54')]=function(_0x29e52e,_0x4d3b9e){return db['ZendeskConfiguration'][_0xf326('0x51')]({'where':{'id':_0x29e52e[_0xf326('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4d3b9e,null))[_0xf326('0x1c')](removeEntity(_0x4d3b9e,null))[_0xf326('0x26')](handleError(_0x4d3b9e,null));};exports[_0xf326('0x55')]=function(_0x1258d1,_0x5765b0,_0xb1c18c){var _0x5657b7={};var _0x5dbeb9={};var _0x9d84c3;var _0x51d466;return db[_0xf326('0x48')][_0xf326('0x56')]({'where':{'id':_0x1258d1[_0xf326('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5765b0,null))['then'](function(_0x1fd9c9){if(_0x1fd9c9){_0x9d84c3=_0x1fd9c9;_0x5dbeb9[_0xf326('0x37')]=_[_0xf326('0x39')](db['ZendeskField'][_0xf326('0x34')]);_0x5dbeb9['query']=_[_0xf326('0x39')](_0x1258d1[_0xf326('0x38')]);_0x5dbeb9[_0xf326('0x3a')]=_[_0xf326('0x3b')](_0x5dbeb9[_0xf326('0x37')],_0x5dbeb9[_0xf326('0x38')]);_0x5657b7[_0xf326('0x3c')]=_[_0xf326('0x3b')](_0x5dbeb9[_0xf326('0x37')],qs[_0xf326('0x3d')](_0x1258d1[_0xf326('0x38')][_0xf326('0x3d')]));_0x5657b7[_0xf326('0x3c')]=_0x5657b7['attributes'][_0xf326('0x3e')]?_0x5657b7['attributes']:_0x5dbeb9[_0xf326('0x37')];_0x5657b7[_0xf326('0x41')]=qs['sort'](_0x1258d1[_0xf326('0x38')]['sort']);_0x5657b7[_0xf326('0x43')]=qs[_0xf326('0x3a')](_[_0xf326('0x44')](_0x1258d1[_0xf326('0x38')],_0x5dbeb9[_0xf326('0x3a')]));if(_0x1258d1['query']['filter']){_0x5657b7[_0xf326('0x43')]=_[_0xf326('0x45')](_0x5657b7[_0xf326('0x43')],{'$or':_[_0xf326('0x33')](_0x5657b7[_0xf326('0x3c')],function(_0x579d2c){var _0x28c4f2={};_0x28c4f2[_0x579d2c]={'$like':'%'+_0x1258d1[_0xf326('0x38')]['filter']+'%'};return _0x28c4f2;})});}_0x5657b7=_['merge']({},_0x5657b7,_0x1258d1['options']);return _0x9d84c3[_0xf326('0x55')](_0x5657b7);}})[_0xf326('0x1c')](function(_0x4150fa){if(_0x4150fa){_0x51d466=_0x4150fa[_0xf326('0x3e')];if(!_0x1258d1[_0xf326('0x38')][_0xf326('0x57')](_0xf326('0x3f'))){_0x5657b7['limit']=qs[_0xf326('0x40')](_0x1258d1[_0xf326('0x38')][_0xf326('0x40')]);_0x5657b7[_0xf326('0x2b')]=qs['offset'](_0x1258d1[_0xf326('0x38')]['offset']);}return _0x9d84c3['getFields'](_0x5657b7);}})[_0xf326('0x1c')](function(_0x540fa0){if(_0x540fa0){return _0x540fa0?{'count':_0x51d466,'rows':_0x540fa0}:null;}})[_0xf326('0x1c')](respondWithResult(_0x5765b0,null))[_0xf326('0x26')](handleError(_0x5765b0,null));};exports[_0xf326('0x58')]=function(_0x2ea5a2,_0x17cd36,_0x541491){var _0x4a053c={};var _0x48d84a={};var _0xeeea57;var _0x307441;return db[_0xf326('0x48')][_0xf326('0x56')]({'where':{'id':_0x2ea5a2[_0xf326('0x4f')]['id']}})['then'](handleEntityNotFound(_0x17cd36,null))[_0xf326('0x1c')](function(_0x372dc8){if(_0x372dc8){_0xeeea57=_0x372dc8;_0x48d84a[_0xf326('0x37')]=_['keys'](db['ZendeskField'][_0xf326('0x34')]);_0x48d84a[_0xf326('0x38')]=_['keys'](_0x2ea5a2['query']);_0x48d84a[_0xf326('0x3a')]=_['intersection'](_0x48d84a[_0xf326('0x37')],_0x48d84a['query']);_0x4a053c['attributes']=_['intersection'](_0x48d84a[_0xf326('0x37')],qs[_0xf326('0x3d')](_0x2ea5a2[_0xf326('0x38')]['fields']));_0x4a053c[_0xf326('0x3c')]=_0x4a053c[_0xf326('0x3c')][_0xf326('0x3e')]?_0x4a053c[_0xf326('0x3c')]:_0x48d84a[_0xf326('0x37')];_0x4a053c[_0xf326('0x41')]=qs[_0xf326('0x42')](_0x2ea5a2[_0xf326('0x38')][_0xf326('0x42')]);_0x4a053c['where']=qs[_0xf326('0x3a')](_['pick'](_0x2ea5a2[_0xf326('0x38')],_0x48d84a[_0xf326('0x3a')]));if(_0x2ea5a2[_0xf326('0x38')]['filter']){_0x4a053c[_0xf326('0x43')]=_[_0xf326('0x45')](_0x4a053c[_0xf326('0x43')],{'$or':_['map'](_0x4a053c[_0xf326('0x3c')],function(_0x4057e1){var _0x3bbe4c={};_0x3bbe4c[_0x4057e1]={'$like':'%'+_0x2ea5a2[_0xf326('0x38')]['filter']+'%'};return _0x3bbe4c;})});}_0x4a053c=_[_0xf326('0x45')]({},_0x4a053c,_0x2ea5a2['options']);return _0xeeea57['getSubjects'](_0x4a053c);}})[_0xf326('0x1c')](function(_0x2c36d3){if(_0x2c36d3){_0x307441=_0x2c36d3['length'];if(!_0x2ea5a2['query']['hasOwnProperty'](_0xf326('0x3f'))){_0x4a053c['limit']=qs[_0xf326('0x40')](_0x2ea5a2[_0xf326('0x38')][_0xf326('0x40')]);_0x4a053c[_0xf326('0x2b')]=qs[_0xf326('0x2b')](_0x2ea5a2[_0xf326('0x38')]['offset']);}return _0xeeea57[_0xf326('0x58')](_0x4a053c);}})[_0xf326('0x1c')](function(_0x5f1724){if(_0x5f1724){return _0x5f1724?{'count':_0x307441,'rows':_0x5f1724}:null;}})['then'](respondWithResult(_0x17cd36,null))[_0xf326('0x26')](handleError(_0x17cd36,null));};exports['getDescriptions']=function(_0x35a7c9,_0x147d51,_0x153027){var _0x363e64={};var _0x19d676={};var _0x6e662;var _0x293600;return db[_0xf326('0x48')][_0xf326('0x56')]({'where':{'id':_0x35a7c9['params']['id']}})[_0xf326('0x1c')](handleEntityNotFound(_0x147d51,null))[_0xf326('0x1c')](function(_0x4ac90e){if(_0x4ac90e){_0x6e662=_0x4ac90e;_0x19d676[_0xf326('0x37')]=_['keys'](db[_0xf326('0x59')][_0xf326('0x34')]);_0x19d676[_0xf326('0x38')]=_['keys'](_0x35a7c9[_0xf326('0x38')]);_0x19d676[_0xf326('0x3a')]=_[_0xf326('0x3b')](_0x19d676[_0xf326('0x37')],_0x19d676[_0xf326('0x38')]);_0x363e64[_0xf326('0x3c')]=_[_0xf326('0x3b')](_0x19d676[_0xf326('0x37')],qs[_0xf326('0x3d')](_0x35a7c9[_0xf326('0x38')][_0xf326('0x3d')]));_0x363e64[_0xf326('0x3c')]=_0x363e64[_0xf326('0x3c')][_0xf326('0x3e')]?_0x363e64[_0xf326('0x3c')]:_0x19d676['model'];_0x363e64[_0xf326('0x41')]=qs[_0xf326('0x42')](_0x35a7c9['query'][_0xf326('0x42')]);_0x363e64[_0xf326('0x43')]=qs['filters'](_[_0xf326('0x44')](_0x35a7c9[_0xf326('0x38')],_0x19d676[_0xf326('0x3a')]));if(_0x35a7c9[_0xf326('0x38')][_0xf326('0x47')]){_0x363e64[_0xf326('0x43')]=_[_0xf326('0x45')](_0x363e64['where'],{'$or':_[_0xf326('0x33')](_0x363e64[_0xf326('0x3c')],function(_0x323fb1){var _0x3c33d1={};_0x3c33d1[_0x323fb1]={'$like':'%'+_0x35a7c9[_0xf326('0x38')][_0xf326('0x47')]+'%'};return _0x3c33d1;})});}_0x363e64=_[_0xf326('0x45')]({},_0x363e64,_0x35a7c9[_0xf326('0x50')]);return _0x6e662['getDescriptions'](_0x363e64);}})[_0xf326('0x1c')](function(_0x2e2103){if(_0x2e2103){_0x293600=_0x2e2103['length'];if(!_0x35a7c9[_0xf326('0x38')]['hasOwnProperty'](_0xf326('0x3f'))){_0x363e64[_0xf326('0x40')]=qs[_0xf326('0x40')](_0x35a7c9[_0xf326('0x38')][_0xf326('0x40')]);_0x363e64[_0xf326('0x2b')]=qs[_0xf326('0x2b')](_0x35a7c9[_0xf326('0x38')][_0xf326('0x2b')]);}return _0x6e662[_0xf326('0x5a')](_0x363e64);}})[_0xf326('0x1c')](function(_0x3face2){if(_0x3face2){return _0x3face2?{'count':_0x293600,'rows':_0x3face2}:null;}})[_0xf326('0x1c')](respondWithResult(_0x147d51,null))[_0xf326('0x26')](handleError(_0x147d51,null));};exports['getTags']=function(_0x2bb6f0,_0xdb6e40,_0x27c569){var _0x3d3bd4={};var _0xdb2ad8={};var _0x550f34;var _0x1ec128;return db[_0xf326('0x48')][_0xf326('0x56')]({'where':{'id':_0x2bb6f0[_0xf326('0x4f')]['id']}})[_0xf326('0x1c')](handleEntityNotFound(_0xdb6e40,null))['then'](function(_0x4b6ec0){if(_0x4b6ec0){_0x550f34=_0x4b6ec0;_0xdb2ad8[_0xf326('0x37')]=_['keys'](db[_0xf326('0x5b')][_0xf326('0x34')]);_0xdb2ad8[_0xf326('0x38')]=_['keys'](_0x2bb6f0['query']);_0xdb2ad8[_0xf326('0x3a')]=_[_0xf326('0x3b')](_0xdb2ad8[_0xf326('0x37')],_0xdb2ad8[_0xf326('0x38')]);_0x3d3bd4[_0xf326('0x3c')]=_['intersection'](_0xdb2ad8[_0xf326('0x37')],qs[_0xf326('0x3d')](_0x2bb6f0[_0xf326('0x38')]['fields']));_0x3d3bd4['attributes']=_0x3d3bd4['attributes'][_0xf326('0x3e')]?_0x3d3bd4[_0xf326('0x3c')]:_0xdb2ad8[_0xf326('0x37')];_0x3d3bd4[_0xf326('0x41')]=qs[_0xf326('0x42')](_0x2bb6f0[_0xf326('0x38')][_0xf326('0x42')]);_0x3d3bd4['where']=qs['filters'](_[_0xf326('0x44')](_0x2bb6f0[_0xf326('0x38')],_0xdb2ad8[_0xf326('0x3a')]));if(_0x2bb6f0['query'][_0xf326('0x47')]){_0x3d3bd4[_0xf326('0x43')]=_[_0xf326('0x45')](_0x3d3bd4['where'],{'$or':_[_0xf326('0x33')](_0x3d3bd4[_0xf326('0x3c')],function(_0x267bae){var _0x3d728a={};_0x3d728a[_0x267bae]={'$like':'%'+_0x2bb6f0['query']['filter']+'%'};return _0x3d728a;})});}_0x3d3bd4=_['merge']({},_0x3d3bd4,_0x2bb6f0[_0xf326('0x50')]);return _0x550f34[_0xf326('0x5c')](_0x3d3bd4);}})[_0xf326('0x1c')](function(_0x5f0b45){if(_0x5f0b45){_0x1ec128=_0x5f0b45[_0xf326('0x3e')];if(!_0x2bb6f0[_0xf326('0x38')][_0xf326('0x57')]('nolimit')){_0x3d3bd4[_0xf326('0x40')]=qs[_0xf326('0x40')](_0x2bb6f0[_0xf326('0x38')][_0xf326('0x40')]);_0x3d3bd4['offset']=qs[_0xf326('0x2b')](_0x2bb6f0['query'][_0xf326('0x2b')]);}return _0x550f34[_0xf326('0x5c')](_0x3d3bd4);}})[_0xf326('0x1c')](function(_0xd45708){if(_0xd45708){return _0xd45708?{'count':_0x1ec128,'rows':_0xd45708}:null;}})['then'](respondWithResult(_0xdb6e40,null))[_0xf326('0x26')](handleError(_0xdb6e40,null));};exports['setTags']=function(_0x499316,_0x1ec34d,_0x1d6962){if(_0x499316[_0xf326('0x53')]['id']){delete _0x499316[_0xf326('0x53')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x499316[_0xf326('0x4f')]['id']}})[_0xf326('0x1c')](handleEntityNotFound(_0x1ec34d,null))[_0xf326('0x1c')](function(_0xc67315){if(_0xc67315){return _0xc67315['setTags'](_0x499316[_0xf326('0x53')]['ids']||[]);}return null;})[_0xf326('0x1c')](respondWithResult(_0x1ec34d,null))[_0xf326('0x26')](handleError(_0x1ec34d,null));};
\ No newline at end of file
+var _0x5b03=['params','find','create','body','getFields','findOne','ZendeskField','order','pick','options','hasOwnProperty','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','count','limit','set','apply','reject','save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','offset','sort','where','filter','VIRTUAL','merge','ZendeskConfiguration','findAll','rows','show'];(function(_0x4e73f1,_0x138e55){var _0x58c69b=function(_0x22930b){while(--_0x22930b){_0x4e73f1['push'](_0x4e73f1['shift']());}};_0x58c69b(++_0x138e55);}(_0x5b03,0x134));var _0x35b0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5b03[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x35b0('0x0'));var emlformat=require(_0x35b0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35b0('0x2'));var jsonpatch=require(_0x35b0('0x3'));var rp=require(_0x35b0('0x4'));var moment=require(_0x35b0('0x5'));var BPromise=require(_0x35b0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x35b0('0x7'));var sox=require(_0x35b0('0x8'));var csv=require('to-csv');var ejs=require(_0x35b0('0x9'));var fs=require('fs');var _=require(_0x35b0('0xa'));var squel=require(_0x35b0('0xb'));var crypto=require(_0x35b0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x35b0('0xd'));var toCsv=require(_0x35b0('0xe'));var querystring=require(_0x35b0('0xf'));var Papa=require(_0x35b0('0x10'));var Redis=require(_0x35b0('0x11'));var authService=require(_0x35b0('0x12'));var qs=require(_0x35b0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35b0('0x14'));var logger=require(_0x35b0('0x15'))(_0x35b0('0x16'));var utils=require(_0x35b0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x35b0('0x18'));var db=require(_0x35b0('0x19'))['db'];var jayson=require(_0x35b0('0x1a'));var client=jayson[_0x35b0('0x1b')][_0x35b0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x21386a,_0x3ad00b,_0x46a2df,_0xe46c52){return new BPromise(function(_0x218f4d,_0x3388b3){var _0x117ee4=_0xe46c52||client;return _0x117ee4[_0x35b0('0x1d')](_0x21386a,_0x46a2df)['then'](function(_0x3d1898){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x3ad00b,_0x35b0('0x1e'));logger[_0x35b0('0x1f')](_0x35b0('0x20'),_0x3ad00b,_0x35b0('0x1e'),JSON[_0x35b0('0x21')](_0x3d1898));if(_0x3d1898[_0x35b0('0x22')]){if(_0x3d1898[_0x35b0('0x22')][_0x35b0('0x23')]===0x1f4){logger['error'](_0x35b0('0x24'),_0x3ad00b,_0x3d1898['error']['message']);return _0x3388b3(_0x3d1898[_0x35b0('0x22')][_0x35b0('0x25')]);}logger[_0x35b0('0x22')](_0x35b0('0x24'),_0x3ad00b,_0x3d1898[_0x35b0('0x22')][_0x35b0('0x25')]);return _0x218f4d(_0x3d1898['error'][_0x35b0('0x25')]);}else{logger[_0x35b0('0x26')](_0x35b0('0x24'),_0x3ad00b,_0x35b0('0x1e'));_0x218f4d(_0x3d1898[_0x35b0('0x27')][_0x35b0('0x25')]);}})[_0x35b0('0x28')](function(_0x36b329){logger['error'](_0x35b0('0x24'),_0x3ad00b,_0x36b329);_0x3388b3(_0x36b329);});});}function respondWithStatusCode(_0x5514c0,_0x531566){_0x531566=_0x531566||0xcc;return function(_0x34087f){if(_0x34087f){return _0x5514c0[_0x35b0('0x29')](_0x531566);}return _0x5514c0[_0x35b0('0x2a')](_0x531566)['end']();};}function respondWithResult(_0x3800c9,_0x43e14b){_0x43e14b=_0x43e14b||0xc8;return function(_0x303b79){if(_0x303b79){return _0x3800c9['status'](_0x43e14b)[_0x35b0('0x2b')](_0x303b79);}};}function respondWithFilteredResult(_0x7d35d2,_0x311b84){return function(_0x310520){if(_0x310520){var _0xf43006=_0x310520[_0x35b0('0x2c')],_0x4f0a90=_0x311b84['offset'],_0x4ddf97=_0x311b84['offset']+_0x311b84[_0x35b0('0x2d')],_0x23c17f;if(_0x4ddf97>=_0xf43006){_0x4ddf97=_0xf43006;_0x23c17f=0xc8;}else{_0x23c17f=0xce;}_0x7d35d2[_0x35b0('0x2a')](_0x23c17f);return _0x7d35d2[_0x35b0('0x2e')]('Content-Range',_0x4f0a90+'-'+_0x4ddf97+'/'+_0xf43006)[_0x35b0('0x2b')](_0x310520);}return null;};}function patchUpdates(_0x3cd23b){return function(_0x147e77){try{jsonpatch[_0x35b0('0x2f')](_0x147e77,_0x3cd23b,!![]);}catch(_0x5a1e6e){return BPromise[_0x35b0('0x30')](_0x5a1e6e);}return _0x147e77[_0x35b0('0x31')]();};}function saveUpdates(_0x2c7ab6,_0x96d9e5){return function(_0x5bbbb5){if(_0x5bbbb5){return _0x5bbbb5[_0x35b0('0x32')](_0x2c7ab6)['then'](function(_0x5c405d){return _0x5c405d;});}return null;};}function removeEntity(_0x413f24,_0x3d31c1){return function(_0x49a33a){if(_0x49a33a){return _0x49a33a[_0x35b0('0x33')]()[_0x35b0('0x34')](function(){_0x413f24['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4705c9,_0x4c204f){return function(_0x10cf38){if(!_0x10cf38){_0x4705c9[_0x35b0('0x29')](0x194);}return _0x10cf38;};}function handleError(_0x545d6a,_0x553b22){_0x553b22=_0x553b22||0x1f4;return function(_0x482df5){logger[_0x35b0('0x22')](_0x482df5[_0x35b0('0x35')]);if(_0x482df5['name']){delete _0x482df5[_0x35b0('0x36')];}_0x545d6a[_0x35b0('0x2a')](_0x553b22)[_0x35b0('0x37')](_0x482df5);};}exports[_0x35b0('0x38')]=function(_0xca147a,_0x17e985){var _0xa14338={},_0x5d4a6b={},_0x5810c0={'count':0x0,'rows':[]};var _0x35f422=_[_0x35b0('0x39')](db['ZendeskConfiguration'][_0x35b0('0x3a')],function(_0xf4daf){return{'name':_0xf4daf[_0x35b0('0x3b')],'type':_0xf4daf[_0x35b0('0x3c')][_0x35b0('0x3d')]};});_0x5d4a6b['model']=_[_0x35b0('0x39')](_0x35f422,_0x35b0('0x36'));_0x5d4a6b[_0x35b0('0x3e')]=_[_0x35b0('0x3f')](_0xca147a[_0x35b0('0x3e')]);_0x5d4a6b[_0x35b0('0x40')]=_[_0x35b0('0x41')](_0x5d4a6b[_0x35b0('0x42')],_0x5d4a6b[_0x35b0('0x3e')]);_0xa14338[_0x35b0('0x43')]=_[_0x35b0('0x41')](_0x5d4a6b[_0x35b0('0x42')],qs[_0x35b0('0x44')](_0xca147a[_0x35b0('0x3e')][_0x35b0('0x44')]));_0xa14338['attributes']=_0xa14338['attributes'][_0x35b0('0x45')]?_0xa14338[_0x35b0('0x43')]:_0x5d4a6b[_0x35b0('0x42')];if(!_0xca147a[_0x35b0('0x3e')]['hasOwnProperty']('nolimit')){_0xa14338[_0x35b0('0x2d')]=qs[_0x35b0('0x2d')](_0xca147a['query'][_0x35b0('0x2d')]);_0xa14338[_0x35b0('0x46')]=qs[_0x35b0('0x46')](_0xca147a['query'][_0x35b0('0x46')]);}_0xa14338['order']=qs[_0x35b0('0x47')](_0xca147a[_0x35b0('0x3e')][_0x35b0('0x47')]);_0xa14338[_0x35b0('0x48')]=qs[_0x35b0('0x40')](_['pick'](_0xca147a[_0x35b0('0x3e')],_0x5d4a6b[_0x35b0('0x40')]),_0x35f422);if(_0xca147a['query'][_0x35b0('0x49')]){_0xa14338[_0x35b0('0x48')]=_['merge'](_0xa14338['where'],{'$or':_['map'](_0x35f422,function(_0x17a38d){if(_0x17a38d[_0x35b0('0x3c')]!==_0x35b0('0x4a')){var _0x34ce68={};_0x34ce68[_0x17a38d[_0x35b0('0x36')]]={'$like':'%'+_0xca147a[_0x35b0('0x3e')][_0x35b0('0x49')]+'%'};return _0x34ce68;}})});}_0xa14338=_[_0x35b0('0x4b')]({},_0xa14338,_0xca147a['options']);var _0x519533={'where':_0xa14338[_0x35b0('0x48')]};return db['ZendeskConfiguration']['count'](_0x519533)[_0x35b0('0x34')](function(_0x264f7b){_0x5810c0[_0x35b0('0x2c')]=_0x264f7b;if(_0xca147a[_0x35b0('0x3e')]['includeAll']){_0xa14338['include']=[{'all':!![]}];}return db[_0x35b0('0x4c')][_0x35b0('0x4d')](_0xa14338);})[_0x35b0('0x34')](function(_0x214dd1){_0x5810c0[_0x35b0('0x4e')]=_0x214dd1;return _0x5810c0;})[_0x35b0('0x34')](respondWithFilteredResult(_0x17e985,_0xa14338))[_0x35b0('0x28')](handleError(_0x17e985,null));};exports[_0x35b0('0x4f')]=function(_0x450c59,_0x34f309){var _0x23da4c={'raw':![],'where':{'id':_0x450c59[_0x35b0('0x50')]['id']}},_0x5b71a6={};_0x5b71a6[_0x35b0('0x42')]=_[_0x35b0('0x3f')](db[_0x35b0('0x4c')][_0x35b0('0x3a')]);_0x5b71a6[_0x35b0('0x3e')]=_[_0x35b0('0x3f')](_0x450c59[_0x35b0('0x3e')]);_0x5b71a6['filters']=_[_0x35b0('0x41')](_0x5b71a6[_0x35b0('0x42')],_0x5b71a6[_0x35b0('0x3e')]);_0x23da4c[_0x35b0('0x43')]=_[_0x35b0('0x41')](_0x5b71a6[_0x35b0('0x42')],qs[_0x35b0('0x44')](_0x450c59[_0x35b0('0x3e')]['fields']));_0x23da4c['attributes']=_0x23da4c[_0x35b0('0x43')][_0x35b0('0x45')]?_0x23da4c['attributes']:_0x5b71a6[_0x35b0('0x42')];if(_0x450c59[_0x35b0('0x3e')]['includeAll']){_0x23da4c['include']=[{'all':!![]}];}_0x23da4c=_['merge']({},_0x23da4c,_0x450c59['options']);return db[_0x35b0('0x4c')][_0x35b0('0x51')](_0x23da4c)['then'](handleEntityNotFound(_0x34f309,null))[_0x35b0('0x34')](respondWithResult(_0x34f309,null))[_0x35b0('0x28')](handleError(_0x34f309,null));};exports[_0x35b0('0x52')]=function(_0x483e34,_0x30628b){return db[_0x35b0('0x4c')][_0x35b0('0x52')](_0x483e34[_0x35b0('0x53')],{})['then'](respondWithResult(_0x30628b,0xc9))[_0x35b0('0x28')](handleError(_0x30628b,null));};exports[_0x35b0('0x32')]=function(_0x5da265,_0x5ca83c){if(_0x5da265[_0x35b0('0x53')]['id']){delete _0x5da265[_0x35b0('0x53')]['id'];}return db[_0x35b0('0x4c')][_0x35b0('0x51')]({'where':{'id':_0x5da265[_0x35b0('0x50')]['id']}})[_0x35b0('0x34')](handleEntityNotFound(_0x5ca83c,null))[_0x35b0('0x34')](saveUpdates(_0x5da265[_0x35b0('0x53')],null))[_0x35b0('0x34')](respondWithResult(_0x5ca83c,null))[_0x35b0('0x28')](handleError(_0x5ca83c,null));};exports[_0x35b0('0x33')]=function(_0x1b3e91,_0x13e264){return db['ZendeskConfiguration'][_0x35b0('0x51')]({'where':{'id':_0x1b3e91[_0x35b0('0x50')]['id']}})[_0x35b0('0x34')](handleEntityNotFound(_0x13e264,null))['then'](removeEntity(_0x13e264,null))[_0x35b0('0x28')](handleError(_0x13e264,null));};exports[_0x35b0('0x54')]=function(_0x59d371,_0x29c501,_0x427ff9){var _0x564def={};var _0x56f14a={};var _0x2dc2d5;var _0x8f4ee4;return db[_0x35b0('0x4c')][_0x35b0('0x55')]({'where':{'id':_0x59d371['params']['id']}})[_0x35b0('0x34')](handleEntityNotFound(_0x29c501,null))[_0x35b0('0x34')](function(_0x2a518d){if(_0x2a518d){_0x2dc2d5=_0x2a518d;_0x56f14a[_0x35b0('0x42')]=_[_0x35b0('0x3f')](db[_0x35b0('0x56')]['rawAttributes']);_0x56f14a['query']=_['keys'](_0x59d371['query']);_0x56f14a[_0x35b0('0x40')]=_['intersection'](_0x56f14a[_0x35b0('0x42')],_0x56f14a[_0x35b0('0x3e')]);_0x564def['attributes']=_[_0x35b0('0x41')](_0x56f14a[_0x35b0('0x42')],qs['fields'](_0x59d371['query'][_0x35b0('0x44')]));_0x564def[_0x35b0('0x43')]=_0x564def['attributes'][_0x35b0('0x45')]?_0x564def['attributes']:_0x56f14a[_0x35b0('0x42')];_0x564def[_0x35b0('0x57')]=qs[_0x35b0('0x47')](_0x59d371[_0x35b0('0x3e')][_0x35b0('0x47')]);_0x564def['where']=qs[_0x35b0('0x40')](_[_0x35b0('0x58')](_0x59d371[_0x35b0('0x3e')],_0x56f14a[_0x35b0('0x40')]));if(_0x59d371['query'][_0x35b0('0x49')]){_0x564def[_0x35b0('0x48')]=_[_0x35b0('0x4b')](_0x564def[_0x35b0('0x48')],{'$or':_[_0x35b0('0x39')](_0x564def[_0x35b0('0x43')],function(_0x293cb9){var _0x485287={};_0x485287[_0x293cb9]={'$like':'%'+_0x59d371['query']['filter']+'%'};return _0x485287;})});}_0x564def=_[_0x35b0('0x4b')]({},_0x564def,_0x59d371[_0x35b0('0x59')]);return _0x2dc2d5[_0x35b0('0x54')](_0x564def);}})[_0x35b0('0x34')](function(_0x22e78c){if(_0x22e78c){_0x8f4ee4=_0x22e78c[_0x35b0('0x45')];if(!_0x59d371['query'][_0x35b0('0x5a')](_0x35b0('0x5b'))){_0x564def[_0x35b0('0x2d')]=qs['limit'](_0x59d371[_0x35b0('0x3e')][_0x35b0('0x2d')]);_0x564def[_0x35b0('0x46')]=qs[_0x35b0('0x46')](_0x59d371[_0x35b0('0x3e')]['offset']);}return _0x2dc2d5[_0x35b0('0x54')](_0x564def);}})['then'](function(_0x348821){if(_0x348821){return _0x348821?{'count':_0x8f4ee4,'rows':_0x348821}:null;}})[_0x35b0('0x34')](respondWithResult(_0x29c501,null))[_0x35b0('0x28')](handleError(_0x29c501,null));};exports[_0x35b0('0x5c')]=function(_0x374497,_0x3a0826,_0x3b3eeb){var _0x5adc8b={};var _0x2aaa73={};var _0x323b13;var _0x143025;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x374497[_0x35b0('0x50')]['id']}})[_0x35b0('0x34')](handleEntityNotFound(_0x3a0826,null))[_0x35b0('0x34')](function(_0x57e142){if(_0x57e142){_0x323b13=_0x57e142;_0x2aaa73[_0x35b0('0x42')]=_[_0x35b0('0x3f')](db[_0x35b0('0x56')]['rawAttributes']);_0x2aaa73[_0x35b0('0x3e')]=_[_0x35b0('0x3f')](_0x374497[_0x35b0('0x3e')]);_0x2aaa73['filters']=_['intersection'](_0x2aaa73[_0x35b0('0x42')],_0x2aaa73['query']);_0x5adc8b[_0x35b0('0x43')]=_[_0x35b0('0x41')](_0x2aaa73['model'],qs[_0x35b0('0x44')](_0x374497[_0x35b0('0x3e')][_0x35b0('0x44')]));_0x5adc8b[_0x35b0('0x43')]=_0x5adc8b[_0x35b0('0x43')][_0x35b0('0x45')]?_0x5adc8b[_0x35b0('0x43')]:_0x2aaa73[_0x35b0('0x42')];_0x5adc8b[_0x35b0('0x57')]=qs[_0x35b0('0x47')](_0x374497[_0x35b0('0x3e')]['sort']);_0x5adc8b[_0x35b0('0x48')]=qs[_0x35b0('0x40')](_[_0x35b0('0x58')](_0x374497[_0x35b0('0x3e')],_0x2aaa73['filters']));if(_0x374497[_0x35b0('0x3e')][_0x35b0('0x49')]){_0x5adc8b[_0x35b0('0x48')]=_['merge'](_0x5adc8b[_0x35b0('0x48')],{'$or':_[_0x35b0('0x39')](_0x5adc8b['attributes'],function(_0x3ae6cf){var _0x42af62={};_0x42af62[_0x3ae6cf]={'$like':'%'+_0x374497[_0x35b0('0x3e')]['filter']+'%'};return _0x42af62;})});}_0x5adc8b=_['merge']({},_0x5adc8b,_0x374497[_0x35b0('0x59')]);return _0x323b13[_0x35b0('0x5c')](_0x5adc8b);}})[_0x35b0('0x34')](function(_0x1d6951){if(_0x1d6951){_0x143025=_0x1d6951[_0x35b0('0x45')];if(!_0x374497[_0x35b0('0x3e')][_0x35b0('0x5a')]('nolimit')){_0x5adc8b[_0x35b0('0x2d')]=qs[_0x35b0('0x2d')](_0x374497[_0x35b0('0x3e')]['limit']);_0x5adc8b['offset']=qs[_0x35b0('0x46')](_0x374497[_0x35b0('0x3e')][_0x35b0('0x46')]);}return _0x323b13[_0x35b0('0x5c')](_0x5adc8b);}})['then'](function(_0xa896aa){if(_0xa896aa){return _0xa896aa?{'count':_0x143025,'rows':_0xa896aa}:null;}})[_0x35b0('0x34')](respondWithResult(_0x3a0826,null))[_0x35b0('0x28')](handleError(_0x3a0826,null));};exports[_0x35b0('0x5d')]=function(_0x50b0d8,_0x3ffe08,_0x24f391){var _0x1f4516={};var _0xab8031={};var _0x59d185;var _0x421dfb;return db[_0x35b0('0x4c')]['findOne']({'where':{'id':_0x50b0d8[_0x35b0('0x50')]['id']}})['then'](handleEntityNotFound(_0x3ffe08,null))[_0x35b0('0x34')](function(_0x309254){if(_0x309254){_0x59d185=_0x309254;_0xab8031[_0x35b0('0x42')]=_[_0x35b0('0x3f')](db[_0x35b0('0x56')][_0x35b0('0x3a')]);_0xab8031[_0x35b0('0x3e')]=_[_0x35b0('0x3f')](_0x50b0d8[_0x35b0('0x3e')]);_0xab8031[_0x35b0('0x40')]=_[_0x35b0('0x41')](_0xab8031[_0x35b0('0x42')],_0xab8031[_0x35b0('0x3e')]);_0x1f4516[_0x35b0('0x43')]=_['intersection'](_0xab8031[_0x35b0('0x42')],qs['fields'](_0x50b0d8['query'][_0x35b0('0x44')]));_0x1f4516[_0x35b0('0x43')]=_0x1f4516[_0x35b0('0x43')][_0x35b0('0x45')]?_0x1f4516[_0x35b0('0x43')]:_0xab8031['model'];_0x1f4516[_0x35b0('0x57')]=qs[_0x35b0('0x47')](_0x50b0d8[_0x35b0('0x3e')][_0x35b0('0x47')]);_0x1f4516[_0x35b0('0x48')]=qs[_0x35b0('0x40')](_[_0x35b0('0x58')](_0x50b0d8[_0x35b0('0x3e')],_0xab8031[_0x35b0('0x40')]));if(_0x50b0d8[_0x35b0('0x3e')][_0x35b0('0x49')]){_0x1f4516['where']=_[_0x35b0('0x4b')](_0x1f4516[_0x35b0('0x48')],{'$or':_[_0x35b0('0x39')](_0x1f4516[_0x35b0('0x43')],function(_0x1e73bb){var _0x2ea96e={};_0x2ea96e[_0x1e73bb]={'$like':'%'+_0x50b0d8[_0x35b0('0x3e')]['filter']+'%'};return _0x2ea96e;})});}_0x1f4516=_['merge']({},_0x1f4516,_0x50b0d8[_0x35b0('0x59')]);return _0x59d185[_0x35b0('0x5d')](_0x1f4516);}})[_0x35b0('0x34')](function(_0x49351e){if(_0x49351e){_0x421dfb=_0x49351e['length'];if(!_0x50b0d8[_0x35b0('0x3e')][_0x35b0('0x5a')]('nolimit')){_0x1f4516[_0x35b0('0x2d')]=qs[_0x35b0('0x2d')](_0x50b0d8['query'][_0x35b0('0x2d')]);_0x1f4516[_0x35b0('0x46')]=qs[_0x35b0('0x46')](_0x50b0d8[_0x35b0('0x3e')][_0x35b0('0x46')]);}return _0x59d185['getDescriptions'](_0x1f4516);}})[_0x35b0('0x34')](function(_0x208389){if(_0x208389){return _0x208389?{'count':_0x421dfb,'rows':_0x208389}:null;}})[_0x35b0('0x34')](respondWithResult(_0x3ffe08,null))[_0x35b0('0x28')](handleError(_0x3ffe08,null));};exports[_0x35b0('0x5e')]=function(_0x406fe7,_0x24a6d2,_0x444f0b){var _0x519a13={};var _0x569d25={};var _0x1b7867;var _0x96942f;return db[_0x35b0('0x4c')]['findOne']({'where':{'id':_0x406fe7[_0x35b0('0x50')]['id']}})[_0x35b0('0x34')](handleEntityNotFound(_0x24a6d2,null))[_0x35b0('0x34')](function(_0x307208){if(_0x307208){_0x1b7867=_0x307208;_0x569d25[_0x35b0('0x42')]=_[_0x35b0('0x3f')](db['Tag'][_0x35b0('0x3a')]);_0x569d25[_0x35b0('0x3e')]=_[_0x35b0('0x3f')](_0x406fe7['query']);_0x569d25[_0x35b0('0x40')]=_[_0x35b0('0x41')](_0x569d25[_0x35b0('0x42')],_0x569d25[_0x35b0('0x3e')]);_0x519a13[_0x35b0('0x43')]=_[_0x35b0('0x41')](_0x569d25[_0x35b0('0x42')],qs[_0x35b0('0x44')](_0x406fe7[_0x35b0('0x3e')][_0x35b0('0x44')]));_0x519a13[_0x35b0('0x43')]=_0x519a13['attributes'][_0x35b0('0x45')]?_0x519a13[_0x35b0('0x43')]:_0x569d25[_0x35b0('0x42')];_0x519a13['order']=qs[_0x35b0('0x47')](_0x406fe7['query'][_0x35b0('0x47')]);_0x519a13[_0x35b0('0x48')]=qs[_0x35b0('0x40')](_['pick'](_0x406fe7['query'],_0x569d25['filters']));if(_0x406fe7['query'][_0x35b0('0x49')]){_0x519a13[_0x35b0('0x48')]=_[_0x35b0('0x4b')](_0x519a13[_0x35b0('0x48')],{'$or':_[_0x35b0('0x39')](_0x519a13['attributes'],function(_0x5a3272){var _0x5d2d6e={};_0x5d2d6e[_0x5a3272]={'$like':'%'+_0x406fe7[_0x35b0('0x3e')][_0x35b0('0x49')]+'%'};return _0x5d2d6e;})});}_0x519a13=_['merge']({},_0x519a13,_0x406fe7[_0x35b0('0x59')]);return _0x1b7867['getTags'](_0x519a13);}})[_0x35b0('0x34')](function(_0x50cb1e){if(_0x50cb1e){_0x96942f=_0x50cb1e[_0x35b0('0x45')];if(!_0x406fe7[_0x35b0('0x3e')][_0x35b0('0x5a')]('nolimit')){_0x519a13[_0x35b0('0x2d')]=qs[_0x35b0('0x2d')](_0x406fe7['query'][_0x35b0('0x2d')]);_0x519a13[_0x35b0('0x46')]=qs[_0x35b0('0x46')](_0x406fe7['query']['offset']);}return _0x1b7867[_0x35b0('0x5e')](_0x519a13);}})[_0x35b0('0x34')](function(_0x2a66b6){if(_0x2a66b6){return _0x2a66b6?{'count':_0x96942f,'rows':_0x2a66b6}:null;}})[_0x35b0('0x34')](respondWithResult(_0x24a6d2,null))[_0x35b0('0x28')](handleError(_0x24a6d2,null));};exports[_0x35b0('0x5f')]=function(_0x102166,_0x2297aa,_0xaeb7a4){if(_0x102166['body']['id']){delete _0x102166[_0x35b0('0x53')]['id'];}return db[_0x35b0('0x4c')][_0x35b0('0x55')]({'where':{'id':_0x102166['params']['id']}})['then'](handleEntityNotFound(_0x2297aa,null))['then'](function(_0x538656){if(_0x538656){return _0x538656[_0x35b0('0x5f')](_0x102166[_0x35b0('0x53')][_0x35b0('0x60')]||[]);}return null;})[_0x35b0('0x34')](respondWithResult(_0x2297aa,null))[_0x35b0('0x28')](handleError(_0x2297aa,null));};
\ No newline at end of file