Built motion from commit d1eab355.|2.6.28
[motion2.git] / server / api / intDeskConfiguration / intDeskConfiguration.controller.js
index d2268c3..d7f4599 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5a63=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','create','catch','update','body','getFields','findOne','DeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','stack','name','send','index','map','DeskConfiguration','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort'];(function(_0x25badc,_0xf437fd){var _0x1eb093=function(_0x57b143){while(--_0x57b143){_0x25badc['push'](_0x25badc['shift']());}};_0x1eb093(++_0xf437fd);}(_0x5a63,0xc2));var _0x35a6=function(_0x55ba48,_0x242900){_0x55ba48=_0x55ba48-0x0;var _0x2daac2=_0x5a63[_0x55ba48];return _0x2daac2;};'use strict';var emlformat=require(_0x35a6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x35a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35a6('0x2'));var moment=require(_0x35a6('0x3'));var BPromise=require(_0x35a6('0x4'));var Mustache=require(_0x35a6('0x5'));var util=require(_0x35a6('0x6'));var path=require(_0x35a6('0x7'));var sox=require('sox');var csv=require(_0x35a6('0x8'));var ejs=require(_0x35a6('0x9'));var fs=require('fs');var fs_extra=require(_0x35a6('0xa'));var _=require(_0x35a6('0xb'));var squel=require(_0x35a6('0xc'));var crypto=require('crypto');var jsforce=require(_0x35a6('0xd'));var deskjs=require(_0x35a6('0xe'));var toCsv=require(_0x35a6('0x8'));var querystring=require(_0x35a6('0xf'));var Papa=require(_0x35a6('0x10'));var Redis=require('ioredis');var authService=require(_0x35a6('0x11'));var qs=require(_0x35a6('0x12'));var as=require(_0x35a6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x35a6('0x14'));var utils=require(_0x35a6('0x15'));var config=require(_0x35a6('0x16'));var licenseUtil=require(_0x35a6('0x17'));var db=require(_0x35a6('0x18'))['db'];function respondWithStatusCode(_0x3649da,_0x11794c){_0x11794c=_0x11794c||0xcc;return function(_0x4de159){if(_0x4de159){return _0x3649da[_0x35a6('0x19')](_0x11794c);}return _0x3649da[_0x35a6('0x1a')](_0x11794c)[_0x35a6('0x1b')]();};}function respondWithResult(_0x53521d,_0x205e75){_0x205e75=_0x205e75||0xc8;return function(_0xbef8cb){if(_0xbef8cb){return _0x53521d[_0x35a6('0x1a')](_0x205e75)['json'](_0xbef8cb);}};}function respondWithFilteredResult(_0x5c57bd,_0x5e7d19){return function(_0x19a4fa){if(_0x19a4fa){var _0x2da618=typeof _0x5e7d19[_0x35a6('0x1c')]===_0x35a6('0x1d')&&typeof _0x5e7d19[_0x35a6('0x1e')]===_0x35a6('0x1d');var _0x210c46=_0x19a4fa[_0x35a6('0x1f')];var _0x4dc66a=_0x2da618?0x0:_0x5e7d19[_0x35a6('0x1c')];var _0x31588b=_0x2da618?_0x19a4fa[_0x35a6('0x1f')]:_0x5e7d19[_0x35a6('0x1c')]+_0x5e7d19[_0x35a6('0x1e')];var _0x508112;if(_0x31588b>=_0x210c46){_0x31588b=_0x210c46;_0x508112=0xc8;}else{_0x508112=0xce;}_0x5c57bd['status'](_0x508112);return _0x5c57bd[_0x35a6('0x20')](_0x35a6('0x21'),_0x4dc66a+'-'+_0x31588b+'/'+_0x210c46)[_0x35a6('0x22')](_0x19a4fa);}return null;};}function patchUpdates(_0x3eff34){return function(_0x4286d4){try{jsonpatch[_0x35a6('0x23')](_0x4286d4,_0x3eff34,!![]);}catch(_0x5b6c47){return BPromise['reject'](_0x5b6c47);}return _0x4286d4[_0x35a6('0x24')]();};}function saveUpdates(_0x1727c1,_0x109746){return function(_0x4c86c){if(_0x4c86c){return _0x4c86c['update'](_0x1727c1)[_0x35a6('0x25')](function(_0x104176){return _0x104176;});}return null;};}function removeEntity(_0x46806b,_0x5c8090){return function(_0x2c5d3d){if(_0x2c5d3d){return _0x2c5d3d[_0x35a6('0x26')]()[_0x35a6('0x25')](function(){_0x46806b[_0x35a6('0x1a')](0xcc)[_0x35a6('0x1b')]();});}};}function handleEntityNotFound(_0x1673af,_0x1c180f){return function(_0x2e0bd6){if(!_0x2e0bd6){_0x1673af['sendStatus'](0x194);}return _0x2e0bd6;};}function handleError(_0x5ccc91,_0x1ea52e){_0x1ea52e=_0x1ea52e||0x1f4;return function(_0x28de5c){logger['error'](_0x28de5c[_0x35a6('0x27')]);if(_0x28de5c[_0x35a6('0x28')]){delete _0x28de5c[_0x35a6('0x28')];}_0x5ccc91['status'](_0x1ea52e)[_0x35a6('0x29')](_0x28de5c);};}exports[_0x35a6('0x2a')]=function(_0x326316,_0x47df2d){var _0x179734={},_0x8f14b7={},_0x19af46={'count':0x0,'rows':[]};var _0x2f97a2=_[_0x35a6('0x2b')](db[_0x35a6('0x2c')][_0x35a6('0x2d')],function(_0x727328){return{'name':_0x727328['fieldName'],'type':_0x727328[_0x35a6('0x2e')][_0x35a6('0x2f')]};});_0x8f14b7[_0x35a6('0x30')]=_[_0x35a6('0x2b')](_0x2f97a2,_0x35a6('0x28'));_0x8f14b7[_0x35a6('0x31')]=_['keys'](_0x326316[_0x35a6('0x31')]);_0x8f14b7[_0x35a6('0x32')]=_[_0x35a6('0x33')](_0x8f14b7[_0x35a6('0x30')],_0x8f14b7[_0x35a6('0x31')]);_0x179734['attributes']=_[_0x35a6('0x33')](_0x8f14b7[_0x35a6('0x30')],qs[_0x35a6('0x34')](_0x326316[_0x35a6('0x31')][_0x35a6('0x34')]));_0x179734[_0x35a6('0x35')]=_0x179734[_0x35a6('0x35')][_0x35a6('0x36')]?_0x179734[_0x35a6('0x35')]:_0x8f14b7[_0x35a6('0x30')];if(!_0x326316[_0x35a6('0x31')][_0x35a6('0x37')]('nolimit')){_0x179734[_0x35a6('0x1e')]=qs['limit'](_0x326316['query'][_0x35a6('0x1e')]);_0x179734['offset']=qs[_0x35a6('0x1c')](_0x326316[_0x35a6('0x31')]['offset']);}_0x179734[_0x35a6('0x38')]=qs[_0x35a6('0x39')](_0x326316[_0x35a6('0x31')][_0x35a6('0x39')]);_0x179734[_0x35a6('0x3a')]=qs[_0x35a6('0x32')](_[_0x35a6('0x3b')](_0x326316[_0x35a6('0x31')],_0x8f14b7[_0x35a6('0x32')]),_0x2f97a2);if(_0x326316[_0x35a6('0x31')][_0x35a6('0x3c')]){_0x179734[_0x35a6('0x3a')]=_[_0x35a6('0x3d')](_0x179734[_0x35a6('0x3a')],{'$or':_[_0x35a6('0x2b')](_0x2f97a2,function(_0x4f9ac2){if(_0x4f9ac2[_0x35a6('0x2e')]!==_0x35a6('0x3e')){var _0x1bac8e={};_0x1bac8e[_0x4f9ac2[_0x35a6('0x28')]]={'$like':'%'+_0x326316[_0x35a6('0x31')][_0x35a6('0x3c')]+'%'};return _0x1bac8e;}})});}_0x179734=_[_0x35a6('0x3d')]({},_0x179734,_0x326316[_0x35a6('0x3f')]);var _0x21d403={'where':_0x179734['where']};return db[_0x35a6('0x2c')][_0x35a6('0x1f')](_0x21d403)[_0x35a6('0x25')](function(_0x2e22b2){_0x19af46['count']=_0x2e22b2;if(_0x326316[_0x35a6('0x31')][_0x35a6('0x40')]){_0x179734[_0x35a6('0x41')]=[{'all':!![]}];}return db[_0x35a6('0x2c')]['findAll'](_0x179734);})[_0x35a6('0x25')](function(_0x424ed9){_0x19af46[_0x35a6('0x42')]=_0x424ed9;return _0x19af46;})[_0x35a6('0x25')](respondWithFilteredResult(_0x47df2d,_0x179734))['catch'](handleError(_0x47df2d,null));};exports[_0x35a6('0x43')]=function(_0xa2ec56,_0x5cdcc1){var _0x5ee7ad={'raw':![],'where':{'id':_0xa2ec56[_0x35a6('0x44')]['id']}},_0x24d2eb={};_0x24d2eb['model']=_[_0x35a6('0x45')](db[_0x35a6('0x2c')]['rawAttributes']);_0x24d2eb[_0x35a6('0x31')]=_[_0x35a6('0x45')](_0xa2ec56[_0x35a6('0x31')]);_0x24d2eb[_0x35a6('0x32')]=_[_0x35a6('0x33')](_0x24d2eb[_0x35a6('0x30')],_0x24d2eb[_0x35a6('0x31')]);_0x5ee7ad[_0x35a6('0x35')]=_[_0x35a6('0x33')](_0x24d2eb[_0x35a6('0x30')],qs['fields'](_0xa2ec56[_0x35a6('0x31')][_0x35a6('0x34')]));_0x5ee7ad[_0x35a6('0x35')]=_0x5ee7ad[_0x35a6('0x35')][_0x35a6('0x36')]?_0x5ee7ad[_0x35a6('0x35')]:_0x24d2eb[_0x35a6('0x30')];if(_0xa2ec56['query']['includeAll']){_0x5ee7ad['include']=[{'all':!![]}];}_0x5ee7ad=_['merge']({},_0x5ee7ad,_0xa2ec56[_0x35a6('0x3f')]);return db[_0x35a6('0x2c')][_0x35a6('0x46')](_0x5ee7ad)[_0x35a6('0x25')](handleEntityNotFound(_0x5cdcc1,null))[_0x35a6('0x25')](respondWithResult(_0x5cdcc1,null))['catch'](handleError(_0x5cdcc1,null));};exports[_0x35a6('0x47')]=function(_0x168e6b,_0x278254){return db[_0x35a6('0x2c')]['create'](_0x168e6b['body'],{})[_0x35a6('0x25')](respondWithResult(_0x278254,0xc9))[_0x35a6('0x48')](handleError(_0x278254,null));};exports[_0x35a6('0x49')]=function(_0xe5b3fc,_0xe3d6a6){if(_0xe5b3fc['body']['id']){delete _0xe5b3fc['body']['id'];}return db[_0x35a6('0x2c')][_0x35a6('0x46')]({'where':{'id':_0xe5b3fc[_0x35a6('0x44')]['id']}})['then'](handleEntityNotFound(_0xe3d6a6,null))['then'](saveUpdates(_0xe5b3fc[_0x35a6('0x4a')],null))[_0x35a6('0x25')](respondWithResult(_0xe3d6a6,null))[_0x35a6('0x48')](handleError(_0xe3d6a6,null));};exports[_0x35a6('0x26')]=function(_0x2d8f2c,_0x14df0f){return db[_0x35a6('0x2c')][_0x35a6('0x46')]({'where':{'id':_0x2d8f2c[_0x35a6('0x44')]['id']}})[_0x35a6('0x25')](handleEntityNotFound(_0x14df0f,null))[_0x35a6('0x25')](removeEntity(_0x14df0f,null))['catch'](handleError(_0x14df0f,null));};exports[_0x35a6('0x4b')]=function(_0x20e70f,_0xa44af2,_0x5ac664){var _0x46c2a4={};var _0x59f133={};var _0x2d2222;var _0xd3880b;return db['DeskConfiguration'][_0x35a6('0x4c')]({'where':{'id':_0x20e70f[_0x35a6('0x44')]['id']}})[_0x35a6('0x25')](handleEntityNotFound(_0xa44af2,null))[_0x35a6('0x25')](function(_0x5ecd34){if(_0x5ecd34){_0x2d2222=_0x5ecd34;_0x59f133[_0x35a6('0x30')]=_[_0x35a6('0x45')](db[_0x35a6('0x4d')][_0x35a6('0x2d')]);_0x59f133[_0x35a6('0x31')]=_[_0x35a6('0x45')](_0x20e70f[_0x35a6('0x31')]);_0x59f133['filters']=_[_0x35a6('0x33')](_0x59f133['model'],_0x59f133['query']);_0x46c2a4['attributes']=_[_0x35a6('0x33')](_0x59f133[_0x35a6('0x30')],qs[_0x35a6('0x34')](_0x20e70f[_0x35a6('0x31')][_0x35a6('0x34')]));_0x46c2a4[_0x35a6('0x35')]=_0x46c2a4[_0x35a6('0x35')][_0x35a6('0x36')]?_0x46c2a4[_0x35a6('0x35')]:_0x59f133[_0x35a6('0x30')];_0x46c2a4['order']=qs[_0x35a6('0x39')](_0x20e70f[_0x35a6('0x31')][_0x35a6('0x39')]);_0x46c2a4[_0x35a6('0x3a')]=qs['filters'](_[_0x35a6('0x3b')](_0x20e70f[_0x35a6('0x31')],_0x59f133['filters']));if(_0x20e70f[_0x35a6('0x31')]['filter']){_0x46c2a4[_0x35a6('0x3a')]=_[_0x35a6('0x3d')](_0x46c2a4['where'],{'$or':_[_0x35a6('0x2b')](_0x46c2a4[_0x35a6('0x35')],function(_0xeca62d){var _0x14282e={};_0x14282e[_0xeca62d]={'$like':'%'+_0x20e70f['query'][_0x35a6('0x3c')]+'%'};return _0x14282e;})});}_0x46c2a4=_[_0x35a6('0x3d')]({},_0x46c2a4,_0x20e70f['options']);return _0x2d2222[_0x35a6('0x4b')](_0x46c2a4);}})[_0x35a6('0x25')](function(_0x49c4fc){if(_0x49c4fc){_0xd3880b=_0x49c4fc[_0x35a6('0x36')];if(!_0x20e70f[_0x35a6('0x31')][_0x35a6('0x37')](_0x35a6('0x4e'))){_0x46c2a4['limit']=qs[_0x35a6('0x1e')](_0x20e70f[_0x35a6('0x31')][_0x35a6('0x1e')]);_0x46c2a4['offset']=qs[_0x35a6('0x1c')](_0x20e70f['query'][_0x35a6('0x1c')]);}return _0x2d2222[_0x35a6('0x4b')](_0x46c2a4);}})[_0x35a6('0x25')](function(_0x2fbae3){if(_0x2fbae3){return _0x2fbae3?{'count':_0xd3880b,'rows':_0x2fbae3}:null;}})[_0x35a6('0x25')](respondWithResult(_0xa44af2,null))[_0x35a6('0x48')](handleError(_0xa44af2,null));};exports[_0x35a6('0x4f')]=function(_0x206c8d,_0x4f097b,_0x25e10a){var _0x1c4cc6={};var _0x43fef7={};var _0x4cf3c9;var _0x37e5a8;return db[_0x35a6('0x2c')][_0x35a6('0x4c')]({'where':{'id':_0x206c8d[_0x35a6('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f097b,null))['then'](function(_0x5d5a56){if(_0x5d5a56){_0x4cf3c9=_0x5d5a56;_0x43fef7[_0x35a6('0x30')]=_[_0x35a6('0x45')](db[_0x35a6('0x4d')][_0x35a6('0x2d')]);_0x43fef7[_0x35a6('0x31')]=_[_0x35a6('0x45')](_0x206c8d[_0x35a6('0x31')]);_0x43fef7[_0x35a6('0x32')]=_[_0x35a6('0x33')](_0x43fef7[_0x35a6('0x30')],_0x43fef7['query']);_0x1c4cc6['attributes']=_[_0x35a6('0x33')](_0x43fef7['model'],qs[_0x35a6('0x34')](_0x206c8d[_0x35a6('0x31')][_0x35a6('0x34')]));_0x1c4cc6[_0x35a6('0x35')]=_0x1c4cc6[_0x35a6('0x35')]['length']?_0x1c4cc6[_0x35a6('0x35')]:_0x43fef7[_0x35a6('0x30')];_0x1c4cc6[_0x35a6('0x38')]=qs[_0x35a6('0x39')](_0x206c8d[_0x35a6('0x31')]['sort']);_0x1c4cc6[_0x35a6('0x3a')]=qs[_0x35a6('0x32')](_[_0x35a6('0x3b')](_0x206c8d[_0x35a6('0x31')],_0x43fef7[_0x35a6('0x32')]));if(_0x206c8d[_0x35a6('0x31')][_0x35a6('0x3c')]){_0x1c4cc6[_0x35a6('0x3a')]=_[_0x35a6('0x3d')](_0x1c4cc6[_0x35a6('0x3a')],{'$or':_[_0x35a6('0x2b')](_0x1c4cc6[_0x35a6('0x35')],function(_0x4e5ac7){var _0x373ae3={};_0x373ae3[_0x4e5ac7]={'$like':'%'+_0x206c8d[_0x35a6('0x31')][_0x35a6('0x3c')]+'%'};return _0x373ae3;})});}_0x1c4cc6=_['merge']({},_0x1c4cc6,_0x206c8d[_0x35a6('0x3f')]);return _0x4cf3c9['getSubjects'](_0x1c4cc6);}})[_0x35a6('0x25')](function(_0x55bb58){if(_0x55bb58){_0x37e5a8=_0x55bb58[_0x35a6('0x36')];if(!_0x206c8d[_0x35a6('0x31')][_0x35a6('0x37')](_0x35a6('0x4e'))){_0x1c4cc6[_0x35a6('0x1e')]=qs[_0x35a6('0x1e')](_0x206c8d[_0x35a6('0x31')][_0x35a6('0x1e')]);_0x1c4cc6[_0x35a6('0x1c')]=qs[_0x35a6('0x1c')](_0x206c8d[_0x35a6('0x31')][_0x35a6('0x1c')]);}return _0x4cf3c9[_0x35a6('0x4f')](_0x1c4cc6);}})[_0x35a6('0x25')](function(_0x46b9cd){if(_0x46b9cd){return _0x46b9cd?{'count':_0x37e5a8,'rows':_0x46b9cd}:null;}})['then'](respondWithResult(_0x4f097b,null))[_0x35a6('0x48')](handleError(_0x4f097b,null));};exports[_0x35a6('0x50')]=function(_0x411522,_0x5f3004,_0x1206bd){var _0x2b8a7e={};var _0x4b42dc={};var _0x1805d9;var _0x400199;return db[_0x35a6('0x2c')][_0x35a6('0x4c')]({'where':{'id':_0x411522['params']['id']}})[_0x35a6('0x25')](handleEntityNotFound(_0x5f3004,null))[_0x35a6('0x25')](function(_0x15ad20){if(_0x15ad20){_0x1805d9=_0x15ad20;_0x4b42dc['model']=_['keys'](db[_0x35a6('0x4d')][_0x35a6('0x2d')]);_0x4b42dc[_0x35a6('0x31')]=_[_0x35a6('0x45')](_0x411522[_0x35a6('0x31')]);_0x4b42dc['filters']=_[_0x35a6('0x33')](_0x4b42dc[_0x35a6('0x30')],_0x4b42dc[_0x35a6('0x31')]);_0x2b8a7e[_0x35a6('0x35')]=_[_0x35a6('0x33')](_0x4b42dc[_0x35a6('0x30')],qs[_0x35a6('0x34')](_0x411522[_0x35a6('0x31')][_0x35a6('0x34')]));_0x2b8a7e[_0x35a6('0x35')]=_0x2b8a7e['attributes'][_0x35a6('0x36')]?_0x2b8a7e[_0x35a6('0x35')]:_0x4b42dc[_0x35a6('0x30')];_0x2b8a7e[_0x35a6('0x38')]=qs[_0x35a6('0x39')](_0x411522[_0x35a6('0x31')][_0x35a6('0x39')]);_0x2b8a7e[_0x35a6('0x3a')]=qs[_0x35a6('0x32')](_['pick'](_0x411522[_0x35a6('0x31')],_0x4b42dc[_0x35a6('0x32')]));if(_0x411522[_0x35a6('0x31')][_0x35a6('0x3c')]){_0x2b8a7e['where']=_['merge'](_0x2b8a7e[_0x35a6('0x3a')],{'$or':_[_0x35a6('0x2b')](_0x2b8a7e[_0x35a6('0x35')],function(_0x395024){var _0x2318c8={};_0x2318c8[_0x395024]={'$like':'%'+_0x411522[_0x35a6('0x31')][_0x35a6('0x3c')]+'%'};return _0x2318c8;})});}_0x2b8a7e=_[_0x35a6('0x3d')]({},_0x2b8a7e,_0x411522['options']);return _0x1805d9[_0x35a6('0x50')](_0x2b8a7e);}})['then'](function(_0x635f84){if(_0x635f84){_0x400199=_0x635f84[_0x35a6('0x36')];if(!_0x411522[_0x35a6('0x31')][_0x35a6('0x37')](_0x35a6('0x4e'))){_0x2b8a7e[_0x35a6('0x1e')]=qs['limit'](_0x411522[_0x35a6('0x31')]['limit']);_0x2b8a7e[_0x35a6('0x1c')]=qs[_0x35a6('0x1c')](_0x411522[_0x35a6('0x31')][_0x35a6('0x1c')]);}return _0x1805d9['getDescriptions'](_0x2b8a7e);}})['then'](function(_0x2593e0){if(_0x2593e0){return _0x2593e0?{'count':_0x400199,'rows':_0x2593e0}:null;}})[_0x35a6('0x25')](respondWithResult(_0x5f3004,null))[_0x35a6('0x48')](handleError(_0x5f3004,null));};exports[_0x35a6('0x51')]=function(_0x58b562,_0x1152f6,_0x110375){var _0x2c341f={};var _0x3f60f1={};var _0x5c8f26;var _0x4b51f1;return db[_0x35a6('0x2c')][_0x35a6('0x4c')]({'where':{'id':_0x58b562['params']['id']}})[_0x35a6('0x25')](handleEntityNotFound(_0x1152f6,null))[_0x35a6('0x25')](function(_0x1f5a4b){if(_0x1f5a4b){_0x5c8f26=_0x1f5a4b;_0x3f60f1[_0x35a6('0x30')]=_[_0x35a6('0x45')](db[_0x35a6('0x52')][_0x35a6('0x2d')]);_0x3f60f1[_0x35a6('0x31')]=_['keys'](_0x58b562[_0x35a6('0x31')]);_0x3f60f1[_0x35a6('0x32')]=_['intersection'](_0x3f60f1['model'],_0x3f60f1[_0x35a6('0x31')]);_0x2c341f[_0x35a6('0x35')]=_[_0x35a6('0x33')](_0x3f60f1[_0x35a6('0x30')],qs[_0x35a6('0x34')](_0x58b562['query'][_0x35a6('0x34')]));_0x2c341f[_0x35a6('0x35')]=_0x2c341f[_0x35a6('0x35')][_0x35a6('0x36')]?_0x2c341f['attributes']:_0x3f60f1['model'];_0x2c341f['order']=qs[_0x35a6('0x39')](_0x58b562['query'][_0x35a6('0x39')]);_0x2c341f[_0x35a6('0x3a')]=qs[_0x35a6('0x32')](_[_0x35a6('0x3b')](_0x58b562[_0x35a6('0x31')],_0x3f60f1[_0x35a6('0x32')]));if(_0x58b562[_0x35a6('0x31')]['filter']){_0x2c341f[_0x35a6('0x3a')]=_[_0x35a6('0x3d')](_0x2c341f[_0x35a6('0x3a')],{'$or':_[_0x35a6('0x2b')](_0x2c341f[_0x35a6('0x35')],function(_0x3de110){var _0x508f0c={};_0x508f0c[_0x3de110]={'$like':'%'+_0x58b562[_0x35a6('0x31')][_0x35a6('0x3c')]+'%'};return _0x508f0c;})});}_0x2c341f=_[_0x35a6('0x3d')]({},_0x2c341f,_0x58b562['options']);return _0x5c8f26[_0x35a6('0x51')](_0x2c341f);}})[_0x35a6('0x25')](function(_0x1f3a0c){if(_0x1f3a0c){_0x4b51f1=_0x1f3a0c[_0x35a6('0x36')];if(!_0x58b562[_0x35a6('0x31')][_0x35a6('0x37')](_0x35a6('0x4e'))){_0x2c341f[_0x35a6('0x1e')]=qs[_0x35a6('0x1e')](_0x58b562[_0x35a6('0x31')][_0x35a6('0x1e')]);_0x2c341f[_0x35a6('0x1c')]=qs['offset'](_0x58b562['query'][_0x35a6('0x1c')]);}return _0x5c8f26[_0x35a6('0x51')](_0x2c341f);}})[_0x35a6('0x25')](function(_0x29eda7){if(_0x29eda7){return _0x29eda7?{'count':_0x4b51f1,'rows':_0x29eda7}:null;}})[_0x35a6('0x25')](respondWithResult(_0x1152f6,null))[_0x35a6('0x48')](handleError(_0x1152f6,null));};exports[_0x35a6('0x53')]=function(_0xde209,_0x4d532d,_0x5e7dca){if(_0xde209[_0x35a6('0x4a')]['id']){delete _0xde209[_0x35a6('0x4a')]['id'];}return db[_0x35a6('0x2c')][_0x35a6('0x4c')]({'where':{'id':_0xde209[_0x35a6('0x44')]['id']}})[_0x35a6('0x25')](handleEntityNotFound(_0x4d532d,null))[_0x35a6('0x25')](function(_0x502b7b){if(_0x502b7b){return _0x502b7b[_0x35a6('0x53')](_0xde209['body']['ids']||[]);}return null;})[_0x35a6('0x25')](respondWithResult(_0x4d532d,null))[_0x35a6('0x48')](handleError(_0x4d532d,null));};
\ No newline at end of file
+var _0x378f=['Tag','getTags','setTags','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','apply','reject','save','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','filters','intersection','model','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','DeskConfiguration','includeAll','findAll','catch','show','options','find','create','body','params','getFields','findOne','getSubjects','DeskField','getDescriptions'];(function(_0x3ebce0,_0x10bb8b){var _0x1458ae=function(_0xcbcdc1){while(--_0xcbcdc1){_0x3ebce0['push'](_0x3ebce0['shift']());}};_0x1458ae(++_0x10bb8b);}(_0x378f,0x1e3));var _0xf378=function(_0x214be1,_0x424ae0){_0x214be1=_0x214be1-0x0;var _0x4fa0c2=_0x378f[_0x214be1];return _0x4fa0c2;};'use strict';var emlformat=require(_0xf378('0x0'));var rimraf=require(_0xf378('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf378('0x2'));var moment=require(_0xf378('0x3'));var BPromise=require(_0xf378('0x4'));var Mustache=require(_0xf378('0x5'));var util=require('util');var path=require(_0xf378('0x6'));var sox=require(_0xf378('0x7'));var csv=require(_0xf378('0x8'));var ejs=require(_0xf378('0x9'));var fs=require('fs');var fs_extra=require(_0xf378('0xa'));var _=require(_0xf378('0xb'));var squel=require(_0xf378('0xc'));var crypto=require(_0xf378('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf378('0xe'));var toCsv=require(_0xf378('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf378('0xf'));var authService=require(_0xf378('0x10'));var qs=require(_0xf378('0x11'));var as=require(_0xf378('0x12'));var hardwareService=require(_0xf378('0x13'));var logger=require(_0xf378('0x14'))(_0xf378('0x15'));var utils=require(_0xf378('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf378('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x108e40,_0xce6e08){_0xce6e08=_0xce6e08||0xcc;return function(_0x52445c){if(_0x52445c){return _0x108e40[_0xf378('0x18')](_0xce6e08);}return _0x108e40[_0xf378('0x19')](_0xce6e08)['end']();};}function respondWithResult(_0x1a88a5,_0x22f0c7){_0x22f0c7=_0x22f0c7||0xc8;return function(_0x3e2202){if(_0x3e2202){return _0x1a88a5['status'](_0x22f0c7)[_0xf378('0x1a')](_0x3e2202);}};}function respondWithFilteredResult(_0x2145f4,_0x68e684){return function(_0x120596){if(_0x120596){var _0x27a389=typeof _0x68e684[_0xf378('0x1b')]===_0xf378('0x1c')&&typeof _0x68e684['limit']==='undefined';var _0x10ae33=_0x120596[_0xf378('0x1d')];var _0x278ca1=_0x27a389?0x0:_0x68e684[_0xf378('0x1b')];var _0xcb0a9=_0x27a389?_0x120596['count']:_0x68e684[_0xf378('0x1b')]+_0x68e684[_0xf378('0x1e')];var _0x51a565;if(_0xcb0a9>=_0x10ae33){_0xcb0a9=_0x10ae33;_0x51a565=0xc8;}else{_0x51a565=0xce;}_0x2145f4[_0xf378('0x19')](_0x51a565);return _0x2145f4['set']('Content-Range',_0x278ca1+'-'+_0xcb0a9+'/'+_0x10ae33)['json'](_0x120596);}return null;};}function patchUpdates(_0x4a79cd){return function(_0x3cb08d){try{jsonpatch[_0xf378('0x1f')](_0x3cb08d,_0x4a79cd,!![]);}catch(_0x19b29e){return BPromise[_0xf378('0x20')](_0x19b29e);}return _0x3cb08d[_0xf378('0x21')]();};}function saveUpdates(_0x276c38,_0x38919c){return function(_0x30f71a){if(_0x30f71a){return _0x30f71a[_0xf378('0x22')](_0x276c38)[_0xf378('0x23')](function(_0x845f64){return _0x845f64;});}return null;};}function removeEntity(_0x2eda75,_0x121667){return function(_0x1682e6){if(_0x1682e6){return _0x1682e6['destroy']()['then'](function(){_0x2eda75[_0xf378('0x19')](0xcc)[_0xf378('0x24')]();});}};}function handleEntityNotFound(_0x389062,_0xb4f750){return function(_0x591771){if(!_0x591771){_0x389062['sendStatus'](0x194);}return _0x591771;};}function handleError(_0x5708ed,_0x1d5c29){_0x1d5c29=_0x1d5c29||0x1f4;return function(_0x2dacea){logger[_0xf378('0x25')](_0x2dacea[_0xf378('0x26')]);if(_0x2dacea[_0xf378('0x27')]){delete _0x2dacea['name'];}_0x5708ed[_0xf378('0x19')](_0x1d5c29)[_0xf378('0x28')](_0x2dacea);};}exports[_0xf378('0x29')]=function(_0x21fe7e,_0x34487f){var _0x7ef925={},_0x11dea2={},_0x276e1b={'count':0x0,'rows':[]};var _0x2978e9=_[_0xf378('0x2a')](db['DeskConfiguration'][_0xf378('0x2b')],function(_0x5972e9){return{'name':_0x5972e9[_0xf378('0x2c')],'type':_0x5972e9[_0xf378('0x2d')]['key']};});_0x11dea2['model']=_[_0xf378('0x2a')](_0x2978e9,_0xf378('0x27'));_0x11dea2['query']=_[_0xf378('0x2e')](_0x21fe7e['query']);_0x11dea2[_0xf378('0x2f')]=_[_0xf378('0x30')](_0x11dea2[_0xf378('0x31')],_0x11dea2['query']);_0x7ef925[_0xf378('0x32')]=_['intersection'](_0x11dea2[_0xf378('0x31')],qs[_0xf378('0x33')](_0x21fe7e['query'][_0xf378('0x33')]));_0x7ef925[_0xf378('0x32')]=_0x7ef925['attributes'][_0xf378('0x34')]?_0x7ef925[_0xf378('0x32')]:_0x11dea2['model'];if(!_0x21fe7e[_0xf378('0x35')][_0xf378('0x36')](_0xf378('0x37'))){_0x7ef925[_0xf378('0x1e')]=qs[_0xf378('0x1e')](_0x21fe7e[_0xf378('0x35')][_0xf378('0x1e')]);_0x7ef925[_0xf378('0x1b')]=qs[_0xf378('0x1b')](_0x21fe7e[_0xf378('0x35')]['offset']);}_0x7ef925[_0xf378('0x38')]=qs[_0xf378('0x39')](_0x21fe7e['query'][_0xf378('0x39')]);_0x7ef925['where']=qs['filters'](_[_0xf378('0x3a')](_0x21fe7e[_0xf378('0x35')],_0x11dea2[_0xf378('0x2f')]),_0x2978e9);if(_0x21fe7e[_0xf378('0x35')][_0xf378('0x3b')]){_0x7ef925[_0xf378('0x3c')]=_[_0xf378('0x3d')](_0x7ef925[_0xf378('0x3c')],{'$or':_[_0xf378('0x2a')](_0x2978e9,function(_0x3d387d){if(_0x3d387d['type']!=='VIRTUAL'){var _0x486ceb={};_0x486ceb[_0x3d387d[_0xf378('0x27')]]={'$like':'%'+_0x21fe7e[_0xf378('0x35')][_0xf378('0x3b')]+'%'};return _0x486ceb;}})});}_0x7ef925=_[_0xf378('0x3d')]({},_0x7ef925,_0x21fe7e['options']);var _0x445577={'where':_0x7ef925[_0xf378('0x3c')]};return db[_0xf378('0x3e')][_0xf378('0x1d')](_0x445577)[_0xf378('0x23')](function(_0x48a855){_0x276e1b['count']=_0x48a855;if(_0x21fe7e[_0xf378('0x35')][_0xf378('0x3f')]){_0x7ef925['include']=[{'all':!![]}];}return db[_0xf378('0x3e')][_0xf378('0x40')](_0x7ef925);})[_0xf378('0x23')](function(_0x4b6f55){_0x276e1b['rows']=_0x4b6f55;return _0x276e1b;})[_0xf378('0x23')](respondWithFilteredResult(_0x34487f,_0x7ef925))[_0xf378('0x41')](handleError(_0x34487f,null));};exports[_0xf378('0x42')]=function(_0x3f07de,_0x522879){var _0xce6ee={'raw':![],'where':{'id':_0x3f07de['params']['id']}},_0xfe63ef={};_0xfe63ef[_0xf378('0x31')]=_['keys'](db[_0xf378('0x3e')]['rawAttributes']);_0xfe63ef[_0xf378('0x35')]=_[_0xf378('0x2e')](_0x3f07de[_0xf378('0x35')]);_0xfe63ef[_0xf378('0x2f')]=_[_0xf378('0x30')](_0xfe63ef[_0xf378('0x31')],_0xfe63ef[_0xf378('0x35')]);_0xce6ee[_0xf378('0x32')]=_['intersection'](_0xfe63ef[_0xf378('0x31')],qs[_0xf378('0x33')](_0x3f07de[_0xf378('0x35')][_0xf378('0x33')]));_0xce6ee[_0xf378('0x32')]=_0xce6ee[_0xf378('0x32')][_0xf378('0x34')]?_0xce6ee[_0xf378('0x32')]:_0xfe63ef[_0xf378('0x31')];if(_0x3f07de[_0xf378('0x35')][_0xf378('0x3f')]){_0xce6ee['include']=[{'all':!![]}];}_0xce6ee=_['merge']({},_0xce6ee,_0x3f07de[_0xf378('0x43')]);return db['DeskConfiguration'][_0xf378('0x44')](_0xce6ee)['then'](handleEntityNotFound(_0x522879,null))['then'](respondWithResult(_0x522879,null))[_0xf378('0x41')](handleError(_0x522879,null));};exports[_0xf378('0x45')]=function(_0x3b06c3,_0x5d4691){return db[_0xf378('0x3e')][_0xf378('0x45')](_0x3b06c3['body'],{})[_0xf378('0x23')](respondWithResult(_0x5d4691,0xc9))[_0xf378('0x41')](handleError(_0x5d4691,null));};exports[_0xf378('0x22')]=function(_0x1f879f,_0x5290f8){if(_0x1f879f[_0xf378('0x46')]['id']){delete _0x1f879f[_0xf378('0x46')]['id'];}return db[_0xf378('0x3e')]['find']({'where':{'id':_0x1f879f[_0xf378('0x47')]['id']}})['then'](handleEntityNotFound(_0x5290f8,null))[_0xf378('0x23')](saveUpdates(_0x1f879f[_0xf378('0x46')],null))['then'](respondWithResult(_0x5290f8,null))['catch'](handleError(_0x5290f8,null));};exports['destroy']=function(_0x13360f,_0x4a611d){return db[_0xf378('0x3e')][_0xf378('0x44')]({'where':{'id':_0x13360f[_0xf378('0x47')]['id']}})['then'](handleEntityNotFound(_0x4a611d,null))['then'](removeEntity(_0x4a611d,null))[_0xf378('0x41')](handleError(_0x4a611d,null));};exports[_0xf378('0x48')]=function(_0x2ccce2,_0x556a77,_0x413301){var _0x5132d1={};var _0xd24ae7={};var _0x1b6b39;var _0x3f26;return db[_0xf378('0x3e')][_0xf378('0x49')]({'where':{'id':_0x2ccce2[_0xf378('0x47')]['id']}})['then'](handleEntityNotFound(_0x556a77,null))[_0xf378('0x23')](function(_0x924f0b){if(_0x924f0b){_0x1b6b39=_0x924f0b;_0xd24ae7[_0xf378('0x31')]=_[_0xf378('0x2e')](db['DeskField'][_0xf378('0x2b')]);_0xd24ae7[_0xf378('0x35')]=_[_0xf378('0x2e')](_0x2ccce2['query']);_0xd24ae7[_0xf378('0x2f')]=_[_0xf378('0x30')](_0xd24ae7[_0xf378('0x31')],_0xd24ae7['query']);_0x5132d1[_0xf378('0x32')]=_['intersection'](_0xd24ae7[_0xf378('0x31')],qs['fields'](_0x2ccce2[_0xf378('0x35')][_0xf378('0x33')]));_0x5132d1[_0xf378('0x32')]=_0x5132d1[_0xf378('0x32')][_0xf378('0x34')]?_0x5132d1[_0xf378('0x32')]:_0xd24ae7[_0xf378('0x31')];_0x5132d1['order']=qs[_0xf378('0x39')](_0x2ccce2['query'][_0xf378('0x39')]);_0x5132d1[_0xf378('0x3c')]=qs[_0xf378('0x2f')](_[_0xf378('0x3a')](_0x2ccce2[_0xf378('0x35')],_0xd24ae7['filters']));if(_0x2ccce2[_0xf378('0x35')][_0xf378('0x3b')]){_0x5132d1[_0xf378('0x3c')]=_['merge'](_0x5132d1['where'],{'$or':_['map'](_0x5132d1[_0xf378('0x32')],function(_0x1b27e0){var _0x5687c4={};_0x5687c4[_0x1b27e0]={'$like':'%'+_0x2ccce2[_0xf378('0x35')]['filter']+'%'};return _0x5687c4;})});}_0x5132d1=_[_0xf378('0x3d')]({},_0x5132d1,_0x2ccce2[_0xf378('0x43')]);return _0x1b6b39['getFields'](_0x5132d1);}})[_0xf378('0x23')](function(_0x87e416){if(_0x87e416){_0x3f26=_0x87e416['length'];if(!_0x2ccce2[_0xf378('0x35')]['hasOwnProperty'](_0xf378('0x37'))){_0x5132d1[_0xf378('0x1e')]=qs[_0xf378('0x1e')](_0x2ccce2[_0xf378('0x35')][_0xf378('0x1e')]);_0x5132d1[_0xf378('0x1b')]=qs['offset'](_0x2ccce2[_0xf378('0x35')]['offset']);}return _0x1b6b39[_0xf378('0x48')](_0x5132d1);}})[_0xf378('0x23')](function(_0x20666b){if(_0x20666b){return _0x20666b?{'count':_0x3f26,'rows':_0x20666b}:null;}})['then'](respondWithResult(_0x556a77,null))[_0xf378('0x41')](handleError(_0x556a77,null));};exports[_0xf378('0x4a')]=function(_0x41938c,_0x350ca4,_0xf85730){var _0x18af55={};var _0x185626={};var _0x23785d;var _0x4221e6;return db[_0xf378('0x3e')][_0xf378('0x49')]({'where':{'id':_0x41938c[_0xf378('0x47')]['id']}})[_0xf378('0x23')](handleEntityNotFound(_0x350ca4,null))['then'](function(_0x1c9cc2){if(_0x1c9cc2){_0x23785d=_0x1c9cc2;_0x185626[_0xf378('0x31')]=_[_0xf378('0x2e')](db[_0xf378('0x4b')][_0xf378('0x2b')]);_0x185626['query']=_[_0xf378('0x2e')](_0x41938c['query']);_0x185626[_0xf378('0x2f')]=_[_0xf378('0x30')](_0x185626[_0xf378('0x31')],_0x185626[_0xf378('0x35')]);_0x18af55['attributes']=_['intersection'](_0x185626[_0xf378('0x31')],qs['fields'](_0x41938c[_0xf378('0x35')]['fields']));_0x18af55['attributes']=_0x18af55[_0xf378('0x32')][_0xf378('0x34')]?_0x18af55[_0xf378('0x32')]:_0x185626[_0xf378('0x31')];_0x18af55[_0xf378('0x38')]=qs[_0xf378('0x39')](_0x41938c['query'][_0xf378('0x39')]);_0x18af55[_0xf378('0x3c')]=qs[_0xf378('0x2f')](_[_0xf378('0x3a')](_0x41938c[_0xf378('0x35')],_0x185626[_0xf378('0x2f')]));if(_0x41938c['query'][_0xf378('0x3b')]){_0x18af55[_0xf378('0x3c')]=_[_0xf378('0x3d')](_0x18af55[_0xf378('0x3c')],{'$or':_['map'](_0x18af55['attributes'],function(_0x59403b){var _0x2bd04b={};_0x2bd04b[_0x59403b]={'$like':'%'+_0x41938c[_0xf378('0x35')]['filter']+'%'};return _0x2bd04b;})});}_0x18af55=_[_0xf378('0x3d')]({},_0x18af55,_0x41938c[_0xf378('0x43')]);return _0x23785d[_0xf378('0x4a')](_0x18af55);}})[_0xf378('0x23')](function(_0x2f8fd3){if(_0x2f8fd3){_0x4221e6=_0x2f8fd3[_0xf378('0x34')];if(!_0x41938c[_0xf378('0x35')][_0xf378('0x36')](_0xf378('0x37'))){_0x18af55[_0xf378('0x1e')]=qs[_0xf378('0x1e')](_0x41938c['query'][_0xf378('0x1e')]);_0x18af55[_0xf378('0x1b')]=qs[_0xf378('0x1b')](_0x41938c[_0xf378('0x35')][_0xf378('0x1b')]);}return _0x23785d[_0xf378('0x4a')](_0x18af55);}})['then'](function(_0x43cacb){if(_0x43cacb){return _0x43cacb?{'count':_0x4221e6,'rows':_0x43cacb}:null;}})['then'](respondWithResult(_0x350ca4,null))[_0xf378('0x41')](handleError(_0x350ca4,null));};exports['getDescriptions']=function(_0x38989f,_0x535342,_0x572e68){var _0x3a551a={};var _0x343398={};var _0x439826;var _0x38cb49;return db[_0xf378('0x3e')][_0xf378('0x49')]({'where':{'id':_0x38989f[_0xf378('0x47')]['id']}})[_0xf378('0x23')](handleEntityNotFound(_0x535342,null))[_0xf378('0x23')](function(_0x2cc7f5){if(_0x2cc7f5){_0x439826=_0x2cc7f5;_0x343398['model']=_[_0xf378('0x2e')](db['DeskField'][_0xf378('0x2b')]);_0x343398[_0xf378('0x35')]=_[_0xf378('0x2e')](_0x38989f['query']);_0x343398[_0xf378('0x2f')]=_[_0xf378('0x30')](_0x343398['model'],_0x343398['query']);_0x3a551a[_0xf378('0x32')]=_[_0xf378('0x30')](_0x343398['model'],qs[_0xf378('0x33')](_0x38989f[_0xf378('0x35')][_0xf378('0x33')]));_0x3a551a[_0xf378('0x32')]=_0x3a551a[_0xf378('0x32')]['length']?_0x3a551a[_0xf378('0x32')]:_0x343398[_0xf378('0x31')];_0x3a551a[_0xf378('0x38')]=qs[_0xf378('0x39')](_0x38989f[_0xf378('0x35')][_0xf378('0x39')]);_0x3a551a[_0xf378('0x3c')]=qs[_0xf378('0x2f')](_[_0xf378('0x3a')](_0x38989f['query'],_0x343398[_0xf378('0x2f')]));if(_0x38989f[_0xf378('0x35')]['filter']){_0x3a551a[_0xf378('0x3c')]=_[_0xf378('0x3d')](_0x3a551a[_0xf378('0x3c')],{'$or':_[_0xf378('0x2a')](_0x3a551a[_0xf378('0x32')],function(_0x28202e){var _0x49334d={};_0x49334d[_0x28202e]={'$like':'%'+_0x38989f['query'][_0xf378('0x3b')]+'%'};return _0x49334d;})});}_0x3a551a=_[_0xf378('0x3d')]({},_0x3a551a,_0x38989f[_0xf378('0x43')]);return _0x439826[_0xf378('0x4c')](_0x3a551a);}})[_0xf378('0x23')](function(_0x1f0de8){if(_0x1f0de8){_0x38cb49=_0x1f0de8['length'];if(!_0x38989f[_0xf378('0x35')][_0xf378('0x36')]('nolimit')){_0x3a551a['limit']=qs[_0xf378('0x1e')](_0x38989f[_0xf378('0x35')][_0xf378('0x1e')]);_0x3a551a[_0xf378('0x1b')]=qs['offset'](_0x38989f['query']['offset']);}return _0x439826[_0xf378('0x4c')](_0x3a551a);}})[_0xf378('0x23')](function(_0x5be28b){if(_0x5be28b){return _0x5be28b?{'count':_0x38cb49,'rows':_0x5be28b}:null;}})['then'](respondWithResult(_0x535342,null))[_0xf378('0x41')](handleError(_0x535342,null));};exports['getTags']=function(_0x5974fd,_0x5e9f2a,_0x2f2161){var _0x5af4e4={};var _0x302357={};var _0x50abe2;var _0x270269;return db[_0xf378('0x3e')][_0xf378('0x49')]({'where':{'id':_0x5974fd[_0xf378('0x47')]['id']}})[_0xf378('0x23')](handleEntityNotFound(_0x5e9f2a,null))[_0xf378('0x23')](function(_0x52fb86){if(_0x52fb86){_0x50abe2=_0x52fb86;_0x302357[_0xf378('0x31')]=_[_0xf378('0x2e')](db[_0xf378('0x4d')]['rawAttributes']);_0x302357[_0xf378('0x35')]=_[_0xf378('0x2e')](_0x5974fd[_0xf378('0x35')]);_0x302357[_0xf378('0x2f')]=_['intersection'](_0x302357[_0xf378('0x31')],_0x302357['query']);_0x5af4e4['attributes']=_[_0xf378('0x30')](_0x302357[_0xf378('0x31')],qs[_0xf378('0x33')](_0x5974fd[_0xf378('0x35')][_0xf378('0x33')]));_0x5af4e4[_0xf378('0x32')]=_0x5af4e4[_0xf378('0x32')][_0xf378('0x34')]?_0x5af4e4[_0xf378('0x32')]:_0x302357[_0xf378('0x31')];_0x5af4e4[_0xf378('0x38')]=qs[_0xf378('0x39')](_0x5974fd[_0xf378('0x35')]['sort']);_0x5af4e4['where']=qs[_0xf378('0x2f')](_[_0xf378('0x3a')](_0x5974fd[_0xf378('0x35')],_0x302357[_0xf378('0x2f')]));if(_0x5974fd[_0xf378('0x35')][_0xf378('0x3b')]){_0x5af4e4['where']=_[_0xf378('0x3d')](_0x5af4e4['where'],{'$or':_[_0xf378('0x2a')](_0x5af4e4[_0xf378('0x32')],function(_0x107d69){var _0x5b243a={};_0x5b243a[_0x107d69]={'$like':'%'+_0x5974fd[_0xf378('0x35')]['filter']+'%'};return _0x5b243a;})});}_0x5af4e4=_['merge']({},_0x5af4e4,_0x5974fd[_0xf378('0x43')]);return _0x50abe2[_0xf378('0x4e')](_0x5af4e4);}})['then'](function(_0x24bd50){if(_0x24bd50){_0x270269=_0x24bd50[_0xf378('0x34')];if(!_0x5974fd['query'][_0xf378('0x36')](_0xf378('0x37'))){_0x5af4e4[_0xf378('0x1e')]=qs['limit'](_0x5974fd[_0xf378('0x35')][_0xf378('0x1e')]);_0x5af4e4[_0xf378('0x1b')]=qs[_0xf378('0x1b')](_0x5974fd[_0xf378('0x35')][_0xf378('0x1b')]);}return _0x50abe2[_0xf378('0x4e')](_0x5af4e4);}})[_0xf378('0x23')](function(_0x5703d4){if(_0x5703d4){return _0x5703d4?{'count':_0x270269,'rows':_0x5703d4}:null;}})[_0xf378('0x23')](respondWithResult(_0x5e9f2a,null))[_0xf378('0x41')](handleError(_0x5e9f2a,null));};exports['setTags']=function(_0x20e17c,_0xfb81a1,_0x3c3bd1){if(_0x20e17c[_0xf378('0x46')]['id']){delete _0x20e17c[_0xf378('0x46')]['id'];}return db[_0xf378('0x3e')][_0xf378('0x49')]({'where':{'id':_0x20e17c[_0xf378('0x47')]['id']}})[_0xf378('0x23')](handleEntityNotFound(_0xfb81a1,null))[_0xf378('0x23')](function(_0x4e934c){if(_0x4e934c){return _0x4e934c[_0xf378('0x4f')](_0x20e17c[_0xf378('0x46')]['ids']||[]);}return null;})[_0xf378('0x23')](respondWithResult(_0xfb81a1,null))[_0xf378('0x41')](handleError(_0xfb81a1,null));};
\ No newline at end of file