Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / intDeskConfiguration / intDeskConfiguration.controller.js
index 2ea7e98..b038f27 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf6d9=['error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','catch','show','params','find','create','body','update','getFields','hasOwnProperty','findOne','pick','getSubjects','getDescriptions','DeskField','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','then'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0xf6d9,0x13a));var _0x9f6d=function(_0x5c5c87,_0xfeceb3){_0x5c5c87=_0x5c5c87-0x0;var _0xd83eee=_0xf6d9[_0x5c5c87];return _0xd83eee;};'use strict';var emlformat=require(_0x9f6d('0x0'));var rimraf=require(_0x9f6d('0x1'));var zipdir=require(_0x9f6d('0x2'));var jsonpatch=require(_0x9f6d('0x3'));var rp=require(_0x9f6d('0x4'));var moment=require('moment');var BPromise=require(_0x9f6d('0x5'));var Mustache=require('mustache');var util=require(_0x9f6d('0x6'));var path=require(_0x9f6d('0x7'));var sox=require(_0x9f6d('0x8'));var csv=require(_0x9f6d('0x9'));var ejs=require(_0x9f6d('0xa'));var fs=require('fs');var fs_extra=require(_0x9f6d('0xb'));var _=require(_0x9f6d('0xc'));var squel=require(_0x9f6d('0xd'));var crypto=require(_0x9f6d('0xe'));var jsforce=require(_0x9f6d('0xf'));var deskjs=require(_0x9f6d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9f6d('0x11'));var Papa=require(_0x9f6d('0x12'));var Redis=require('ioredis');var authService=require(_0x9f6d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9f6d('0x14'));var hardwareService=require(_0x9f6d('0x15'));var logger=require(_0x9f6d('0x16'))(_0x9f6d('0x17'));var utils=require(_0x9f6d('0x18'));var config=require(_0x9f6d('0x19'));var licenseUtil=require(_0x9f6d('0x1a'));var db=require(_0x9f6d('0x1b'))['db'];function respondWithStatusCode(_0x8de2af,_0x50acc6){_0x50acc6=_0x50acc6||0xcc;return function(_0x15ad04){if(_0x15ad04){return _0x8de2af[_0x9f6d('0x1c')](_0x50acc6);}return _0x8de2af['status'](_0x50acc6)[_0x9f6d('0x1d')]();};}function respondWithResult(_0x1a5357,_0x45334d){_0x45334d=_0x45334d||0xc8;return function(_0x3a4517){if(_0x3a4517){return _0x1a5357['status'](_0x45334d)[_0x9f6d('0x1e')](_0x3a4517);}};}function respondWithFilteredResult(_0x25634c,_0x3a6282){return function(_0x108719){if(_0x108719){var _0x2a8299=typeof _0x3a6282[_0x9f6d('0x1f')]===_0x9f6d('0x20')&&typeof _0x3a6282['limit']===_0x9f6d('0x20');var _0x1c36fa=_0x108719['count'];var _0x135fa2=_0x2a8299?0x0:_0x3a6282[_0x9f6d('0x1f')];var _0x2a3167=_0x2a8299?_0x108719[_0x9f6d('0x21')]:_0x3a6282[_0x9f6d('0x1f')]+_0x3a6282[_0x9f6d('0x22')];var _0x5e953c;if(_0x2a3167>=_0x1c36fa){_0x2a3167=_0x1c36fa;_0x5e953c=0xc8;}else{_0x5e953c=0xce;}_0x25634c[_0x9f6d('0x23')](_0x5e953c);return _0x25634c[_0x9f6d('0x24')](_0x9f6d('0x25'),_0x135fa2+'-'+_0x2a3167+'/'+_0x1c36fa)[_0x9f6d('0x1e')](_0x108719);}return null;};}function patchUpdates(_0x19c030){return function(_0x4b062b){try{jsonpatch[_0x9f6d('0x26')](_0x4b062b,_0x19c030,!![]);}catch(_0x34f76f){return BPromise[_0x9f6d('0x27')](_0x34f76f);}return _0x4b062b[_0x9f6d('0x28')]();};}function saveUpdates(_0x39ed3b,_0x19b61b){return function(_0x281687){if(_0x281687){return _0x281687['update'](_0x39ed3b)[_0x9f6d('0x29')](function(_0x1baa1a){return _0x1baa1a;});}return null;};}function removeEntity(_0x51858e,_0x51148f){return function(_0x21705e){if(_0x21705e){return _0x21705e['destroy']()[_0x9f6d('0x29')](function(){_0x51858e[_0x9f6d('0x23')](0xcc)[_0x9f6d('0x1d')]();});}};}function handleEntityNotFound(_0x2e062,_0xac076c){return function(_0x49ea83){if(!_0x49ea83){_0x2e062[_0x9f6d('0x1c')](0x194);}return _0x49ea83;};}function handleError(_0x1d62ce,_0x39dc8b){_0x39dc8b=_0x39dc8b||0x1f4;return function(_0x11909b){logger[_0x9f6d('0x2a')](_0x11909b[_0x9f6d('0x2b')]);if(_0x11909b[_0x9f6d('0x2c')]){delete _0x11909b[_0x9f6d('0x2c')];}_0x1d62ce[_0x9f6d('0x23')](_0x39dc8b)[_0x9f6d('0x2d')](_0x11909b);};}exports[_0x9f6d('0x2e')]=function(_0x3f884c,_0x102bc2){var _0x2ad2a2={},_0x5506ba={},_0x2ca80e={'count':0x0,'rows':[]};var _0x3caf07=_['map'](db['DeskConfiguration'][_0x9f6d('0x2f')],function(_0x522e8f){return{'name':_0x522e8f[_0x9f6d('0x30')],'type':_0x522e8f[_0x9f6d('0x31')][_0x9f6d('0x32')]};});_0x5506ba['model']=_[_0x9f6d('0x33')](_0x3caf07,_0x9f6d('0x2c'));_0x5506ba[_0x9f6d('0x34')]=_[_0x9f6d('0x35')](_0x3f884c[_0x9f6d('0x34')]);_0x5506ba['filters']=_[_0x9f6d('0x36')](_0x5506ba[_0x9f6d('0x37')],_0x5506ba[_0x9f6d('0x34')]);_0x2ad2a2[_0x9f6d('0x38')]=_[_0x9f6d('0x36')](_0x5506ba[_0x9f6d('0x37')],qs[_0x9f6d('0x39')](_0x3f884c[_0x9f6d('0x34')][_0x9f6d('0x39')]));_0x2ad2a2[_0x9f6d('0x38')]=_0x2ad2a2[_0x9f6d('0x38')][_0x9f6d('0x3a')]?_0x2ad2a2[_0x9f6d('0x38')]:_0x5506ba[_0x9f6d('0x37')];if(!_0x3f884c['query']['hasOwnProperty'](_0x9f6d('0x3b'))){_0x2ad2a2[_0x9f6d('0x22')]=qs['limit'](_0x3f884c[_0x9f6d('0x34')][_0x9f6d('0x22')]);_0x2ad2a2[_0x9f6d('0x1f')]=qs[_0x9f6d('0x1f')](_0x3f884c['query'][_0x9f6d('0x1f')]);}_0x2ad2a2[_0x9f6d('0x3c')]=qs['sort'](_0x3f884c['query'][_0x9f6d('0x3d')]);_0x2ad2a2[_0x9f6d('0x3e')]=qs['filters'](_['pick'](_0x3f884c['query'],_0x5506ba[_0x9f6d('0x3f')]),_0x3caf07);if(_0x3f884c[_0x9f6d('0x34')][_0x9f6d('0x40')]){_0x2ad2a2['where']=_[_0x9f6d('0x41')](_0x2ad2a2['where'],{'$or':_[_0x9f6d('0x33')](_0x3caf07,function(_0x3e9ca0){if(_0x3e9ca0[_0x9f6d('0x31')]!==_0x9f6d('0x42')){var _0x531378={};_0x531378[_0x3e9ca0['name']]={'$like':'%'+_0x3f884c[_0x9f6d('0x34')][_0x9f6d('0x40')]+'%'};return _0x531378;}})});}_0x2ad2a2=_['merge']({},_0x2ad2a2,_0x3f884c[_0x9f6d('0x43')]);var _0x527370={'where':_0x2ad2a2['where']};return db[_0x9f6d('0x44')][_0x9f6d('0x21')](_0x527370)[_0x9f6d('0x29')](function(_0x139402){_0x2ca80e[_0x9f6d('0x21')]=_0x139402;if(_0x3f884c[_0x9f6d('0x34')][_0x9f6d('0x45')]){_0x2ad2a2[_0x9f6d('0x46')]=[{'all':!![]}];}return db[_0x9f6d('0x44')][_0x9f6d('0x47')](_0x2ad2a2);})[_0x9f6d('0x29')](function(_0x1987fa){_0x2ca80e['rows']=_0x1987fa;return _0x2ca80e;})['then'](respondWithFilteredResult(_0x102bc2,_0x2ad2a2))[_0x9f6d('0x48')](handleError(_0x102bc2,null));};exports[_0x9f6d('0x49')]=function(_0x45dad7,_0x56c004){var _0x405fcf={'raw':![],'where':{'id':_0x45dad7[_0x9f6d('0x4a')]['id']}},_0x3a4972={};_0x3a4972[_0x9f6d('0x37')]=_[_0x9f6d('0x35')](db['DeskConfiguration'][_0x9f6d('0x2f')]);_0x3a4972['query']=_[_0x9f6d('0x35')](_0x45dad7[_0x9f6d('0x34')]);_0x3a4972[_0x9f6d('0x3f')]=_[_0x9f6d('0x36')](_0x3a4972[_0x9f6d('0x37')],_0x3a4972['query']);_0x405fcf[_0x9f6d('0x38')]=_[_0x9f6d('0x36')](_0x3a4972['model'],qs['fields'](_0x45dad7[_0x9f6d('0x34')][_0x9f6d('0x39')]));_0x405fcf['attributes']=_0x405fcf[_0x9f6d('0x38')][_0x9f6d('0x3a')]?_0x405fcf[_0x9f6d('0x38')]:_0x3a4972['model'];if(_0x45dad7['query'][_0x9f6d('0x45')]){_0x405fcf[_0x9f6d('0x46')]=[{'all':!![]}];}_0x405fcf=_[_0x9f6d('0x41')]({},_0x405fcf,_0x45dad7['options']);return db[_0x9f6d('0x44')][_0x9f6d('0x4b')](_0x405fcf)[_0x9f6d('0x29')](handleEntityNotFound(_0x56c004,null))['then'](respondWithResult(_0x56c004,null))[_0x9f6d('0x48')](handleError(_0x56c004,null));};exports[_0x9f6d('0x4c')]=function(_0x9c9da2,_0x284214){return db[_0x9f6d('0x44')][_0x9f6d('0x4c')](_0x9c9da2[_0x9f6d('0x4d')],{})['then'](respondWithResult(_0x284214,0xc9))[_0x9f6d('0x48')](handleError(_0x284214,null));};exports[_0x9f6d('0x4e')]=function(_0x5c8dd4,_0x1b62e7){if(_0x5c8dd4[_0x9f6d('0x4d')]['id']){delete _0x5c8dd4['body']['id'];}return db['DeskConfiguration'][_0x9f6d('0x4b')]({'where':{'id':_0x5c8dd4[_0x9f6d('0x4a')]['id']}})[_0x9f6d('0x29')](handleEntityNotFound(_0x1b62e7,null))[_0x9f6d('0x29')](saveUpdates(_0x5c8dd4[_0x9f6d('0x4d')],null))[_0x9f6d('0x29')](respondWithResult(_0x1b62e7,null))[_0x9f6d('0x48')](handleError(_0x1b62e7,null));};exports['destroy']=function(_0x26e8ab,_0x3521d3){return db[_0x9f6d('0x44')][_0x9f6d('0x4b')]({'where':{'id':_0x26e8ab[_0x9f6d('0x4a')]['id']}})[_0x9f6d('0x29')](handleEntityNotFound(_0x3521d3,null))[_0x9f6d('0x29')](removeEntity(_0x3521d3,null))[_0x9f6d('0x48')](handleError(_0x3521d3,null));};exports[_0x9f6d('0x4f')]=function(_0x5ac316,_0xd1f4bb,_0x4a334c){var _0x3f22f9={};var _0x1284fc={};var _0x7fccfe;var _0x42b23f;return db[_0x9f6d('0x44')]['findOne']({'where':{'id':_0x5ac316[_0x9f6d('0x4a')]['id']}})[_0x9f6d('0x29')](handleEntityNotFound(_0xd1f4bb,null))[_0x9f6d('0x29')](function(_0x2c6780){if(_0x2c6780){_0x7fccfe=_0x2c6780;_0x1284fc[_0x9f6d('0x37')]=_['keys'](db['DeskField'][_0x9f6d('0x2f')]);_0x1284fc[_0x9f6d('0x34')]=_[_0x9f6d('0x35')](_0x5ac316[_0x9f6d('0x34')]);_0x1284fc['filters']=_['intersection'](_0x1284fc[_0x9f6d('0x37')],_0x1284fc[_0x9f6d('0x34')]);_0x3f22f9[_0x9f6d('0x38')]=_['intersection'](_0x1284fc['model'],qs[_0x9f6d('0x39')](_0x5ac316['query']['fields']));_0x3f22f9[_0x9f6d('0x38')]=_0x3f22f9[_0x9f6d('0x38')][_0x9f6d('0x3a')]?_0x3f22f9[_0x9f6d('0x38')]:_0x1284fc[_0x9f6d('0x37')];_0x3f22f9[_0x9f6d('0x3c')]=qs[_0x9f6d('0x3d')](_0x5ac316[_0x9f6d('0x34')][_0x9f6d('0x3d')]);_0x3f22f9[_0x9f6d('0x3e')]=qs[_0x9f6d('0x3f')](_['pick'](_0x5ac316[_0x9f6d('0x34')],_0x1284fc[_0x9f6d('0x3f')]));if(_0x5ac316['query'][_0x9f6d('0x40')]){_0x3f22f9[_0x9f6d('0x3e')]=_[_0x9f6d('0x41')](_0x3f22f9[_0x9f6d('0x3e')],{'$or':_[_0x9f6d('0x33')](_0x3f22f9[_0x9f6d('0x38')],function(_0x20b62b){var _0x36e566={};_0x36e566[_0x20b62b]={'$like':'%'+_0x5ac316[_0x9f6d('0x34')][_0x9f6d('0x40')]+'%'};return _0x36e566;})});}_0x3f22f9=_[_0x9f6d('0x41')]({},_0x3f22f9,_0x5ac316['options']);return _0x7fccfe[_0x9f6d('0x4f')](_0x3f22f9);}})[_0x9f6d('0x29')](function(_0x42208b){if(_0x42208b){_0x42b23f=_0x42208b['length'];if(!_0x5ac316[_0x9f6d('0x34')][_0x9f6d('0x50')](_0x9f6d('0x3b'))){_0x3f22f9[_0x9f6d('0x22')]=qs[_0x9f6d('0x22')](_0x5ac316[_0x9f6d('0x34')]['limit']);_0x3f22f9[_0x9f6d('0x1f')]=qs['offset'](_0x5ac316[_0x9f6d('0x34')][_0x9f6d('0x1f')]);}return _0x7fccfe[_0x9f6d('0x4f')](_0x3f22f9);}})[_0x9f6d('0x29')](function(_0x229829){if(_0x229829){return _0x229829?{'count':_0x42b23f,'rows':_0x229829}:null;}})[_0x9f6d('0x29')](respondWithResult(_0xd1f4bb,null))[_0x9f6d('0x48')](handleError(_0xd1f4bb,null));};exports['getSubjects']=function(_0x1cffb1,_0x25e896,_0x5bb8b7){var _0x5d8a4d={};var _0x1dddf2={};var _0x5b4141;var _0x53b343;return db['DeskConfiguration'][_0x9f6d('0x51')]({'where':{'id':_0x1cffb1['params']['id']}})[_0x9f6d('0x29')](handleEntityNotFound(_0x25e896,null))[_0x9f6d('0x29')](function(_0x5d23f6){if(_0x5d23f6){_0x5b4141=_0x5d23f6;_0x1dddf2[_0x9f6d('0x37')]=_[_0x9f6d('0x35')](db['DeskField'][_0x9f6d('0x2f')]);_0x1dddf2['query']=_[_0x9f6d('0x35')](_0x1cffb1[_0x9f6d('0x34')]);_0x1dddf2[_0x9f6d('0x3f')]=_[_0x9f6d('0x36')](_0x1dddf2['model'],_0x1dddf2[_0x9f6d('0x34')]);_0x5d8a4d[_0x9f6d('0x38')]=_[_0x9f6d('0x36')](_0x1dddf2[_0x9f6d('0x37')],qs['fields'](_0x1cffb1[_0x9f6d('0x34')][_0x9f6d('0x39')]));_0x5d8a4d[_0x9f6d('0x38')]=_0x5d8a4d[_0x9f6d('0x38')][_0x9f6d('0x3a')]?_0x5d8a4d[_0x9f6d('0x38')]:_0x1dddf2['model'];_0x5d8a4d[_0x9f6d('0x3c')]=qs[_0x9f6d('0x3d')](_0x1cffb1[_0x9f6d('0x34')][_0x9f6d('0x3d')]);_0x5d8a4d[_0x9f6d('0x3e')]=qs[_0x9f6d('0x3f')](_[_0x9f6d('0x52')](_0x1cffb1[_0x9f6d('0x34')],_0x1dddf2[_0x9f6d('0x3f')]));if(_0x1cffb1[_0x9f6d('0x34')]['filter']){_0x5d8a4d['where']=_[_0x9f6d('0x41')](_0x5d8a4d[_0x9f6d('0x3e')],{'$or':_[_0x9f6d('0x33')](_0x5d8a4d['attributes'],function(_0x4b1334){var _0x3e0c87={};_0x3e0c87[_0x4b1334]={'$like':'%'+_0x1cffb1[_0x9f6d('0x34')][_0x9f6d('0x40')]+'%'};return _0x3e0c87;})});}_0x5d8a4d=_[_0x9f6d('0x41')]({},_0x5d8a4d,_0x1cffb1[_0x9f6d('0x43')]);return _0x5b4141['getSubjects'](_0x5d8a4d);}})[_0x9f6d('0x29')](function(_0xf0969c){if(_0xf0969c){_0x53b343=_0xf0969c['length'];if(!_0x1cffb1[_0x9f6d('0x34')][_0x9f6d('0x50')]('nolimit')){_0x5d8a4d['limit']=qs[_0x9f6d('0x22')](_0x1cffb1[_0x9f6d('0x34')][_0x9f6d('0x22')]);_0x5d8a4d[_0x9f6d('0x1f')]=qs['offset'](_0x1cffb1[_0x9f6d('0x34')][_0x9f6d('0x1f')]);}return _0x5b4141[_0x9f6d('0x53')](_0x5d8a4d);}})['then'](function(_0x42c4de){if(_0x42c4de){return _0x42c4de?{'count':_0x53b343,'rows':_0x42c4de}:null;}})['then'](respondWithResult(_0x25e896,null))[_0x9f6d('0x48')](handleError(_0x25e896,null));};exports[_0x9f6d('0x54')]=function(_0x1b1fd9,_0x5361f2,_0x4d7eea){var _0x2d7356={};var _0x520567={};var _0x4ee590;var _0x4f3da2;return db[_0x9f6d('0x44')][_0x9f6d('0x51')]({'where':{'id':_0x1b1fd9[_0x9f6d('0x4a')]['id']}})[_0x9f6d('0x29')](handleEntityNotFound(_0x5361f2,null))[_0x9f6d('0x29')](function(_0x214f84){if(_0x214f84){_0x4ee590=_0x214f84;_0x520567['model']=_[_0x9f6d('0x35')](db[_0x9f6d('0x55')][_0x9f6d('0x2f')]);_0x520567[_0x9f6d('0x34')]=_['keys'](_0x1b1fd9['query']);_0x520567[_0x9f6d('0x3f')]=_[_0x9f6d('0x36')](_0x520567[_0x9f6d('0x37')],_0x520567[_0x9f6d('0x34')]);_0x2d7356['attributes']=_['intersection'](_0x520567[_0x9f6d('0x37')],qs[_0x9f6d('0x39')](_0x1b1fd9[_0x9f6d('0x34')][_0x9f6d('0x39')]));_0x2d7356['attributes']=_0x2d7356[_0x9f6d('0x38')][_0x9f6d('0x3a')]?_0x2d7356['attributes']:_0x520567['model'];_0x2d7356[_0x9f6d('0x3c')]=qs['sort'](_0x1b1fd9[_0x9f6d('0x34')][_0x9f6d('0x3d')]);_0x2d7356[_0x9f6d('0x3e')]=qs[_0x9f6d('0x3f')](_[_0x9f6d('0x52')](_0x1b1fd9[_0x9f6d('0x34')],_0x520567[_0x9f6d('0x3f')]));if(_0x1b1fd9[_0x9f6d('0x34')]['filter']){_0x2d7356[_0x9f6d('0x3e')]=_[_0x9f6d('0x41')](_0x2d7356[_0x9f6d('0x3e')],{'$or':_[_0x9f6d('0x33')](_0x2d7356[_0x9f6d('0x38')],function(_0x46e290){var _0x545b2d={};_0x545b2d[_0x46e290]={'$like':'%'+_0x1b1fd9[_0x9f6d('0x34')][_0x9f6d('0x40')]+'%'};return _0x545b2d;})});}_0x2d7356=_[_0x9f6d('0x41')]({},_0x2d7356,_0x1b1fd9[_0x9f6d('0x43')]);return _0x4ee590[_0x9f6d('0x54')](_0x2d7356);}})[_0x9f6d('0x29')](function(_0x3c8009){if(_0x3c8009){_0x4f3da2=_0x3c8009['length'];if(!_0x1b1fd9[_0x9f6d('0x34')]['hasOwnProperty'](_0x9f6d('0x3b'))){_0x2d7356[_0x9f6d('0x22')]=qs['limit'](_0x1b1fd9[_0x9f6d('0x34')][_0x9f6d('0x22')]);_0x2d7356[_0x9f6d('0x1f')]=qs[_0x9f6d('0x1f')](_0x1b1fd9[_0x9f6d('0x34')][_0x9f6d('0x1f')]);}return _0x4ee590['getDescriptions'](_0x2d7356);}})[_0x9f6d('0x29')](function(_0x45c048){if(_0x45c048){return _0x45c048?{'count':_0x4f3da2,'rows':_0x45c048}:null;}})[_0x9f6d('0x29')](respondWithResult(_0x5361f2,null))[_0x9f6d('0x48')](handleError(_0x5361f2,null));};exports[_0x9f6d('0x56')]=function(_0x52b8d7,_0x4f6933,_0x291f14){var _0x460f06={};var _0x52ba5c={};var _0x4f0f87;var _0x4aa6ad;return db[_0x9f6d('0x44')][_0x9f6d('0x51')]({'where':{'id':_0x52b8d7[_0x9f6d('0x4a')]['id']}})[_0x9f6d('0x29')](handleEntityNotFound(_0x4f6933,null))[_0x9f6d('0x29')](function(_0x18e367){if(_0x18e367){_0x4f0f87=_0x18e367;_0x52ba5c[_0x9f6d('0x37')]=_['keys'](db['Tag'][_0x9f6d('0x2f')]);_0x52ba5c['query']=_[_0x9f6d('0x35')](_0x52b8d7[_0x9f6d('0x34')]);_0x52ba5c[_0x9f6d('0x3f')]=_['intersection'](_0x52ba5c[_0x9f6d('0x37')],_0x52ba5c['query']);_0x460f06[_0x9f6d('0x38')]=_[_0x9f6d('0x36')](_0x52ba5c['model'],qs[_0x9f6d('0x39')](_0x52b8d7[_0x9f6d('0x34')][_0x9f6d('0x39')]));_0x460f06[_0x9f6d('0x38')]=_0x460f06['attributes'][_0x9f6d('0x3a')]?_0x460f06[_0x9f6d('0x38')]:_0x52ba5c[_0x9f6d('0x37')];_0x460f06['order']=qs['sort'](_0x52b8d7['query'][_0x9f6d('0x3d')]);_0x460f06['where']=qs[_0x9f6d('0x3f')](_[_0x9f6d('0x52')](_0x52b8d7['query'],_0x52ba5c[_0x9f6d('0x3f')]));if(_0x52b8d7[_0x9f6d('0x34')][_0x9f6d('0x40')]){_0x460f06[_0x9f6d('0x3e')]=_[_0x9f6d('0x41')](_0x460f06[_0x9f6d('0x3e')],{'$or':_[_0x9f6d('0x33')](_0x460f06['attributes'],function(_0x72a260){var _0x66d599={};_0x66d599[_0x72a260]={'$like':'%'+_0x52b8d7[_0x9f6d('0x34')][_0x9f6d('0x40')]+'%'};return _0x66d599;})});}_0x460f06=_[_0x9f6d('0x41')]({},_0x460f06,_0x52b8d7[_0x9f6d('0x43')]);return _0x4f0f87[_0x9f6d('0x56')](_0x460f06);}})[_0x9f6d('0x29')](function(_0x2926f1){if(_0x2926f1){_0x4aa6ad=_0x2926f1[_0x9f6d('0x3a')];if(!_0x52b8d7['query'][_0x9f6d('0x50')](_0x9f6d('0x3b'))){_0x460f06['limit']=qs[_0x9f6d('0x22')](_0x52b8d7[_0x9f6d('0x34')][_0x9f6d('0x22')]);_0x460f06[_0x9f6d('0x1f')]=qs[_0x9f6d('0x1f')](_0x52b8d7['query'][_0x9f6d('0x1f')]);}return _0x4f0f87[_0x9f6d('0x56')](_0x460f06);}})[_0x9f6d('0x29')](function(_0x282e7f){if(_0x282e7f){return _0x282e7f?{'count':_0x4aa6ad,'rows':_0x282e7f}:null;}})[_0x9f6d('0x29')](respondWithResult(_0x4f6933,null))[_0x9f6d('0x48')](handleError(_0x4f6933,null));};exports[_0x9f6d('0x57')]=function(_0x409d6f,_0x6acc1c,_0x5c8650){if(_0x409d6f[_0x9f6d('0x4d')]['id']){delete _0x409d6f[_0x9f6d('0x4d')]['id'];}return db[_0x9f6d('0x44')]['findOne']({'where':{'id':_0x409d6f[_0x9f6d('0x4a')]['id']}})[_0x9f6d('0x29')](handleEntityNotFound(_0x6acc1c,null))['then'](function(_0x3d8578){if(_0x3d8578){return _0x3d8578[_0x9f6d('0x57')](_0x409d6f[_0x9f6d('0x4d')][_0x9f6d('0x58')]||[]);}return null;})[_0x9f6d('0x29')](respondWithResult(_0x6acc1c,null))['catch'](handleError(_0x6acc1c,null));};
\ No newline at end of file
+var _0xedff=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','DeskConfiguration','includeAll','create','body','find','getFields','findOne','DeskField','getSubjects','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x33e7d4,_0xeaa8c9){var _0xd53e51=function(_0x29140d){while(--_0x29140d){_0x33e7d4['push'](_0x33e7d4['shift']());}};_0xd53e51(++_0xeaa8c9);}(_0xedff,0xc0));var _0xfedf=function(_0x44d73a,_0x166640){_0x44d73a=_0x44d73a-0x0;var _0x67492a=_0xedff[_0x44d73a];return _0x67492a;};'use strict';var emlformat=require(_0xfedf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfedf('0x1'));var jsonpatch=require(_0xfedf('0x2'));var rp=require(_0xfedf('0x3'));var moment=require('moment');var BPromise=require(_0xfedf('0x4'));var Mustache=require(_0xfedf('0x5'));var util=require(_0xfedf('0x6'));var path=require(_0xfedf('0x7'));var sox=require(_0xfedf('0x8'));var csv=require(_0xfedf('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfedf('0xa'));var squel=require(_0xfedf('0xb'));var crypto=require(_0xfedf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfedf('0xd'));var toCsv=require(_0xfedf('0x9'));var querystring=require(_0xfedf('0xe'));var Papa=require('papaparse');var Redis=require(_0xfedf('0xf'));var authService=require(_0xfedf('0x10'));var qs=require(_0xfedf('0x11'));var as=require(_0xfedf('0x12'));var hardwareService=require(_0xfedf('0x13'));var logger=require(_0xfedf('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfedf('0x15'));var db=require(_0xfedf('0x16'))['db'];function respondWithStatusCode(_0x2f4f8b,_0x2ad6a0){_0x2ad6a0=_0x2ad6a0||0xcc;return function(_0x23b626){if(_0x23b626){return _0x2f4f8b[_0xfedf('0x17')](_0x2ad6a0);}return _0x2f4f8b[_0xfedf('0x18')](_0x2ad6a0)[_0xfedf('0x19')]();};}function respondWithResult(_0x60a4c0,_0x2b974b){_0x2b974b=_0x2b974b||0xc8;return function(_0x722fcf){if(_0x722fcf){return _0x60a4c0[_0xfedf('0x18')](_0x2b974b)['json'](_0x722fcf);}};}function respondWithFilteredResult(_0x1080ef,_0x53b08a){return function(_0x1886be){if(_0x1886be){var _0x40806a=typeof _0x53b08a['offset']===_0xfedf('0x1a')&&typeof _0x53b08a[_0xfedf('0x1b')]===_0xfedf('0x1a');var _0x1edcc2=_0x1886be[_0xfedf('0x1c')];var _0x1b274b=_0x40806a?0x0:_0x53b08a[_0xfedf('0x1d')];var _0x100476=_0x40806a?_0x1886be['count']:_0x53b08a[_0xfedf('0x1d')]+_0x53b08a[_0xfedf('0x1b')];var _0x5924f5;if(_0x100476>=_0x1edcc2){_0x100476=_0x1edcc2;_0x5924f5=0xc8;}else{_0x5924f5=0xce;}_0x1080ef[_0xfedf('0x18')](_0x5924f5);return _0x1080ef[_0xfedf('0x1e')]('Content-Range',_0x1b274b+'-'+_0x100476+'/'+_0x1edcc2)[_0xfedf('0x1f')](_0x1886be);}return null;};}function patchUpdates(_0x2d0236){return function(_0x42585a){try{jsonpatch[_0xfedf('0x20')](_0x42585a,_0x2d0236,!![]);}catch(_0x255d49){return BPromise['reject'](_0x255d49);}return _0x42585a[_0xfedf('0x21')]();};}function saveUpdates(_0x254942,_0x459532){return function(_0x5e6906){if(_0x5e6906){return _0x5e6906[_0xfedf('0x22')](_0x254942)[_0xfedf('0x23')](function(_0x4aee72){return _0x4aee72;});}return null;};}function removeEntity(_0x3cedaa,_0x46b893){return function(_0x1d4f73){if(_0x1d4f73){return _0x1d4f73[_0xfedf('0x24')]()[_0xfedf('0x23')](function(){_0x3cedaa[_0xfedf('0x18')](0xcc)[_0xfedf('0x19')]();});}};}function handleEntityNotFound(_0x11a937,_0x1eaee4){return function(_0x5cc0e5){if(!_0x5cc0e5){_0x11a937[_0xfedf('0x17')](0x194);}return _0x5cc0e5;};}function handleError(_0x1e68e7,_0x1625f1){_0x1625f1=_0x1625f1||0x1f4;return function(_0x36c9a2){logger[_0xfedf('0x25')](_0x36c9a2[_0xfedf('0x26')]);if(_0x36c9a2[_0xfedf('0x27')]){delete _0x36c9a2[_0xfedf('0x27')];}_0x1e68e7[_0xfedf('0x18')](_0x1625f1)[_0xfedf('0x28')](_0x36c9a2);};}exports[_0xfedf('0x29')]=function(_0x537976,_0x3551ff){var _0x3889ed={},_0x38ed0e={},_0x4f7731={'count':0x0,'rows':[]};var _0x4959d5=_['map'](db['DeskConfiguration'][_0xfedf('0x2a')],function(_0x1ea533){return{'name':_0x1ea533['fieldName'],'type':_0x1ea533[_0xfedf('0x2b')][_0xfedf('0x2c')]};});_0x38ed0e[_0xfedf('0x2d')]=_[_0xfedf('0x2e')](_0x4959d5,_0xfedf('0x27'));_0x38ed0e[_0xfedf('0x2f')]=_['keys'](_0x537976[_0xfedf('0x2f')]);_0x38ed0e[_0xfedf('0x30')]=_[_0xfedf('0x31')](_0x38ed0e[_0xfedf('0x2d')],_0x38ed0e[_0xfedf('0x2f')]);_0x3889ed[_0xfedf('0x32')]=_[_0xfedf('0x31')](_0x38ed0e[_0xfedf('0x2d')],qs[_0xfedf('0x33')](_0x537976[_0xfedf('0x2f')][_0xfedf('0x33')]));_0x3889ed[_0xfedf('0x32')]=_0x3889ed['attributes'][_0xfedf('0x34')]?_0x3889ed['attributes']:_0x38ed0e['model'];if(!_0x537976[_0xfedf('0x2f')][_0xfedf('0x35')](_0xfedf('0x36'))){_0x3889ed['limit']=qs[_0xfedf('0x1b')](_0x537976[_0xfedf('0x2f')][_0xfedf('0x1b')]);_0x3889ed[_0xfedf('0x1d')]=qs[_0xfedf('0x1d')](_0x537976[_0xfedf('0x2f')][_0xfedf('0x1d')]);}_0x3889ed[_0xfedf('0x37')]=qs[_0xfedf('0x38')](_0x537976['query'][_0xfedf('0x38')]);_0x3889ed[_0xfedf('0x39')]=qs['filters'](_[_0xfedf('0x3a')](_0x537976[_0xfedf('0x2f')],_0x38ed0e['filters']),_0x4959d5);if(_0x537976[_0xfedf('0x2f')][_0xfedf('0x3b')]){_0x3889ed[_0xfedf('0x39')]=_[_0xfedf('0x3c')](_0x3889ed['where'],{'$or':_[_0xfedf('0x2e')](_0x4959d5,function(_0x2e208f){if(_0x2e208f[_0xfedf('0x2b')]!==_0xfedf('0x3d')){var _0x425182={};_0x425182[_0x2e208f['name']]={'$like':'%'+_0x537976['query'][_0xfedf('0x3b')]+'%'};return _0x425182;}})});}_0x3889ed=_[_0xfedf('0x3c')]({},_0x3889ed,_0x537976[_0xfedf('0x3e')]);var _0x340e3e={'where':_0x3889ed['where']};return db['DeskConfiguration'][_0xfedf('0x1c')](_0x340e3e)[_0xfedf('0x23')](function(_0x496059){_0x4f7731[_0xfedf('0x1c')]=_0x496059;if(_0x537976[_0xfedf('0x2f')]['includeAll']){_0x3889ed[_0xfedf('0x3f')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xfedf('0x40')](_0x3889ed);})[_0xfedf('0x23')](function(_0x247056){_0x4f7731[_0xfedf('0x41')]=_0x247056;return _0x4f7731;})[_0xfedf('0x23')](respondWithFilteredResult(_0x3551ff,_0x3889ed))[_0xfedf('0x42')](handleError(_0x3551ff,null));};exports[_0xfedf('0x43')]=function(_0x543e8f,_0x13f107){var _0x7c1a14={'raw':![],'where':{'id':_0x543e8f[_0xfedf('0x44')]['id']}},_0x38d2cf={};_0x38d2cf[_0xfedf('0x2d')]=_[_0xfedf('0x45')](db[_0xfedf('0x46')]['rawAttributes']);_0x38d2cf['query']=_[_0xfedf('0x45')](_0x543e8f[_0xfedf('0x2f')]);_0x38d2cf[_0xfedf('0x30')]=_[_0xfedf('0x31')](_0x38d2cf[_0xfedf('0x2d')],_0x38d2cf[_0xfedf('0x2f')]);_0x7c1a14[_0xfedf('0x32')]=_[_0xfedf('0x31')](_0x38d2cf[_0xfedf('0x2d')],qs[_0xfedf('0x33')](_0x543e8f[_0xfedf('0x2f')][_0xfedf('0x33')]));_0x7c1a14[_0xfedf('0x32')]=_0x7c1a14[_0xfedf('0x32')][_0xfedf('0x34')]?_0x7c1a14[_0xfedf('0x32')]:_0x38d2cf[_0xfedf('0x2d')];if(_0x543e8f[_0xfedf('0x2f')][_0xfedf('0x47')]){_0x7c1a14['include']=[{'all':!![]}];}_0x7c1a14=_[_0xfedf('0x3c')]({},_0x7c1a14,_0x543e8f['options']);return db[_0xfedf('0x46')]['find'](_0x7c1a14)[_0xfedf('0x23')](handleEntityNotFound(_0x13f107,null))[_0xfedf('0x23')](respondWithResult(_0x13f107,null))[_0xfedf('0x42')](handleError(_0x13f107,null));};exports[_0xfedf('0x48')]=function(_0xd6f7e6,_0x27bfba){return db[_0xfedf('0x46')]['create'](_0xd6f7e6[_0xfedf('0x49')],{})[_0xfedf('0x23')](respondWithResult(_0x27bfba,0xc9))['catch'](handleError(_0x27bfba,null));};exports[_0xfedf('0x22')]=function(_0x48dc6e,_0x2f6498){if(_0x48dc6e[_0xfedf('0x49')]['id']){delete _0x48dc6e[_0xfedf('0x49')]['id'];}return db['DeskConfiguration'][_0xfedf('0x4a')]({'where':{'id':_0x48dc6e[_0xfedf('0x44')]['id']}})[_0xfedf('0x23')](handleEntityNotFound(_0x2f6498,null))[_0xfedf('0x23')](saveUpdates(_0x48dc6e[_0xfedf('0x49')],null))[_0xfedf('0x23')](respondWithResult(_0x2f6498,null))[_0xfedf('0x42')](handleError(_0x2f6498,null));};exports[_0xfedf('0x24')]=function(_0x8b65af,_0x19d31c){return db['DeskConfiguration']['find']({'where':{'id':_0x8b65af[_0xfedf('0x44')]['id']}})[_0xfedf('0x23')](handleEntityNotFound(_0x19d31c,null))[_0xfedf('0x23')](removeEntity(_0x19d31c,null))[_0xfedf('0x42')](handleError(_0x19d31c,null));};exports[_0xfedf('0x4b')]=function(_0x421250,_0x4b31f4,_0x1d1378){var _0x12a232={};var _0x2307cf={};var _0xb21004;var _0x2dc9ff;return db['DeskConfiguration'][_0xfedf('0x4c')]({'where':{'id':_0x421250[_0xfedf('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b31f4,null))[_0xfedf('0x23')](function(_0x2d6be9){if(_0x2d6be9){_0xb21004=_0x2d6be9;_0x2307cf['model']=_['keys'](db[_0xfedf('0x4d')][_0xfedf('0x2a')]);_0x2307cf[_0xfedf('0x2f')]=_[_0xfedf('0x45')](_0x421250[_0xfedf('0x2f')]);_0x2307cf[_0xfedf('0x30')]=_[_0xfedf('0x31')](_0x2307cf[_0xfedf('0x2d')],_0x2307cf[_0xfedf('0x2f')]);_0x12a232[_0xfedf('0x32')]=_[_0xfedf('0x31')](_0x2307cf['model'],qs[_0xfedf('0x33')](_0x421250[_0xfedf('0x2f')][_0xfedf('0x33')]));_0x12a232[_0xfedf('0x32')]=_0x12a232[_0xfedf('0x32')]['length']?_0x12a232[_0xfedf('0x32')]:_0x2307cf[_0xfedf('0x2d')];_0x12a232[_0xfedf('0x37')]=qs[_0xfedf('0x38')](_0x421250[_0xfedf('0x2f')]['sort']);_0x12a232[_0xfedf('0x39')]=qs[_0xfedf('0x30')](_[_0xfedf('0x3a')](_0x421250[_0xfedf('0x2f')],_0x2307cf[_0xfedf('0x30')]));if(_0x421250[_0xfedf('0x2f')][_0xfedf('0x3b')]){_0x12a232[_0xfedf('0x39')]=_[_0xfedf('0x3c')](_0x12a232[_0xfedf('0x39')],{'$or':_[_0xfedf('0x2e')](_0x12a232[_0xfedf('0x32')],function(_0x46c61d){var _0x3c7ce2={};_0x3c7ce2[_0x46c61d]={'$like':'%'+_0x421250[_0xfedf('0x2f')][_0xfedf('0x3b')]+'%'};return _0x3c7ce2;})});}_0x12a232=_[_0xfedf('0x3c')]({},_0x12a232,_0x421250[_0xfedf('0x3e')]);return _0xb21004['getFields'](_0x12a232);}})[_0xfedf('0x23')](function(_0x3f4f3){if(_0x3f4f3){_0x2dc9ff=_0x3f4f3[_0xfedf('0x34')];if(!_0x421250[_0xfedf('0x2f')]['hasOwnProperty'](_0xfedf('0x36'))){_0x12a232[_0xfedf('0x1b')]=qs[_0xfedf('0x1b')](_0x421250[_0xfedf('0x2f')][_0xfedf('0x1b')]);_0x12a232[_0xfedf('0x1d')]=qs[_0xfedf('0x1d')](_0x421250['query']['offset']);}return _0xb21004[_0xfedf('0x4b')](_0x12a232);}})[_0xfedf('0x23')](function(_0x2cfb37){if(_0x2cfb37){return _0x2cfb37?{'count':_0x2dc9ff,'rows':_0x2cfb37}:null;}})[_0xfedf('0x23')](respondWithResult(_0x4b31f4,null))[_0xfedf('0x42')](handleError(_0x4b31f4,null));};exports['getSubjects']=function(_0x2aa42b,_0x50925c,_0x556ecf){var _0xed1068={};var _0x3dfbea={};var _0x353d1d;var _0x103a4d;return db[_0xfedf('0x46')][_0xfedf('0x4c')]({'where':{'id':_0x2aa42b['params']['id']}})[_0xfedf('0x23')](handleEntityNotFound(_0x50925c,null))['then'](function(_0x731194){if(_0x731194){_0x353d1d=_0x731194;_0x3dfbea[_0xfedf('0x2d')]=_[_0xfedf('0x45')](db[_0xfedf('0x4d')][_0xfedf('0x2a')]);_0x3dfbea['query']=_[_0xfedf('0x45')](_0x2aa42b[_0xfedf('0x2f')]);_0x3dfbea[_0xfedf('0x30')]=_[_0xfedf('0x31')](_0x3dfbea[_0xfedf('0x2d')],_0x3dfbea[_0xfedf('0x2f')]);_0xed1068['attributes']=_[_0xfedf('0x31')](_0x3dfbea[_0xfedf('0x2d')],qs[_0xfedf('0x33')](_0x2aa42b[_0xfedf('0x2f')][_0xfedf('0x33')]));_0xed1068[_0xfedf('0x32')]=_0xed1068[_0xfedf('0x32')][_0xfedf('0x34')]?_0xed1068['attributes']:_0x3dfbea[_0xfedf('0x2d')];_0xed1068[_0xfedf('0x37')]=qs[_0xfedf('0x38')](_0x2aa42b[_0xfedf('0x2f')][_0xfedf('0x38')]);_0xed1068[_0xfedf('0x39')]=qs[_0xfedf('0x30')](_[_0xfedf('0x3a')](_0x2aa42b[_0xfedf('0x2f')],_0x3dfbea[_0xfedf('0x30')]));if(_0x2aa42b['query']['filter']){_0xed1068[_0xfedf('0x39')]=_[_0xfedf('0x3c')](_0xed1068[_0xfedf('0x39')],{'$or':_[_0xfedf('0x2e')](_0xed1068['attributes'],function(_0x1859d1){var _0x1049e6={};_0x1049e6[_0x1859d1]={'$like':'%'+_0x2aa42b[_0xfedf('0x2f')][_0xfedf('0x3b')]+'%'};return _0x1049e6;})});}_0xed1068=_['merge']({},_0xed1068,_0x2aa42b[_0xfedf('0x3e')]);return _0x353d1d[_0xfedf('0x4e')](_0xed1068);}})[_0xfedf('0x23')](function(_0x46bef6){if(_0x46bef6){_0x103a4d=_0x46bef6['length'];if(!_0x2aa42b[_0xfedf('0x2f')][_0xfedf('0x35')](_0xfedf('0x36'))){_0xed1068[_0xfedf('0x1b')]=qs['limit'](_0x2aa42b[_0xfedf('0x2f')][_0xfedf('0x1b')]);_0xed1068[_0xfedf('0x1d')]=qs[_0xfedf('0x1d')](_0x2aa42b[_0xfedf('0x2f')][_0xfedf('0x1d')]);}return _0x353d1d[_0xfedf('0x4e')](_0xed1068);}})[_0xfedf('0x23')](function(_0xee0179){if(_0xee0179){return _0xee0179?{'count':_0x103a4d,'rows':_0xee0179}:null;}})[_0xfedf('0x23')](respondWithResult(_0x50925c,null))[_0xfedf('0x42')](handleError(_0x50925c,null));};exports['getDescriptions']=function(_0xdbbf4c,_0x264a9b,_0x8a4d80){var _0x212035={};var _0x22659e={};var _0x569d58;var _0x5b5265;return db[_0xfedf('0x46')][_0xfedf('0x4c')]({'where':{'id':_0xdbbf4c[_0xfedf('0x44')]['id']}})[_0xfedf('0x23')](handleEntityNotFound(_0x264a9b,null))[_0xfedf('0x23')](function(_0x31db84){if(_0x31db84){_0x569d58=_0x31db84;_0x22659e[_0xfedf('0x2d')]=_['keys'](db[_0xfedf('0x4d')][_0xfedf('0x2a')]);_0x22659e[_0xfedf('0x2f')]=_[_0xfedf('0x45')](_0xdbbf4c['query']);_0x22659e['filters']=_[_0xfedf('0x31')](_0x22659e['model'],_0x22659e[_0xfedf('0x2f')]);_0x212035[_0xfedf('0x32')]=_['intersection'](_0x22659e[_0xfedf('0x2d')],qs[_0xfedf('0x33')](_0xdbbf4c[_0xfedf('0x2f')][_0xfedf('0x33')]));_0x212035['attributes']=_0x212035['attributes'][_0xfedf('0x34')]?_0x212035[_0xfedf('0x32')]:_0x22659e['model'];_0x212035[_0xfedf('0x37')]=qs['sort'](_0xdbbf4c['query'][_0xfedf('0x38')]);_0x212035[_0xfedf('0x39')]=qs[_0xfedf('0x30')](_['pick'](_0xdbbf4c[_0xfedf('0x2f')],_0x22659e['filters']));if(_0xdbbf4c[_0xfedf('0x2f')][_0xfedf('0x3b')]){_0x212035['where']=_['merge'](_0x212035[_0xfedf('0x39')],{'$or':_[_0xfedf('0x2e')](_0x212035[_0xfedf('0x32')],function(_0x4a2856){var _0x5a1a86={};_0x5a1a86[_0x4a2856]={'$like':'%'+_0xdbbf4c[_0xfedf('0x2f')][_0xfedf('0x3b')]+'%'};return _0x5a1a86;})});}_0x212035=_[_0xfedf('0x3c')]({},_0x212035,_0xdbbf4c[_0xfedf('0x3e')]);return _0x569d58['getDescriptions'](_0x212035);}})['then'](function(_0x3ad516){if(_0x3ad516){_0x5b5265=_0x3ad516[_0xfedf('0x34')];if(!_0xdbbf4c[_0xfedf('0x2f')][_0xfedf('0x35')](_0xfedf('0x36'))){_0x212035[_0xfedf('0x1b')]=qs[_0xfedf('0x1b')](_0xdbbf4c[_0xfedf('0x2f')]['limit']);_0x212035['offset']=qs['offset'](_0xdbbf4c[_0xfedf('0x2f')]['offset']);}return _0x569d58['getDescriptions'](_0x212035);}})[_0xfedf('0x23')](function(_0x351800){if(_0x351800){return _0x351800?{'count':_0x5b5265,'rows':_0x351800}:null;}})[_0xfedf('0x23')](respondWithResult(_0x264a9b,null))[_0xfedf('0x42')](handleError(_0x264a9b,null));};exports[_0xfedf('0x4f')]=function(_0x4faeef,_0x278bda,_0x2f7adc){var _0x508633={};var _0x332c51={};var _0x5507aa;var _0x27e0c1;return db['DeskConfiguration'][_0xfedf('0x4c')]({'where':{'id':_0x4faeef[_0xfedf('0x44')]['id']}})[_0xfedf('0x23')](handleEntityNotFound(_0x278bda,null))['then'](function(_0x596cfa){if(_0x596cfa){_0x5507aa=_0x596cfa;_0x332c51[_0xfedf('0x2d')]=_['keys'](db[_0xfedf('0x50')][_0xfedf('0x2a')]);_0x332c51[_0xfedf('0x2f')]=_['keys'](_0x4faeef['query']);_0x332c51[_0xfedf('0x30')]=_[_0xfedf('0x31')](_0x332c51[_0xfedf('0x2d')],_0x332c51['query']);_0x508633[_0xfedf('0x32')]=_['intersection'](_0x332c51['model'],qs[_0xfedf('0x33')](_0x4faeef[_0xfedf('0x2f')][_0xfedf('0x33')]));_0x508633[_0xfedf('0x32')]=_0x508633[_0xfedf('0x32')]['length']?_0x508633[_0xfedf('0x32')]:_0x332c51[_0xfedf('0x2d')];_0x508633[_0xfedf('0x37')]=qs[_0xfedf('0x38')](_0x4faeef[_0xfedf('0x2f')][_0xfedf('0x38')]);_0x508633[_0xfedf('0x39')]=qs[_0xfedf('0x30')](_[_0xfedf('0x3a')](_0x4faeef[_0xfedf('0x2f')],_0x332c51[_0xfedf('0x30')]));if(_0x4faeef[_0xfedf('0x2f')][_0xfedf('0x3b')]){_0x508633['where']=_[_0xfedf('0x3c')](_0x508633[_0xfedf('0x39')],{'$or':_['map'](_0x508633[_0xfedf('0x32')],function(_0x262961){var _0x7e48c8={};_0x7e48c8[_0x262961]={'$like':'%'+_0x4faeef[_0xfedf('0x2f')]['filter']+'%'};return _0x7e48c8;})});}_0x508633=_[_0xfedf('0x3c')]({},_0x508633,_0x4faeef[_0xfedf('0x3e')]);return _0x5507aa[_0xfedf('0x4f')](_0x508633);}})[_0xfedf('0x23')](function(_0x34e222){if(_0x34e222){_0x27e0c1=_0x34e222[_0xfedf('0x34')];if(!_0x4faeef[_0xfedf('0x2f')][_0xfedf('0x35')](_0xfedf('0x36'))){_0x508633['limit']=qs[_0xfedf('0x1b')](_0x4faeef[_0xfedf('0x2f')][_0xfedf('0x1b')]);_0x508633[_0xfedf('0x1d')]=qs[_0xfedf('0x1d')](_0x4faeef[_0xfedf('0x2f')][_0xfedf('0x1d')]);}return _0x5507aa[_0xfedf('0x4f')](_0x508633);}})[_0xfedf('0x23')](function(_0x5e56dc){if(_0x5e56dc){return _0x5e56dc?{'count':_0x27e0c1,'rows':_0x5e56dc}:null;}})[_0xfedf('0x23')](respondWithResult(_0x278bda,null))['catch'](handleError(_0x278bda,null));};exports[_0xfedf('0x51')]=function(_0x2b30bd,_0x12a42b,_0x14788){if(_0x2b30bd['body']['id']){delete _0x2b30bd[_0xfedf('0x49')]['id'];}return db[_0xfedf('0x46')][_0xfedf('0x4c')]({'where':{'id':_0x2b30bd['params']['id']}})[_0xfedf('0x23')](handleEntityNotFound(_0x12a42b,null))['then'](function(_0x59b754){if(_0x59b754){return _0x59b754['setTags'](_0x2b30bd[_0xfedf('0x49')]['ids']||[]);}return null;})['then'](respondWithResult(_0x12a42b,null))[_0xfedf('0x42')](handleError(_0x12a42b,null));};
\ No newline at end of file