Built motion from commit 0900f080.|2.5.45
[motion2.git] / server / api / intDeskConfiguration / intDeskConfiguration.controller.js
index 2552e90..bdf9f6f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3bb5=['body','destroy','getFields','getSubjects','findOne','DeskField','nolimit','getDescriptions','getTags','Tag','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','stack','name','index','DeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','map','options','includeAll','include','findAll','rows','show','params','merge','find','create'];(function(_0x55c400,_0x18e7f9){var _0x775d3f=function(_0x446c98){while(--_0x446c98){_0x55c400['push'](_0x55c400['shift']());}};_0x775d3f(++_0x18e7f9);}(_0x3bb5,0x129));var _0x53bb=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x3bb5[_0x9c2427];return _0x51984f;};'use strict';var pdf=require(_0x53bb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x53bb('0x1'));var zipdir=require(_0x53bb('0x2'));var jsonpatch=require(_0x53bb('0x3'));var rp=require(_0x53bb('0x4'));var moment=require(_0x53bb('0x5'));var BPromise=require(_0x53bb('0x6'));var Mustache=require(_0x53bb('0x7'));var util=require('util');var path=require('path');var sox=require(_0x53bb('0x8'));var csv=require(_0x53bb('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x53bb('0xa'));var squel=require(_0x53bb('0xb'));var crypto=require(_0x53bb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x53bb('0xd'));var toCsv=require(_0x53bb('0x9'));var querystring=require(_0x53bb('0xe'));var Papa=require(_0x53bb('0xf'));var Redis=require(_0x53bb('0x10'));var authService=require(_0x53bb('0x11'));var qs=require(_0x53bb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x53bb('0x13'))(_0x53bb('0x14'));var utils=require(_0x53bb('0x15'));var config=require(_0x53bb('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x53bb('0x17'));var client=jayson[_0x53bb('0x18')][_0x53bb('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x202543,_0x48814f,_0x1a31e2,_0x53fedf){return new BPromise(function(_0xa1d4b8,_0x2b8010){var _0x4bfa72=_0x53fedf||client;return _0x4bfa72[_0x53bb('0x1a')](_0x202543,_0x1a31e2)[_0x53bb('0x1b')](function(_0x646271){logger['info'](_0x53bb('0x1c'),_0x48814f,_0x53bb('0x1d'));logger[_0x53bb('0x1e')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x48814f,_0x53bb('0x1d'),JSON[_0x53bb('0x1f')](_0x646271));if(_0x646271[_0x53bb('0x20')]){if(_0x646271[_0x53bb('0x20')][_0x53bb('0x21')]===0x1f4){logger['error'](_0x53bb('0x1c'),_0x48814f,_0x646271[_0x53bb('0x20')][_0x53bb('0x22')]);return _0x2b8010(_0x646271['error'][_0x53bb('0x22')]);}logger[_0x53bb('0x20')](_0x53bb('0x1c'),_0x48814f,_0x646271['error']['message']);return _0xa1d4b8(_0x646271[_0x53bb('0x20')][_0x53bb('0x22')]);}else{logger['info'](_0x53bb('0x1c'),_0x48814f,'request\x20sent');_0xa1d4b8(_0x646271[_0x53bb('0x23')]['message']);}})[_0x53bb('0x24')](function(_0x407bea){logger[_0x53bb('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0x48814f,_0x407bea);_0x2b8010(_0x407bea);});});}function respondWithStatusCode(_0x30502e,_0x4a030f){_0x4a030f=_0x4a030f||0xcc;return function(_0x17e188){if(_0x17e188){return _0x30502e[_0x53bb('0x25')](_0x4a030f);}return _0x30502e['status'](_0x4a030f)[_0x53bb('0x26')]();};}function respondWithResult(_0x538523,_0x7b7ef3){_0x7b7ef3=_0x7b7ef3||0xc8;return function(_0x140ac3){if(_0x140ac3){return _0x538523[_0x53bb('0x27')](_0x7b7ef3)['json'](_0x140ac3);}};}function respondWithFilteredResult(_0x17f4c4,_0x396e8c){return function(_0x4dcbca){if(_0x4dcbca){var _0x2d21fd=_0x4dcbca[_0x53bb('0x28')],_0x254cf7=_0x396e8c[_0x53bb('0x29')],_0x2258e3=_0x396e8c[_0x53bb('0x29')]+_0x396e8c[_0x53bb('0x2a')],_0x42ca5c;if(_0x2258e3>=_0x2d21fd){_0x2258e3=_0x2d21fd;_0x42ca5c=0xc8;}else{_0x42ca5c=0xce;}_0x17f4c4[_0x53bb('0x27')](_0x42ca5c);return _0x17f4c4[_0x53bb('0x2b')](_0x53bb('0x2c'),_0x254cf7+'-'+_0x2258e3+'/'+_0x2d21fd)[_0x53bb('0x2d')](_0x4dcbca);}return null;};}function patchUpdates(_0x3ec332){return function(_0x5ed1e2){try{jsonpatch[_0x53bb('0x2e')](_0x5ed1e2,_0x3ec332,!![]);}catch(_0x29dde2){return BPromise[_0x53bb('0x2f')](_0x29dde2);}return _0x5ed1e2[_0x53bb('0x30')]();};}function saveUpdates(_0x5e403d,_0x3c4f56){return function(_0x43995e){if(_0x43995e){return _0x43995e[_0x53bb('0x31')](_0x5e403d)[_0x53bb('0x1b')](function(_0x3c6d9a){return _0x3c6d9a;});}return null;};}function removeEntity(_0x5b41ca,_0x489625){return function(_0x732ee1){if(_0x732ee1){return _0x732ee1['destroy']()[_0x53bb('0x1b')](function(){_0x5b41ca[_0x53bb('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb9749a,_0x2b859b){return function(_0x4da112){if(!_0x4da112){_0xb9749a[_0x53bb('0x25')](0x194);}return _0x4da112;};}function handleError(_0x5e8992,_0x25028a){_0x25028a=_0x25028a||0x1f4;return function(_0x3c72a8){logger[_0x53bb('0x20')](_0x3c72a8[_0x53bb('0x32')]);if(_0x3c72a8[_0x53bb('0x33')]){delete _0x3c72a8[_0x53bb('0x33')];}_0x5e8992[_0x53bb('0x27')](_0x25028a)['send'](_0x3c72a8);};}exports[_0x53bb('0x34')]=function(_0x1b0880,_0x12dde7){var _0x362c2d={},_0x18f0e8={},_0x43999e={'count':0x0,'rows':[]};var _0x37ed67=_['map'](db[_0x53bb('0x35')][_0x53bb('0x36')],function(_0x1e1fed){return{'name':_0x1e1fed[_0x53bb('0x37')],'type':_0x1e1fed[_0x53bb('0x38')][_0x53bb('0x39')]};});_0x18f0e8['model']=_['map'](_0x37ed67,_0x53bb('0x33'));_0x18f0e8[_0x53bb('0x3a')]=_[_0x53bb('0x3b')](_0x1b0880['query']);_0x18f0e8[_0x53bb('0x3c')]=_[_0x53bb('0x3d')](_0x18f0e8[_0x53bb('0x3e')],_0x18f0e8[_0x53bb('0x3a')]);_0x362c2d[_0x53bb('0x3f')]=_[_0x53bb('0x3d')](_0x18f0e8[_0x53bb('0x3e')],qs[_0x53bb('0x40')](_0x1b0880['query'][_0x53bb('0x40')]));_0x362c2d[_0x53bb('0x3f')]=_0x362c2d['attributes'][_0x53bb('0x41')]?_0x362c2d[_0x53bb('0x3f')]:_0x18f0e8[_0x53bb('0x3e')];if(!_0x1b0880[_0x53bb('0x3a')][_0x53bb('0x42')]('nolimit')){_0x362c2d['limit']=qs['limit'](_0x1b0880['query'][_0x53bb('0x2a')]);_0x362c2d[_0x53bb('0x29')]=qs[_0x53bb('0x29')](_0x1b0880['query']['offset']);}_0x362c2d[_0x53bb('0x43')]=qs[_0x53bb('0x44')](_0x1b0880['query'][_0x53bb('0x44')]);_0x362c2d[_0x53bb('0x45')]=qs[_0x53bb('0x3c')](_[_0x53bb('0x46')](_0x1b0880['query'],_0x18f0e8[_0x53bb('0x3c')]),_0x37ed67);if(_0x1b0880[_0x53bb('0x3a')][_0x53bb('0x47')]){_0x362c2d[_0x53bb('0x45')]=_['merge'](_0x362c2d[_0x53bb('0x45')],{'$or':_[_0x53bb('0x48')](_0x37ed67,function(_0x37bf78){if(_0x37bf78[_0x53bb('0x38')]!=='VIRTUAL'){var _0x5406f8={};_0x5406f8[_0x37bf78[_0x53bb('0x33')]]={'$like':'%'+_0x1b0880[_0x53bb('0x3a')][_0x53bb('0x47')]+'%'};return _0x5406f8;}})});}_0x362c2d=_['merge']({},_0x362c2d,_0x1b0880[_0x53bb('0x49')]);var _0x3137c4={'where':_0x362c2d[_0x53bb('0x45')]};return db[_0x53bb('0x35')][_0x53bb('0x28')](_0x3137c4)[_0x53bb('0x1b')](function(_0x1f8292){_0x43999e[_0x53bb('0x28')]=_0x1f8292;if(_0x1b0880[_0x53bb('0x3a')][_0x53bb('0x4a')]){_0x362c2d[_0x53bb('0x4b')]=[{'all':!![]}];}return db[_0x53bb('0x35')][_0x53bb('0x4c')](_0x362c2d);})[_0x53bb('0x1b')](function(_0x598eb0){_0x43999e[_0x53bb('0x4d')]=_0x598eb0;return _0x43999e;})[_0x53bb('0x1b')](respondWithFilteredResult(_0x12dde7,_0x362c2d))[_0x53bb('0x24')](handleError(_0x12dde7,null));};exports[_0x53bb('0x4e')]=function(_0x5a849d,_0x53d120){var _0x25094f={'raw':![],'where':{'id':_0x5a849d[_0x53bb('0x4f')]['id']}},_0x3c28e1={};_0x3c28e1[_0x53bb('0x3e')]=_[_0x53bb('0x3b')](db[_0x53bb('0x35')][_0x53bb('0x36')]);_0x3c28e1[_0x53bb('0x3a')]=_['keys'](_0x5a849d[_0x53bb('0x3a')]);_0x3c28e1['filters']=_[_0x53bb('0x3d')](_0x3c28e1[_0x53bb('0x3e')],_0x3c28e1[_0x53bb('0x3a')]);_0x25094f[_0x53bb('0x3f')]=_[_0x53bb('0x3d')](_0x3c28e1[_0x53bb('0x3e')],qs[_0x53bb('0x40')](_0x5a849d['query'][_0x53bb('0x40')]));_0x25094f[_0x53bb('0x3f')]=_0x25094f[_0x53bb('0x3f')][_0x53bb('0x41')]?_0x25094f[_0x53bb('0x3f')]:_0x3c28e1[_0x53bb('0x3e')];if(_0x5a849d[_0x53bb('0x3a')][_0x53bb('0x4a')]){_0x25094f[_0x53bb('0x4b')]=[{'all':!![]}];}_0x25094f=_[_0x53bb('0x50')]({},_0x25094f,_0x5a849d['options']);return db['DeskConfiguration'][_0x53bb('0x51')](_0x25094f)['then'](handleEntityNotFound(_0x53d120,null))[_0x53bb('0x1b')](respondWithResult(_0x53d120,null))[_0x53bb('0x24')](handleError(_0x53d120,null));};exports[_0x53bb('0x52')]=function(_0x22b291,_0x86c721){return db['DeskConfiguration']['create'](_0x22b291[_0x53bb('0x53')],{})[_0x53bb('0x1b')](respondWithResult(_0x86c721,0xc9))['catch'](handleError(_0x86c721,null));};exports['update']=function(_0xa4d885,_0x2fbd23){if(_0xa4d885[_0x53bb('0x53')]['id']){delete _0xa4d885[_0x53bb('0x53')]['id'];}return db[_0x53bb('0x35')][_0x53bb('0x51')]({'where':{'id':_0xa4d885[_0x53bb('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2fbd23,null))['then'](saveUpdates(_0xa4d885['body'],null))['then'](respondWithResult(_0x2fbd23,null))['catch'](handleError(_0x2fbd23,null));};exports[_0x53bb('0x54')]=function(_0x3e2334,_0xea16e7){return db[_0x53bb('0x35')][_0x53bb('0x51')]({'where':{'id':_0x3e2334[_0x53bb('0x4f')]['id']}})[_0x53bb('0x1b')](handleEntityNotFound(_0xea16e7,null))['then'](removeEntity(_0xea16e7,null))[_0x53bb('0x24')](handleError(_0xea16e7,null));};exports['getFields']=function(_0x3afb3f,_0x3b7ebc,_0x4a845e){var _0xf7d882={};var _0x44a672={};var _0x29fb7f;var _0x5b3e64;return db[_0x53bb('0x35')]['findOne']({'where':{'id':_0x3afb3f[_0x53bb('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3b7ebc,null))['then'](function(_0x9e8d57){if(_0x9e8d57){_0x29fb7f=_0x9e8d57;_0x44a672[_0x53bb('0x3e')]=_[_0x53bb('0x3b')](db['DeskField'][_0x53bb('0x36')]);_0x44a672['query']=_[_0x53bb('0x3b')](_0x3afb3f['query']);_0x44a672[_0x53bb('0x3c')]=_[_0x53bb('0x3d')](_0x44a672[_0x53bb('0x3e')],_0x44a672[_0x53bb('0x3a')]);_0xf7d882[_0x53bb('0x3f')]=_[_0x53bb('0x3d')](_0x44a672['model'],qs[_0x53bb('0x40')](_0x3afb3f['query']['fields']));_0xf7d882['attributes']=_0xf7d882[_0x53bb('0x3f')][_0x53bb('0x41')]?_0xf7d882['attributes']:_0x44a672[_0x53bb('0x3e')];_0xf7d882['order']=qs[_0x53bb('0x44')](_0x3afb3f[_0x53bb('0x3a')][_0x53bb('0x44')]);_0xf7d882[_0x53bb('0x45')]=qs[_0x53bb('0x3c')](_[_0x53bb('0x46')](_0x3afb3f[_0x53bb('0x3a')],_0x44a672['filters']));if(_0x3afb3f[_0x53bb('0x3a')][_0x53bb('0x47')]){_0xf7d882[_0x53bb('0x45')]=_[_0x53bb('0x50')](_0xf7d882['where'],{'$or':_[_0x53bb('0x48')](_0xf7d882[_0x53bb('0x3f')],function(_0xb1df){var _0x5f4b3b={};_0x5f4b3b[_0xb1df]={'$like':'%'+_0x3afb3f['query'][_0x53bb('0x47')]+'%'};return _0x5f4b3b;})});}_0xf7d882=_['merge']({},_0xf7d882,_0x3afb3f['options']);return _0x29fb7f[_0x53bb('0x55')](_0xf7d882);}})[_0x53bb('0x1b')](function(_0x30d552){if(_0x30d552){_0x5b3e64=_0x30d552[_0x53bb('0x41')];if(!_0x3afb3f[_0x53bb('0x3a')][_0x53bb('0x42')]('nolimit')){_0xf7d882[_0x53bb('0x2a')]=qs[_0x53bb('0x2a')](_0x3afb3f[_0x53bb('0x3a')]['limit']);_0xf7d882['offset']=qs['offset'](_0x3afb3f[_0x53bb('0x3a')][_0x53bb('0x29')]);}return _0x29fb7f[_0x53bb('0x55')](_0xf7d882);}})[_0x53bb('0x1b')](function(_0x196ecf){if(_0x196ecf){return _0x196ecf?{'count':_0x5b3e64,'rows':_0x196ecf}:null;}})[_0x53bb('0x1b')](respondWithResult(_0x3b7ebc,null))[_0x53bb('0x24')](handleError(_0x3b7ebc,null));};exports[_0x53bb('0x56')]=function(_0x1eb06c,_0x3063ef,_0x4c588b){var _0x21c9d8={};var _0x21a29a={};var _0x16d8f4;var _0x3bf5a5;return db[_0x53bb('0x35')][_0x53bb('0x57')]({'where':{'id':_0x1eb06c[_0x53bb('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3063ef,null))['then'](function(_0x1bacba){if(_0x1bacba){_0x16d8f4=_0x1bacba;_0x21a29a[_0x53bb('0x3e')]=_[_0x53bb('0x3b')](db[_0x53bb('0x58')][_0x53bb('0x36')]);_0x21a29a[_0x53bb('0x3a')]=_[_0x53bb('0x3b')](_0x1eb06c[_0x53bb('0x3a')]);_0x21a29a[_0x53bb('0x3c')]=_[_0x53bb('0x3d')](_0x21a29a[_0x53bb('0x3e')],_0x21a29a[_0x53bb('0x3a')]);_0x21c9d8['attributes']=_['intersection'](_0x21a29a[_0x53bb('0x3e')],qs[_0x53bb('0x40')](_0x1eb06c[_0x53bb('0x3a')][_0x53bb('0x40')]));_0x21c9d8[_0x53bb('0x3f')]=_0x21c9d8[_0x53bb('0x3f')][_0x53bb('0x41')]?_0x21c9d8[_0x53bb('0x3f')]:_0x21a29a[_0x53bb('0x3e')];_0x21c9d8[_0x53bb('0x43')]=qs[_0x53bb('0x44')](_0x1eb06c[_0x53bb('0x3a')][_0x53bb('0x44')]);_0x21c9d8['where']=qs['filters'](_[_0x53bb('0x46')](_0x1eb06c[_0x53bb('0x3a')],_0x21a29a[_0x53bb('0x3c')]));if(_0x1eb06c[_0x53bb('0x3a')][_0x53bb('0x47')]){_0x21c9d8['where']=_[_0x53bb('0x50')](_0x21c9d8[_0x53bb('0x45')],{'$or':_[_0x53bb('0x48')](_0x21c9d8[_0x53bb('0x3f')],function(_0x2f53b6){var _0x31659a={};_0x31659a[_0x2f53b6]={'$like':'%'+_0x1eb06c['query'][_0x53bb('0x47')]+'%'};return _0x31659a;})});}_0x21c9d8=_[_0x53bb('0x50')]({},_0x21c9d8,_0x1eb06c[_0x53bb('0x49')]);return _0x16d8f4['getSubjects'](_0x21c9d8);}})[_0x53bb('0x1b')](function(_0x1a1139){if(_0x1a1139){_0x3bf5a5=_0x1a1139[_0x53bb('0x41')];if(!_0x1eb06c[_0x53bb('0x3a')][_0x53bb('0x42')](_0x53bb('0x59'))){_0x21c9d8[_0x53bb('0x2a')]=qs[_0x53bb('0x2a')](_0x1eb06c[_0x53bb('0x3a')][_0x53bb('0x2a')]);_0x21c9d8['offset']=qs[_0x53bb('0x29')](_0x1eb06c['query'][_0x53bb('0x29')]);}return _0x16d8f4['getSubjects'](_0x21c9d8);}})['then'](function(_0x508699){if(_0x508699){return _0x508699?{'count':_0x3bf5a5,'rows':_0x508699}:null;}})[_0x53bb('0x1b')](respondWithResult(_0x3063ef,null))[_0x53bb('0x24')](handleError(_0x3063ef,null));};exports[_0x53bb('0x5a')]=function(_0x58a53a,_0x22716b,_0x12ac13){var _0x14206e={};var _0x364f6e={};var _0x4e29ed;var _0x2ed3f6;return db[_0x53bb('0x35')][_0x53bb('0x57')]({'where':{'id':_0x58a53a[_0x53bb('0x4f')]['id']}})[_0x53bb('0x1b')](handleEntityNotFound(_0x22716b,null))[_0x53bb('0x1b')](function(_0x577cb1){if(_0x577cb1){_0x4e29ed=_0x577cb1;_0x364f6e['model']=_[_0x53bb('0x3b')](db[_0x53bb('0x58')][_0x53bb('0x36')]);_0x364f6e[_0x53bb('0x3a')]=_['keys'](_0x58a53a[_0x53bb('0x3a')]);_0x364f6e[_0x53bb('0x3c')]=_[_0x53bb('0x3d')](_0x364f6e[_0x53bb('0x3e')],_0x364f6e[_0x53bb('0x3a')]);_0x14206e[_0x53bb('0x3f')]=_[_0x53bb('0x3d')](_0x364f6e['model'],qs[_0x53bb('0x40')](_0x58a53a[_0x53bb('0x3a')][_0x53bb('0x40')]));_0x14206e[_0x53bb('0x3f')]=_0x14206e[_0x53bb('0x3f')][_0x53bb('0x41')]?_0x14206e[_0x53bb('0x3f')]:_0x364f6e[_0x53bb('0x3e')];_0x14206e['order']=qs[_0x53bb('0x44')](_0x58a53a['query'][_0x53bb('0x44')]);_0x14206e[_0x53bb('0x45')]=qs[_0x53bb('0x3c')](_[_0x53bb('0x46')](_0x58a53a[_0x53bb('0x3a')],_0x364f6e['filters']));if(_0x58a53a[_0x53bb('0x3a')][_0x53bb('0x47')]){_0x14206e['where']=_[_0x53bb('0x50')](_0x14206e['where'],{'$or':_['map'](_0x14206e['attributes'],function(_0x50ed41){var _0x5e8287={};_0x5e8287[_0x50ed41]={'$like':'%'+_0x58a53a[_0x53bb('0x3a')][_0x53bb('0x47')]+'%'};return _0x5e8287;})});}_0x14206e=_[_0x53bb('0x50')]({},_0x14206e,_0x58a53a[_0x53bb('0x49')]);return _0x4e29ed['getDescriptions'](_0x14206e);}})[_0x53bb('0x1b')](function(_0xa5a6b8){if(_0xa5a6b8){_0x2ed3f6=_0xa5a6b8['length'];if(!_0x58a53a[_0x53bb('0x3a')][_0x53bb('0x42')](_0x53bb('0x59'))){_0x14206e[_0x53bb('0x2a')]=qs['limit'](_0x58a53a['query'][_0x53bb('0x2a')]);_0x14206e['offset']=qs[_0x53bb('0x29')](_0x58a53a[_0x53bb('0x3a')][_0x53bb('0x29')]);}return _0x4e29ed[_0x53bb('0x5a')](_0x14206e);}})[_0x53bb('0x1b')](function(_0x26b509){if(_0x26b509){return _0x26b509?{'count':_0x2ed3f6,'rows':_0x26b509}:null;}})[_0x53bb('0x1b')](respondWithResult(_0x22716b,null))[_0x53bb('0x24')](handleError(_0x22716b,null));};exports[_0x53bb('0x5b')]=function(_0x2b1c2f,_0x47a65a,_0x515462){var _0x2b8aa5={};var _0x2bcbb4={};var _0x50e43b;var _0x199e9e;return db[_0x53bb('0x35')]['findOne']({'where':{'id':_0x2b1c2f[_0x53bb('0x4f')]['id']}})['then'](handleEntityNotFound(_0x47a65a,null))[_0x53bb('0x1b')](function(_0x2afb98){if(_0x2afb98){_0x50e43b=_0x2afb98;_0x2bcbb4[_0x53bb('0x3e')]=_[_0x53bb('0x3b')](db[_0x53bb('0x5c')][_0x53bb('0x36')]);_0x2bcbb4[_0x53bb('0x3a')]=_[_0x53bb('0x3b')](_0x2b1c2f['query']);_0x2bcbb4[_0x53bb('0x3c')]=_[_0x53bb('0x3d')](_0x2bcbb4['model'],_0x2bcbb4[_0x53bb('0x3a')]);_0x2b8aa5[_0x53bb('0x3f')]=_[_0x53bb('0x3d')](_0x2bcbb4[_0x53bb('0x3e')],qs[_0x53bb('0x40')](_0x2b1c2f[_0x53bb('0x3a')][_0x53bb('0x40')]));_0x2b8aa5[_0x53bb('0x3f')]=_0x2b8aa5['attributes'][_0x53bb('0x41')]?_0x2b8aa5[_0x53bb('0x3f')]:_0x2bcbb4[_0x53bb('0x3e')];_0x2b8aa5[_0x53bb('0x43')]=qs[_0x53bb('0x44')](_0x2b1c2f[_0x53bb('0x3a')][_0x53bb('0x44')]);_0x2b8aa5[_0x53bb('0x45')]=qs[_0x53bb('0x3c')](_['pick'](_0x2b1c2f[_0x53bb('0x3a')],_0x2bcbb4[_0x53bb('0x3c')]));if(_0x2b1c2f[_0x53bb('0x3a')][_0x53bb('0x47')]){_0x2b8aa5[_0x53bb('0x45')]=_[_0x53bb('0x50')](_0x2b8aa5[_0x53bb('0x45')],{'$or':_[_0x53bb('0x48')](_0x2b8aa5['attributes'],function(_0x3f65b9){var _0x481fc0={};_0x481fc0[_0x3f65b9]={'$like':'%'+_0x2b1c2f[_0x53bb('0x3a')][_0x53bb('0x47')]+'%'};return _0x481fc0;})});}_0x2b8aa5=_[_0x53bb('0x50')]({},_0x2b8aa5,_0x2b1c2f[_0x53bb('0x49')]);return _0x50e43b['getTags'](_0x2b8aa5);}})[_0x53bb('0x1b')](function(_0x59970c){if(_0x59970c){_0x199e9e=_0x59970c[_0x53bb('0x41')];if(!_0x2b1c2f[_0x53bb('0x3a')][_0x53bb('0x42')](_0x53bb('0x59'))){_0x2b8aa5[_0x53bb('0x2a')]=qs[_0x53bb('0x2a')](_0x2b1c2f[_0x53bb('0x3a')][_0x53bb('0x2a')]);_0x2b8aa5[_0x53bb('0x29')]=qs[_0x53bb('0x29')](_0x2b1c2f[_0x53bb('0x3a')][_0x53bb('0x29')]);}return _0x50e43b[_0x53bb('0x5b')](_0x2b8aa5);}})[_0x53bb('0x1b')](function(_0x9c5b5){if(_0x9c5b5){return _0x9c5b5?{'count':_0x199e9e,'rows':_0x9c5b5}:null;}})[_0x53bb('0x1b')](respondWithResult(_0x47a65a,null))[_0x53bb('0x24')](handleError(_0x47a65a,null));};exports[_0x53bb('0x5d')]=function(_0x2dc6cd,_0x326d48,_0x480a59){if(_0x2dc6cd[_0x53bb('0x53')]['id']){delete _0x2dc6cd[_0x53bb('0x53')]['id'];}return db['DeskConfiguration'][_0x53bb('0x57')]({'where':{'id':_0x2dc6cd[_0x53bb('0x4f')]['id']}})[_0x53bb('0x1b')](handleEntityNotFound(_0x326d48,null))['then'](function(_0x81b945){if(_0x81b945){return _0x81b945[_0x53bb('0x5d')](_0x2dc6cd[_0x53bb('0x53')][_0x53bb('0x5e')]||[]);}return null;})['then'](respondWithResult(_0x326d48,null))['catch'](handleError(_0x326d48,null));};
\ No newline at end of file
+var _0xbfcf=['lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','limit','count','offset','set','reject','save','update','then','stack','name','send','index','map','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','DeskConfiguration','includeAll','include','findAll','catch','show','params','find','create','body','destroy','getFields','findOne','keys','DeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x218796,_0x4b4459){var _0x582796=function(_0x5a62e4){while(--_0x5a62e4){_0x218796['push'](_0x218796['shift']());}};_0x582796(++_0x4b4459);}(_0xbfcf,0x13d));var _0xfbfc=function(_0x1b6311,_0x42ec20){_0x1b6311=_0x1b6311-0x0;var _0x25aab6=_0xbfcf[_0x1b6311];return _0x25aab6;};'use strict';var emlformat=require(_0xfbfc('0x0'));var rimraf=require(_0xfbfc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfbfc('0x2'));var rp=require(_0xfbfc('0x3'));var moment=require('moment');var BPromise=require(_0xfbfc('0x4'));var Mustache=require(_0xfbfc('0x5'));var util=require(_0xfbfc('0x6'));var path=require(_0xfbfc('0x7'));var sox=require(_0xfbfc('0x8'));var csv=require(_0xfbfc('0x9'));var ejs=require(_0xfbfc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfbfc('0xb'));var squel=require('squel');var crypto=require(_0xfbfc('0xc'));var jsforce=require(_0xfbfc('0xd'));var deskjs=require(_0xfbfc('0xe'));var toCsv=require(_0xfbfc('0x9'));var querystring=require(_0xfbfc('0xf'));var Papa=require(_0xfbfc('0x10'));var Redis=require(_0xfbfc('0x11'));var authService=require(_0xfbfc('0x12'));var qs=require(_0xfbfc('0x13'));var as=require(_0xfbfc('0x14'));var hardwareService=require(_0xfbfc('0x15'));var logger=require(_0xfbfc('0x16'))(_0xfbfc('0x17'));var utils=require(_0xfbfc('0x18'));var config=require(_0xfbfc('0x19'));var licenseUtil=require(_0xfbfc('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x225336,_0x389a41){_0x389a41=_0x389a41||0xcc;return function(_0x23efa7){if(_0x23efa7){return _0x225336[_0xfbfc('0x1b')](_0x389a41);}return _0x225336[_0xfbfc('0x1c')](_0x389a41)[_0xfbfc('0x1d')]();};}function respondWithResult(_0x41fae9,_0x2e5852){_0x2e5852=_0x2e5852||0xc8;return function(_0x3f674f){if(_0x3f674f){return _0x41fae9[_0xfbfc('0x1c')](_0x2e5852)['json'](_0x3f674f);}};}function respondWithFilteredResult(_0x27620a,_0x1eda49){return function(_0x5234fc){if(_0x5234fc){var _0xb8318f=typeof _0x1eda49['offset']==='undefined'&&typeof _0x1eda49[_0xfbfc('0x1e')]==='undefined';var _0x39f056=_0x5234fc[_0xfbfc('0x1f')];var _0x401aba=_0xb8318f?0x0:_0x1eda49[_0xfbfc('0x20')];var _0x4964d0=_0xb8318f?_0x5234fc[_0xfbfc('0x1f')]:_0x1eda49['offset']+_0x1eda49[_0xfbfc('0x1e')];var _0x534db4;if(_0x4964d0>=_0x39f056){_0x4964d0=_0x39f056;_0x534db4=0xc8;}else{_0x534db4=0xce;}_0x27620a[_0xfbfc('0x1c')](_0x534db4);return _0x27620a[_0xfbfc('0x21')]('Content-Range',_0x401aba+'-'+_0x4964d0+'/'+_0x39f056)['json'](_0x5234fc);}return null;};}function patchUpdates(_0x2de8a2){return function(_0x125100){try{jsonpatch['apply'](_0x125100,_0x2de8a2,!![]);}catch(_0x515e60){return BPromise[_0xfbfc('0x22')](_0x515e60);}return _0x125100[_0xfbfc('0x23')]();};}function saveUpdates(_0x26df07,_0x5d365b){return function(_0x34fedb){if(_0x34fedb){return _0x34fedb[_0xfbfc('0x24')](_0x26df07)[_0xfbfc('0x25')](function(_0x2d7f61){return _0x2d7f61;});}return null;};}function removeEntity(_0x4321c2,_0x27954a){return function(_0x2af0b2){if(_0x2af0b2){return _0x2af0b2['destroy']()[_0xfbfc('0x25')](function(){_0x4321c2[_0xfbfc('0x1c')](0xcc)[_0xfbfc('0x1d')]();});}};}function handleEntityNotFound(_0x917c90,_0x3d501d){return function(_0xff8891){if(!_0xff8891){_0x917c90[_0xfbfc('0x1b')](0x194);}return _0xff8891;};}function handleError(_0x56a1f4,_0x595483){_0x595483=_0x595483||0x1f4;return function(_0x417822){logger['error'](_0x417822[_0xfbfc('0x26')]);if(_0x417822[_0xfbfc('0x27')]){delete _0x417822['name'];}_0x56a1f4[_0xfbfc('0x1c')](_0x595483)[_0xfbfc('0x28')](_0x417822);};}exports[_0xfbfc('0x29')]=function(_0x1b300f,_0x2a7282){var _0x1a295c={},_0x29e160={},_0x5332d1={'count':0x0,'rows':[]};var _0x5b5c45=_[_0xfbfc('0x2a')](db['DeskConfiguration'][_0xfbfc('0x2b')],function(_0x50cabb){return{'name':_0x50cabb['fieldName'],'type':_0x50cabb[_0xfbfc('0x2c')][_0xfbfc('0x2d')]};});_0x29e160[_0xfbfc('0x2e')]=_['map'](_0x5b5c45,_0xfbfc('0x27'));_0x29e160['query']=_['keys'](_0x1b300f[_0xfbfc('0x2f')]);_0x29e160['filters']=_['intersection'](_0x29e160['model'],_0x29e160[_0xfbfc('0x2f')]);_0x1a295c[_0xfbfc('0x30')]=_[_0xfbfc('0x31')](_0x29e160[_0xfbfc('0x2e')],qs[_0xfbfc('0x32')](_0x1b300f[_0xfbfc('0x2f')][_0xfbfc('0x32')]));_0x1a295c[_0xfbfc('0x30')]=_0x1a295c[_0xfbfc('0x30')][_0xfbfc('0x33')]?_0x1a295c[_0xfbfc('0x30')]:_0x29e160[_0xfbfc('0x2e')];if(!_0x1b300f[_0xfbfc('0x2f')][_0xfbfc('0x34')](_0xfbfc('0x35'))){_0x1a295c['limit']=qs[_0xfbfc('0x1e')](_0x1b300f[_0xfbfc('0x2f')][_0xfbfc('0x1e')]);_0x1a295c[_0xfbfc('0x20')]=qs[_0xfbfc('0x20')](_0x1b300f[_0xfbfc('0x2f')][_0xfbfc('0x20')]);}_0x1a295c[_0xfbfc('0x36')]=qs[_0xfbfc('0x37')](_0x1b300f[_0xfbfc('0x2f')]['sort']);_0x1a295c[_0xfbfc('0x38')]=qs[_0xfbfc('0x39')](_[_0xfbfc('0x3a')](_0x1b300f[_0xfbfc('0x2f')],_0x29e160['filters']),_0x5b5c45);if(_0x1b300f['query'][_0xfbfc('0x3b')]){_0x1a295c[_0xfbfc('0x38')]=_[_0xfbfc('0x3c')](_0x1a295c[_0xfbfc('0x38')],{'$or':_[_0xfbfc('0x2a')](_0x5b5c45,function(_0x49693e){if(_0x49693e[_0xfbfc('0x2c')]!=='VIRTUAL'){var _0x253825={};_0x253825[_0x49693e['name']]={'$like':'%'+_0x1b300f[_0xfbfc('0x2f')][_0xfbfc('0x3b')]+'%'};return _0x253825;}})});}_0x1a295c=_['merge']({},_0x1a295c,_0x1b300f[_0xfbfc('0x3d')]);var _0x103a5a={'where':_0x1a295c[_0xfbfc('0x38')]};return db[_0xfbfc('0x3e')][_0xfbfc('0x1f')](_0x103a5a)[_0xfbfc('0x25')](function(_0x12549e){_0x5332d1[_0xfbfc('0x1f')]=_0x12549e;if(_0x1b300f[_0xfbfc('0x2f')][_0xfbfc('0x3f')]){_0x1a295c[_0xfbfc('0x40')]=[{'all':!![]}];}return db[_0xfbfc('0x3e')][_0xfbfc('0x41')](_0x1a295c);})[_0xfbfc('0x25')](function(_0x125aa2){_0x5332d1['rows']=_0x125aa2;return _0x5332d1;})['then'](respondWithFilteredResult(_0x2a7282,_0x1a295c))[_0xfbfc('0x42')](handleError(_0x2a7282,null));};exports[_0xfbfc('0x43')]=function(_0x25f548,_0x3a84e0){var _0x15f493={'raw':![],'where':{'id':_0x25f548[_0xfbfc('0x44')]['id']}},_0x51fd75={};_0x51fd75['model']=_['keys'](db['DeskConfiguration'][_0xfbfc('0x2b')]);_0x51fd75[_0xfbfc('0x2f')]=_['keys'](_0x25f548[_0xfbfc('0x2f')]);_0x51fd75[_0xfbfc('0x39')]=_[_0xfbfc('0x31')](_0x51fd75[_0xfbfc('0x2e')],_0x51fd75[_0xfbfc('0x2f')]);_0x15f493['attributes']=_[_0xfbfc('0x31')](_0x51fd75[_0xfbfc('0x2e')],qs[_0xfbfc('0x32')](_0x25f548[_0xfbfc('0x2f')][_0xfbfc('0x32')]));_0x15f493[_0xfbfc('0x30')]=_0x15f493[_0xfbfc('0x30')]['length']?_0x15f493[_0xfbfc('0x30')]:_0x51fd75[_0xfbfc('0x2e')];if(_0x25f548['query'][_0xfbfc('0x3f')]){_0x15f493[_0xfbfc('0x40')]=[{'all':!![]}];}_0x15f493=_[_0xfbfc('0x3c')]({},_0x15f493,_0x25f548[_0xfbfc('0x3d')]);return db[_0xfbfc('0x3e')][_0xfbfc('0x45')](_0x15f493)[_0xfbfc('0x25')](handleEntityNotFound(_0x3a84e0,null))[_0xfbfc('0x25')](respondWithResult(_0x3a84e0,null))['catch'](handleError(_0x3a84e0,null));};exports[_0xfbfc('0x46')]=function(_0x50ef8b,_0x1e4216){return db['DeskConfiguration'][_0xfbfc('0x46')](_0x50ef8b['body'],{})[_0xfbfc('0x25')](respondWithResult(_0x1e4216,0xc9))['catch'](handleError(_0x1e4216,null));};exports['update']=function(_0x293265,_0x448e5f){if(_0x293265[_0xfbfc('0x47')]['id']){delete _0x293265['body']['id'];}return db[_0xfbfc('0x3e')][_0xfbfc('0x45')]({'where':{'id':_0x293265[_0xfbfc('0x44')]['id']}})[_0xfbfc('0x25')](handleEntityNotFound(_0x448e5f,null))[_0xfbfc('0x25')](saveUpdates(_0x293265[_0xfbfc('0x47')],null))[_0xfbfc('0x25')](respondWithResult(_0x448e5f,null))[_0xfbfc('0x42')](handleError(_0x448e5f,null));};exports[_0xfbfc('0x48')]=function(_0x10124b,_0x1b2281){return db['DeskConfiguration']['find']({'where':{'id':_0x10124b['params']['id']}})[_0xfbfc('0x25')](handleEntityNotFound(_0x1b2281,null))[_0xfbfc('0x25')](removeEntity(_0x1b2281,null))['catch'](handleError(_0x1b2281,null));};exports[_0xfbfc('0x49')]=function(_0x4e2725,_0x358497,_0xa10a70){var _0x5b66f7={};var _0x1a300b={};var _0x1f9e13;var _0x42f3b6;return db[_0xfbfc('0x3e')][_0xfbfc('0x4a')]({'where':{'id':_0x4e2725[_0xfbfc('0x44')]['id']}})['then'](handleEntityNotFound(_0x358497,null))[_0xfbfc('0x25')](function(_0x1f48fc){if(_0x1f48fc){_0x1f9e13=_0x1f48fc;_0x1a300b['model']=_[_0xfbfc('0x4b')](db[_0xfbfc('0x4c')][_0xfbfc('0x2b')]);_0x1a300b[_0xfbfc('0x2f')]=_['keys'](_0x4e2725['query']);_0x1a300b[_0xfbfc('0x39')]=_[_0xfbfc('0x31')](_0x1a300b[_0xfbfc('0x2e')],_0x1a300b['query']);_0x5b66f7[_0xfbfc('0x30')]=_[_0xfbfc('0x31')](_0x1a300b['model'],qs[_0xfbfc('0x32')](_0x4e2725[_0xfbfc('0x2f')][_0xfbfc('0x32')]));_0x5b66f7[_0xfbfc('0x30')]=_0x5b66f7[_0xfbfc('0x30')][_0xfbfc('0x33')]?_0x5b66f7[_0xfbfc('0x30')]:_0x1a300b[_0xfbfc('0x2e')];_0x5b66f7['order']=qs[_0xfbfc('0x37')](_0x4e2725[_0xfbfc('0x2f')][_0xfbfc('0x37')]);_0x5b66f7[_0xfbfc('0x38')]=qs[_0xfbfc('0x39')](_['pick'](_0x4e2725[_0xfbfc('0x2f')],_0x1a300b[_0xfbfc('0x39')]));if(_0x4e2725[_0xfbfc('0x2f')]['filter']){_0x5b66f7[_0xfbfc('0x38')]=_[_0xfbfc('0x3c')](_0x5b66f7[_0xfbfc('0x38')],{'$or':_['map'](_0x5b66f7[_0xfbfc('0x30')],function(_0x4dc329){var _0x4d2801={};_0x4d2801[_0x4dc329]={'$like':'%'+_0x4e2725['query']['filter']+'%'};return _0x4d2801;})});}_0x5b66f7=_[_0xfbfc('0x3c')]({},_0x5b66f7,_0x4e2725[_0xfbfc('0x3d')]);return _0x1f9e13[_0xfbfc('0x49')](_0x5b66f7);}})['then'](function(_0x9aacbd){if(_0x9aacbd){_0x42f3b6=_0x9aacbd[_0xfbfc('0x33')];if(!_0x4e2725[_0xfbfc('0x2f')][_0xfbfc('0x34')](_0xfbfc('0x35'))){_0x5b66f7['limit']=qs[_0xfbfc('0x1e')](_0x4e2725['query'][_0xfbfc('0x1e')]);_0x5b66f7[_0xfbfc('0x20')]=qs['offset'](_0x4e2725[_0xfbfc('0x2f')][_0xfbfc('0x20')]);}return _0x1f9e13[_0xfbfc('0x49')](_0x5b66f7);}})['then'](function(_0x2ad019){if(_0x2ad019){return _0x2ad019?{'count':_0x42f3b6,'rows':_0x2ad019}:null;}})[_0xfbfc('0x25')](respondWithResult(_0x358497,null))[_0xfbfc('0x42')](handleError(_0x358497,null));};exports['getSubjects']=function(_0x32958e,_0x1a920a,_0x7f84e4){var _0x128c9d={};var _0xe33fd5={};var _0x145966;var _0x2a9857;return db[_0xfbfc('0x3e')]['findOne']({'where':{'id':_0x32958e['params']['id']}})['then'](handleEntityNotFound(_0x1a920a,null))[_0xfbfc('0x25')](function(_0x1d181f){if(_0x1d181f){_0x145966=_0x1d181f;_0xe33fd5[_0xfbfc('0x2e')]=_[_0xfbfc('0x4b')](db[_0xfbfc('0x4c')]['rawAttributes']);_0xe33fd5[_0xfbfc('0x2f')]=_[_0xfbfc('0x4b')](_0x32958e[_0xfbfc('0x2f')]);_0xe33fd5['filters']=_[_0xfbfc('0x31')](_0xe33fd5['model'],_0xe33fd5[_0xfbfc('0x2f')]);_0x128c9d[_0xfbfc('0x30')]=_[_0xfbfc('0x31')](_0xe33fd5[_0xfbfc('0x2e')],qs['fields'](_0x32958e[_0xfbfc('0x2f')]['fields']));_0x128c9d[_0xfbfc('0x30')]=_0x128c9d['attributes'][_0xfbfc('0x33')]?_0x128c9d[_0xfbfc('0x30')]:_0xe33fd5['model'];_0x128c9d[_0xfbfc('0x36')]=qs[_0xfbfc('0x37')](_0x32958e[_0xfbfc('0x2f')][_0xfbfc('0x37')]);_0x128c9d[_0xfbfc('0x38')]=qs[_0xfbfc('0x39')](_[_0xfbfc('0x3a')](_0x32958e[_0xfbfc('0x2f')],_0xe33fd5['filters']));if(_0x32958e[_0xfbfc('0x2f')][_0xfbfc('0x3b')]){_0x128c9d[_0xfbfc('0x38')]=_[_0xfbfc('0x3c')](_0x128c9d[_0xfbfc('0x38')],{'$or':_[_0xfbfc('0x2a')](_0x128c9d[_0xfbfc('0x30')],function(_0x242dae){var _0x1955c1={};_0x1955c1[_0x242dae]={'$like':'%'+_0x32958e[_0xfbfc('0x2f')][_0xfbfc('0x3b')]+'%'};return _0x1955c1;})});}_0x128c9d=_[_0xfbfc('0x3c')]({},_0x128c9d,_0x32958e[_0xfbfc('0x3d')]);return _0x145966[_0xfbfc('0x4d')](_0x128c9d);}})[_0xfbfc('0x25')](function(_0xf0ec8b){if(_0xf0ec8b){_0x2a9857=_0xf0ec8b[_0xfbfc('0x33')];if(!_0x32958e[_0xfbfc('0x2f')][_0xfbfc('0x34')](_0xfbfc('0x35'))){_0x128c9d['limit']=qs[_0xfbfc('0x1e')](_0x32958e[_0xfbfc('0x2f')][_0xfbfc('0x1e')]);_0x128c9d[_0xfbfc('0x20')]=qs['offset'](_0x32958e['query'][_0xfbfc('0x20')]);}return _0x145966[_0xfbfc('0x4d')](_0x128c9d);}})[_0xfbfc('0x25')](function(_0x427caa){if(_0x427caa){return _0x427caa?{'count':_0x2a9857,'rows':_0x427caa}:null;}})[_0xfbfc('0x25')](respondWithResult(_0x1a920a,null))[_0xfbfc('0x42')](handleError(_0x1a920a,null));};exports[_0xfbfc('0x4e')]=function(_0x55bd26,_0x4bb8bb,_0x54342f){var _0x2e9477={};var _0x1759a2={};var _0x577564;var _0x59d18e;return db[_0xfbfc('0x3e')][_0xfbfc('0x4a')]({'where':{'id':_0x55bd26[_0xfbfc('0x44')]['id']}})[_0xfbfc('0x25')](handleEntityNotFound(_0x4bb8bb,null))['then'](function(_0x1ca179){if(_0x1ca179){_0x577564=_0x1ca179;_0x1759a2[_0xfbfc('0x2e')]=_[_0xfbfc('0x4b')](db[_0xfbfc('0x4c')]['rawAttributes']);_0x1759a2[_0xfbfc('0x2f')]=_[_0xfbfc('0x4b')](_0x55bd26[_0xfbfc('0x2f')]);_0x1759a2[_0xfbfc('0x39')]=_[_0xfbfc('0x31')](_0x1759a2[_0xfbfc('0x2e')],_0x1759a2['query']);_0x2e9477[_0xfbfc('0x30')]=_[_0xfbfc('0x31')](_0x1759a2[_0xfbfc('0x2e')],qs['fields'](_0x55bd26[_0xfbfc('0x2f')][_0xfbfc('0x32')]));_0x2e9477[_0xfbfc('0x30')]=_0x2e9477[_0xfbfc('0x30')][_0xfbfc('0x33')]?_0x2e9477[_0xfbfc('0x30')]:_0x1759a2[_0xfbfc('0x2e')];_0x2e9477[_0xfbfc('0x36')]=qs[_0xfbfc('0x37')](_0x55bd26[_0xfbfc('0x2f')][_0xfbfc('0x37')]);_0x2e9477['where']=qs[_0xfbfc('0x39')](_[_0xfbfc('0x3a')](_0x55bd26[_0xfbfc('0x2f')],_0x1759a2[_0xfbfc('0x39')]));if(_0x55bd26[_0xfbfc('0x2f')][_0xfbfc('0x3b')]){_0x2e9477[_0xfbfc('0x38')]=_[_0xfbfc('0x3c')](_0x2e9477[_0xfbfc('0x38')],{'$or':_[_0xfbfc('0x2a')](_0x2e9477[_0xfbfc('0x30')],function(_0x4b1805){var _0x291301={};_0x291301[_0x4b1805]={'$like':'%'+_0x55bd26[_0xfbfc('0x2f')][_0xfbfc('0x3b')]+'%'};return _0x291301;})});}_0x2e9477=_[_0xfbfc('0x3c')]({},_0x2e9477,_0x55bd26['options']);return _0x577564[_0xfbfc('0x4e')](_0x2e9477);}})[_0xfbfc('0x25')](function(_0x5a1fba){if(_0x5a1fba){_0x59d18e=_0x5a1fba[_0xfbfc('0x33')];if(!_0x55bd26[_0xfbfc('0x2f')]['hasOwnProperty'](_0xfbfc('0x35'))){_0x2e9477[_0xfbfc('0x1e')]=qs[_0xfbfc('0x1e')](_0x55bd26[_0xfbfc('0x2f')][_0xfbfc('0x1e')]);_0x2e9477[_0xfbfc('0x20')]=qs[_0xfbfc('0x20')](_0x55bd26['query']['offset']);}return _0x577564[_0xfbfc('0x4e')](_0x2e9477);}})[_0xfbfc('0x25')](function(_0x4164aa){if(_0x4164aa){return _0x4164aa?{'count':_0x59d18e,'rows':_0x4164aa}:null;}})[_0xfbfc('0x25')](respondWithResult(_0x4bb8bb,null))['catch'](handleError(_0x4bb8bb,null));};exports[_0xfbfc('0x4f')]=function(_0x230019,_0x3c8870,_0x2023b5){var _0x51db4b={};var _0x2404cd={};var _0x3e473c;var _0x2489be;return db[_0xfbfc('0x3e')][_0xfbfc('0x4a')]({'where':{'id':_0x230019[_0xfbfc('0x44')]['id']}})[_0xfbfc('0x25')](handleEntityNotFound(_0x3c8870,null))[_0xfbfc('0x25')](function(_0x23249f){if(_0x23249f){_0x3e473c=_0x23249f;_0x2404cd[_0xfbfc('0x2e')]=_['keys'](db['Tag'][_0xfbfc('0x2b')]);_0x2404cd[_0xfbfc('0x2f')]=_['keys'](_0x230019['query']);_0x2404cd['filters']=_['intersection'](_0x2404cd[_0xfbfc('0x2e')],_0x2404cd['query']);_0x51db4b[_0xfbfc('0x30')]=_['intersection'](_0x2404cd[_0xfbfc('0x2e')],qs['fields'](_0x230019[_0xfbfc('0x2f')]['fields']));_0x51db4b['attributes']=_0x51db4b['attributes'][_0xfbfc('0x33')]?_0x51db4b[_0xfbfc('0x30')]:_0x2404cd['model'];_0x51db4b[_0xfbfc('0x36')]=qs['sort'](_0x230019['query']['sort']);_0x51db4b['where']=qs['filters'](_[_0xfbfc('0x3a')](_0x230019[_0xfbfc('0x2f')],_0x2404cd[_0xfbfc('0x39')]));if(_0x230019[_0xfbfc('0x2f')]['filter']){_0x51db4b[_0xfbfc('0x38')]=_[_0xfbfc('0x3c')](_0x51db4b[_0xfbfc('0x38')],{'$or':_[_0xfbfc('0x2a')](_0x51db4b['attributes'],function(_0x1079cf){var _0x5bbf1b={};_0x5bbf1b[_0x1079cf]={'$like':'%'+_0x230019[_0xfbfc('0x2f')][_0xfbfc('0x3b')]+'%'};return _0x5bbf1b;})});}_0x51db4b=_[_0xfbfc('0x3c')]({},_0x51db4b,_0x230019[_0xfbfc('0x3d')]);return _0x3e473c[_0xfbfc('0x4f')](_0x51db4b);}})[_0xfbfc('0x25')](function(_0xdf5312){if(_0xdf5312){_0x2489be=_0xdf5312[_0xfbfc('0x33')];if(!_0x230019['query'][_0xfbfc('0x34')](_0xfbfc('0x35'))){_0x51db4b[_0xfbfc('0x1e')]=qs[_0xfbfc('0x1e')](_0x230019['query'][_0xfbfc('0x1e')]);_0x51db4b['offset']=qs['offset'](_0x230019['query']['offset']);}return _0x3e473c['getTags'](_0x51db4b);}})[_0xfbfc('0x25')](function(_0x416571){if(_0x416571){return _0x416571?{'count':_0x2489be,'rows':_0x416571}:null;}})[_0xfbfc('0x25')](respondWithResult(_0x3c8870,null))[_0xfbfc('0x42')](handleError(_0x3c8870,null));};exports[_0xfbfc('0x50')]=function(_0x41776e,_0xe012b6,_0x406049){if(_0x41776e['body']['id']){delete _0x41776e[_0xfbfc('0x47')]['id'];}return db[_0xfbfc('0x3e')][_0xfbfc('0x4a')]({'where':{'id':_0x41776e[_0xfbfc('0x44')]['id']}})[_0xfbfc('0x25')](handleEntityNotFound(_0xe012b6,null))[_0xfbfc('0x25')](function(_0x27ce00){if(_0x27ce00){return _0x27ce00['setTags'](_0x41776e['body'][_0xfbfc('0x51')]||[]);}return null;})['then'](respondWithResult(_0xe012b6,null))[_0xfbfc('0x42')](handleError(_0xe012b6,null));};
\ No newline at end of file