Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / intDeskConfiguration / intDeskConfiguration.controller.js
index bdf9f6f..cacc7ee 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-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
+var _0xd65e=['fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','type','key','keys','filters','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','DeskConfiguration','includeAll','include','rows','catch','show','create','body','find','params','getFields','DeskField','order','findOne','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir'];(function(_0x2913a7,_0x4268b7){var _0x59e65c=function(_0x51f57b){while(--_0x51f57b){_0x2913a7['push'](_0x2913a7['shift']());}};_0x59e65c(++_0x4268b7);}(_0xd65e,0x1a1));var _0xed65=function(_0x3f1b38,_0x584f4e){_0x3f1b38=_0x3f1b38-0x0;var _0x569583=_0xd65e[_0x3f1b38];return _0x569583;};'use strict';var emlformat=require(_0xed65('0x0'));var rimraf=require(_0xed65('0x1'));var zipdir=require(_0xed65('0x2'));var jsonpatch=require(_0xed65('0x3'));var rp=require(_0xed65('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xed65('0x5'));var util=require(_0xed65('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xed65('0x7'));var ejs=require(_0xed65('0x8'));var fs=require('fs');var fs_extra=require(_0xed65('0x9'));var _=require(_0xed65('0xa'));var squel=require(_0xed65('0xb'));var crypto=require(_0xed65('0xc'));var jsforce=require(_0xed65('0xd'));var deskjs=require(_0xed65('0xe'));var toCsv=require(_0xed65('0x7'));var querystring=require(_0xed65('0xf'));var Papa=require(_0xed65('0x10'));var Redis=require(_0xed65('0x11'));var authService=require(_0xed65('0x12'));var qs=require(_0xed65('0x13'));var as=require(_0xed65('0x14'));var hardwareService=require(_0xed65('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xed65('0x16'));var config=require(_0xed65('0x17'));var licenseUtil=require(_0xed65('0x18'));var db=require(_0xed65('0x19'))['db'];function respondWithStatusCode(_0x3ca2fb,_0x2afdaa){_0x2afdaa=_0x2afdaa||0xcc;return function(_0x7eef5b){if(_0x7eef5b){return _0x3ca2fb[_0xed65('0x1a')](_0x2afdaa);}return _0x3ca2fb[_0xed65('0x1b')](_0x2afdaa)['end']();};}function respondWithResult(_0x341528,_0x4e37f7){_0x4e37f7=_0x4e37f7||0xc8;return function(_0x3128dc){if(_0x3128dc){return _0x341528[_0xed65('0x1b')](_0x4e37f7)['json'](_0x3128dc);}};}function respondWithFilteredResult(_0x1b70a5,_0xa4e5e3){return function(_0xc716b8){if(_0xc716b8){var _0x1bc1b5=typeof _0xa4e5e3[_0xed65('0x1c')]===_0xed65('0x1d')&&typeof _0xa4e5e3[_0xed65('0x1e')]===_0xed65('0x1d');var _0x527014=_0xc716b8[_0xed65('0x1f')];var _0x3ec6e6=_0x1bc1b5?0x0:_0xa4e5e3[_0xed65('0x1c')];var _0x5698e8=_0x1bc1b5?_0xc716b8['count']:_0xa4e5e3[_0xed65('0x1c')]+_0xa4e5e3['limit'];var _0x52b30f;if(_0x5698e8>=_0x527014){_0x5698e8=_0x527014;_0x52b30f=0xc8;}else{_0x52b30f=0xce;}_0x1b70a5[_0xed65('0x1b')](_0x52b30f);return _0x1b70a5[_0xed65('0x20')](_0xed65('0x21'),_0x3ec6e6+'-'+_0x5698e8+'/'+_0x527014)['json'](_0xc716b8);}return null;};}function patchUpdates(_0x4b7239){return function(_0x156164){try{jsonpatch['apply'](_0x156164,_0x4b7239,!![]);}catch(_0x2f73aa){return BPromise[_0xed65('0x22')](_0x2f73aa);}return _0x156164[_0xed65('0x23')]();};}function saveUpdates(_0x4cbfc2,_0x928d80){return function(_0x2fa1cc){if(_0x2fa1cc){return _0x2fa1cc[_0xed65('0x24')](_0x4cbfc2)[_0xed65('0x25')](function(_0x1d2909){return _0x1d2909;});}return null;};}function removeEntity(_0x465f23,_0x8f84fb){return function(_0x15af7b){if(_0x15af7b){return _0x15af7b[_0xed65('0x26')]()[_0xed65('0x25')](function(){_0x465f23[_0xed65('0x1b')](0xcc)[_0xed65('0x27')]();});}};}function handleEntityNotFound(_0x40d486,_0x140daa){return function(_0xa214b5){if(!_0xa214b5){_0x40d486[_0xed65('0x1a')](0x194);}return _0xa214b5;};}function handleError(_0x541491,_0x4cf46e){_0x4cf46e=_0x4cf46e||0x1f4;return function(_0x400a0b){logger[_0xed65('0x28')](_0x400a0b['stack']);if(_0x400a0b[_0xed65('0x29')]){delete _0x400a0b[_0xed65('0x29')];}_0x541491[_0xed65('0x1b')](_0x4cf46e)[_0xed65('0x2a')](_0x400a0b);};}exports[_0xed65('0x2b')]=function(_0x1c1109,_0x11e3ba){var _0x10f11f={},_0xe499a7={},_0x3ea5b0={'count':0x0,'rows':[]};var _0x4d772b=_[_0xed65('0x2c')](db['DeskConfiguration'][_0xed65('0x2d')],function(_0x31ea58){return{'name':_0x31ea58['fieldName'],'type':_0x31ea58[_0xed65('0x2e')][_0xed65('0x2f')]};});_0xe499a7['model']=_[_0xed65('0x2c')](_0x4d772b,_0xed65('0x29'));_0xe499a7['query']=_[_0xed65('0x30')](_0x1c1109['query']);_0xe499a7[_0xed65('0x31')]=_['intersection'](_0xe499a7['model'],_0xe499a7[_0xed65('0x32')]);_0x10f11f[_0xed65('0x33')]=_[_0xed65('0x34')](_0xe499a7[_0xed65('0x35')],qs[_0xed65('0x36')](_0x1c1109[_0xed65('0x32')][_0xed65('0x36')]));_0x10f11f[_0xed65('0x33')]=_0x10f11f[_0xed65('0x33')][_0xed65('0x37')]?_0x10f11f[_0xed65('0x33')]:_0xe499a7['model'];if(!_0x1c1109['query'][_0xed65('0x38')](_0xed65('0x39'))){_0x10f11f[_0xed65('0x1e')]=qs['limit'](_0x1c1109[_0xed65('0x32')][_0xed65('0x1e')]);_0x10f11f[_0xed65('0x1c')]=qs[_0xed65('0x1c')](_0x1c1109[_0xed65('0x32')][_0xed65('0x1c')]);}_0x10f11f['order']=qs[_0xed65('0x3a')](_0x1c1109[_0xed65('0x32')]['sort']);_0x10f11f[_0xed65('0x3b')]=qs[_0xed65('0x31')](_[_0xed65('0x3c')](_0x1c1109[_0xed65('0x32')],_0xe499a7[_0xed65('0x31')]),_0x4d772b);if(_0x1c1109['query']['filter']){_0x10f11f['where']=_[_0xed65('0x3d')](_0x10f11f[_0xed65('0x3b')],{'$or':_[_0xed65('0x2c')](_0x4d772b,function(_0x1aeefa){if(_0x1aeefa['type']!=='VIRTUAL'){var _0x1f737a={};_0x1f737a[_0x1aeefa[_0xed65('0x29')]]={'$like':'%'+_0x1c1109[_0xed65('0x32')][_0xed65('0x3e')]+'%'};return _0x1f737a;}})});}_0x10f11f=_[_0xed65('0x3d')]({},_0x10f11f,_0x1c1109[_0xed65('0x3f')]);var _0x27533d={'where':_0x10f11f[_0xed65('0x3b')]};return db[_0xed65('0x40')]['count'](_0x27533d)['then'](function(_0x163256){_0x3ea5b0[_0xed65('0x1f')]=_0x163256;if(_0x1c1109[_0xed65('0x32')][_0xed65('0x41')]){_0x10f11f[_0xed65('0x42')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x10f11f);})['then'](function(_0x4ed0b1){_0x3ea5b0[_0xed65('0x43')]=_0x4ed0b1;return _0x3ea5b0;})[_0xed65('0x25')](respondWithFilteredResult(_0x11e3ba,_0x10f11f))[_0xed65('0x44')](handleError(_0x11e3ba,null));};exports[_0xed65('0x45')]=function(_0x48a278,_0x105142){var _0x5c0869={'raw':![],'where':{'id':_0x48a278['params']['id']}},_0x4f5137={};_0x4f5137[_0xed65('0x35')]=_['keys'](db[_0xed65('0x40')][_0xed65('0x2d')]);_0x4f5137['query']=_[_0xed65('0x30')](_0x48a278[_0xed65('0x32')]);_0x4f5137[_0xed65('0x31')]=_['intersection'](_0x4f5137[_0xed65('0x35')],_0x4f5137[_0xed65('0x32')]);_0x5c0869[_0xed65('0x33')]=_[_0xed65('0x34')](_0x4f5137[_0xed65('0x35')],qs[_0xed65('0x36')](_0x48a278[_0xed65('0x32')][_0xed65('0x36')]));_0x5c0869[_0xed65('0x33')]=_0x5c0869[_0xed65('0x33')][_0xed65('0x37')]?_0x5c0869[_0xed65('0x33')]:_0x4f5137[_0xed65('0x35')];if(_0x48a278[_0xed65('0x32')][_0xed65('0x41')]){_0x5c0869[_0xed65('0x42')]=[{'all':!![]}];}_0x5c0869=_[_0xed65('0x3d')]({},_0x5c0869,_0x48a278['options']);return db['DeskConfiguration']['find'](_0x5c0869)[_0xed65('0x25')](handleEntityNotFound(_0x105142,null))[_0xed65('0x25')](respondWithResult(_0x105142,null))[_0xed65('0x44')](handleError(_0x105142,null));};exports[_0xed65('0x46')]=function(_0x9abad7,_0x20fdc1){return db[_0xed65('0x40')][_0xed65('0x46')](_0x9abad7[_0xed65('0x47')],{})['then'](respondWithResult(_0x20fdc1,0xc9))[_0xed65('0x44')](handleError(_0x20fdc1,null));};exports[_0xed65('0x24')]=function(_0x48bacb,_0x1cd79b){if(_0x48bacb[_0xed65('0x47')]['id']){delete _0x48bacb[_0xed65('0x47')]['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x48bacb['params']['id']}})[_0xed65('0x25')](handleEntityNotFound(_0x1cd79b,null))[_0xed65('0x25')](saveUpdates(_0x48bacb['body'],null))['then'](respondWithResult(_0x1cd79b,null))[_0xed65('0x44')](handleError(_0x1cd79b,null));};exports[_0xed65('0x26')]=function(_0x37cf24,_0x5c8280){return db[_0xed65('0x40')][_0xed65('0x48')]({'where':{'id':_0x37cf24[_0xed65('0x49')]['id']}})[_0xed65('0x25')](handleEntityNotFound(_0x5c8280,null))[_0xed65('0x25')](removeEntity(_0x5c8280,null))[_0xed65('0x44')](handleError(_0x5c8280,null));};exports[_0xed65('0x4a')]=function(_0x29026c,_0x5b1ae0,_0x4e30c5){var _0x41a0e6={};var _0x5aa7a3={};var _0x4b00bf;var _0x104f24;return db[_0xed65('0x40')]['findOne']({'where':{'id':_0x29026c[_0xed65('0x49')]['id']}})['then'](handleEntityNotFound(_0x5b1ae0,null))[_0xed65('0x25')](function(_0x1a2b3e){if(_0x1a2b3e){_0x4b00bf=_0x1a2b3e;_0x5aa7a3[_0xed65('0x35')]=_[_0xed65('0x30')](db[_0xed65('0x4b')][_0xed65('0x2d')]);_0x5aa7a3[_0xed65('0x32')]=_[_0xed65('0x30')](_0x29026c[_0xed65('0x32')]);_0x5aa7a3[_0xed65('0x31')]=_[_0xed65('0x34')](_0x5aa7a3['model'],_0x5aa7a3[_0xed65('0x32')]);_0x41a0e6[_0xed65('0x33')]=_[_0xed65('0x34')](_0x5aa7a3[_0xed65('0x35')],qs['fields'](_0x29026c[_0xed65('0x32')][_0xed65('0x36')]));_0x41a0e6[_0xed65('0x33')]=_0x41a0e6['attributes']['length']?_0x41a0e6['attributes']:_0x5aa7a3[_0xed65('0x35')];_0x41a0e6[_0xed65('0x4c')]=qs[_0xed65('0x3a')](_0x29026c[_0xed65('0x32')][_0xed65('0x3a')]);_0x41a0e6[_0xed65('0x3b')]=qs[_0xed65('0x31')](_[_0xed65('0x3c')](_0x29026c['query'],_0x5aa7a3[_0xed65('0x31')]));if(_0x29026c['query'][_0xed65('0x3e')]){_0x41a0e6['where']=_['merge'](_0x41a0e6[_0xed65('0x3b')],{'$or':_['map'](_0x41a0e6[_0xed65('0x33')],function(_0x1759bb){var _0x7a7dc4={};_0x7a7dc4[_0x1759bb]={'$like':'%'+_0x29026c[_0xed65('0x32')][_0xed65('0x3e')]+'%'};return _0x7a7dc4;})});}_0x41a0e6=_[_0xed65('0x3d')]({},_0x41a0e6,_0x29026c[_0xed65('0x3f')]);return _0x4b00bf[_0xed65('0x4a')](_0x41a0e6);}})[_0xed65('0x25')](function(_0x2ae220){if(_0x2ae220){_0x104f24=_0x2ae220[_0xed65('0x37')];if(!_0x29026c[_0xed65('0x32')]['hasOwnProperty'](_0xed65('0x39'))){_0x41a0e6['limit']=qs[_0xed65('0x1e')](_0x29026c[_0xed65('0x32')][_0xed65('0x1e')]);_0x41a0e6[_0xed65('0x1c')]=qs[_0xed65('0x1c')](_0x29026c[_0xed65('0x32')][_0xed65('0x1c')]);}return _0x4b00bf[_0xed65('0x4a')](_0x41a0e6);}})[_0xed65('0x25')](function(_0x50af1a){if(_0x50af1a){return _0x50af1a?{'count':_0x104f24,'rows':_0x50af1a}:null;}})[_0xed65('0x25')](respondWithResult(_0x5b1ae0,null))['catch'](handleError(_0x5b1ae0,null));};exports['getSubjects']=function(_0x582e26,_0x862c9d,_0x3e331b){var _0x40c074={};var _0x3be62c={};var _0x2b5ca3;var _0x177cf6;return db[_0xed65('0x40')][_0xed65('0x4d')]({'where':{'id':_0x582e26[_0xed65('0x49')]['id']}})['then'](handleEntityNotFound(_0x862c9d,null))[_0xed65('0x25')](function(_0x1f05de){if(_0x1f05de){_0x2b5ca3=_0x1f05de;_0x3be62c[_0xed65('0x35')]=_[_0xed65('0x30')](db['DeskField']['rawAttributes']);_0x3be62c[_0xed65('0x32')]=_[_0xed65('0x30')](_0x582e26[_0xed65('0x32')]);_0x3be62c['filters']=_[_0xed65('0x34')](_0x3be62c[_0xed65('0x35')],_0x3be62c[_0xed65('0x32')]);_0x40c074[_0xed65('0x33')]=_[_0xed65('0x34')](_0x3be62c[_0xed65('0x35')],qs[_0xed65('0x36')](_0x582e26[_0xed65('0x32')][_0xed65('0x36')]));_0x40c074['attributes']=_0x40c074['attributes']['length']?_0x40c074['attributes']:_0x3be62c[_0xed65('0x35')];_0x40c074['order']=qs[_0xed65('0x3a')](_0x582e26[_0xed65('0x32')][_0xed65('0x3a')]);_0x40c074[_0xed65('0x3b')]=qs[_0xed65('0x31')](_[_0xed65('0x3c')](_0x582e26[_0xed65('0x32')],_0x3be62c[_0xed65('0x31')]));if(_0x582e26[_0xed65('0x32')][_0xed65('0x3e')]){_0x40c074[_0xed65('0x3b')]=_[_0xed65('0x3d')](_0x40c074[_0xed65('0x3b')],{'$or':_[_0xed65('0x2c')](_0x40c074[_0xed65('0x33')],function(_0x47b51e){var _0x332cdb={};_0x332cdb[_0x47b51e]={'$like':'%'+_0x582e26['query'][_0xed65('0x3e')]+'%'};return _0x332cdb;})});}_0x40c074=_['merge']({},_0x40c074,_0x582e26[_0xed65('0x3f')]);return _0x2b5ca3['getSubjects'](_0x40c074);}})['then'](function(_0x148837){if(_0x148837){_0x177cf6=_0x148837[_0xed65('0x37')];if(!_0x582e26[_0xed65('0x32')][_0xed65('0x38')](_0xed65('0x39'))){_0x40c074[_0xed65('0x1e')]=qs[_0xed65('0x1e')](_0x582e26['query'][_0xed65('0x1e')]);_0x40c074['offset']=qs[_0xed65('0x1c')](_0x582e26[_0xed65('0x32')][_0xed65('0x1c')]);}return _0x2b5ca3[_0xed65('0x4e')](_0x40c074);}})[_0xed65('0x25')](function(_0x5d65c9){if(_0x5d65c9){return _0x5d65c9?{'count':_0x177cf6,'rows':_0x5d65c9}:null;}})[_0xed65('0x25')](respondWithResult(_0x862c9d,null))[_0xed65('0x44')](handleError(_0x862c9d,null));};exports['getDescriptions']=function(_0x3adfa5,_0x3a4239,_0x22c3de){var _0x14be9c={};var _0x4052e4={};var _0x33b345;var _0x45568c;return db['DeskConfiguration'][_0xed65('0x4d')]({'where':{'id':_0x3adfa5[_0xed65('0x49')]['id']}})[_0xed65('0x25')](handleEntityNotFound(_0x3a4239,null))['then'](function(_0x46fa83){if(_0x46fa83){_0x33b345=_0x46fa83;_0x4052e4[_0xed65('0x35')]=_['keys'](db[_0xed65('0x4b')][_0xed65('0x2d')]);_0x4052e4['query']=_[_0xed65('0x30')](_0x3adfa5[_0xed65('0x32')]);_0x4052e4[_0xed65('0x31')]=_[_0xed65('0x34')](_0x4052e4[_0xed65('0x35')],_0x4052e4[_0xed65('0x32')]);_0x14be9c[_0xed65('0x33')]=_['intersection'](_0x4052e4[_0xed65('0x35')],qs['fields'](_0x3adfa5[_0xed65('0x32')][_0xed65('0x36')]));_0x14be9c[_0xed65('0x33')]=_0x14be9c[_0xed65('0x33')]['length']?_0x14be9c['attributes']:_0x4052e4[_0xed65('0x35')];_0x14be9c[_0xed65('0x4c')]=qs[_0xed65('0x3a')](_0x3adfa5[_0xed65('0x32')][_0xed65('0x3a')]);_0x14be9c[_0xed65('0x3b')]=qs[_0xed65('0x31')](_[_0xed65('0x3c')](_0x3adfa5[_0xed65('0x32')],_0x4052e4['filters']));if(_0x3adfa5['query'][_0xed65('0x3e')]){_0x14be9c[_0xed65('0x3b')]=_['merge'](_0x14be9c[_0xed65('0x3b')],{'$or':_[_0xed65('0x2c')](_0x14be9c[_0xed65('0x33')],function(_0xa163a5){var _0x2f45e6={};_0x2f45e6[_0xa163a5]={'$like':'%'+_0x3adfa5[_0xed65('0x32')][_0xed65('0x3e')]+'%'};return _0x2f45e6;})});}_0x14be9c=_[_0xed65('0x3d')]({},_0x14be9c,_0x3adfa5['options']);return _0x33b345[_0xed65('0x4f')](_0x14be9c);}})[_0xed65('0x25')](function(_0xa79dc5){if(_0xa79dc5){_0x45568c=_0xa79dc5[_0xed65('0x37')];if(!_0x3adfa5[_0xed65('0x32')][_0xed65('0x38')](_0xed65('0x39'))){_0x14be9c[_0xed65('0x1e')]=qs['limit'](_0x3adfa5['query'][_0xed65('0x1e')]);_0x14be9c[_0xed65('0x1c')]=qs[_0xed65('0x1c')](_0x3adfa5[_0xed65('0x32')][_0xed65('0x1c')]);}return _0x33b345[_0xed65('0x4f')](_0x14be9c);}})[_0xed65('0x25')](function(_0x537cb0){if(_0x537cb0){return _0x537cb0?{'count':_0x45568c,'rows':_0x537cb0}:null;}})[_0xed65('0x25')](respondWithResult(_0x3a4239,null))[_0xed65('0x44')](handleError(_0x3a4239,null));};exports[_0xed65('0x50')]=function(_0x41b810,_0x2c9044,_0x30b1dd){var _0x12287d={};var _0x115cf6={};var _0x558272;var _0x565d92;return db[_0xed65('0x40')][_0xed65('0x4d')]({'where':{'id':_0x41b810['params']['id']}})[_0xed65('0x25')](handleEntityNotFound(_0x2c9044,null))[_0xed65('0x25')](function(_0x55e35e){if(_0x55e35e){_0x558272=_0x55e35e;_0x115cf6[_0xed65('0x35')]=_[_0xed65('0x30')](db[_0xed65('0x51')]['rawAttributes']);_0x115cf6[_0xed65('0x32')]=_[_0xed65('0x30')](_0x41b810[_0xed65('0x32')]);_0x115cf6[_0xed65('0x31')]=_[_0xed65('0x34')](_0x115cf6['model'],_0x115cf6[_0xed65('0x32')]);_0x12287d[_0xed65('0x33')]=_[_0xed65('0x34')](_0x115cf6[_0xed65('0x35')],qs[_0xed65('0x36')](_0x41b810[_0xed65('0x32')]['fields']));_0x12287d[_0xed65('0x33')]=_0x12287d[_0xed65('0x33')][_0xed65('0x37')]?_0x12287d[_0xed65('0x33')]:_0x115cf6['model'];_0x12287d[_0xed65('0x4c')]=qs[_0xed65('0x3a')](_0x41b810['query']['sort']);_0x12287d[_0xed65('0x3b')]=qs[_0xed65('0x31')](_[_0xed65('0x3c')](_0x41b810['query'],_0x115cf6[_0xed65('0x31')]));if(_0x41b810[_0xed65('0x32')][_0xed65('0x3e')]){_0x12287d[_0xed65('0x3b')]=_[_0xed65('0x3d')](_0x12287d[_0xed65('0x3b')],{'$or':_[_0xed65('0x2c')](_0x12287d[_0xed65('0x33')],function(_0x2c27cc){var _0xb6887f={};_0xb6887f[_0x2c27cc]={'$like':'%'+_0x41b810[_0xed65('0x32')][_0xed65('0x3e')]+'%'};return _0xb6887f;})});}_0x12287d=_[_0xed65('0x3d')]({},_0x12287d,_0x41b810[_0xed65('0x3f')]);return _0x558272['getTags'](_0x12287d);}})[_0xed65('0x25')](function(_0x5183c6){if(_0x5183c6){_0x565d92=_0x5183c6[_0xed65('0x37')];if(!_0x41b810[_0xed65('0x32')][_0xed65('0x38')]('nolimit')){_0x12287d[_0xed65('0x1e')]=qs[_0xed65('0x1e')](_0x41b810['query'][_0xed65('0x1e')]);_0x12287d['offset']=qs['offset'](_0x41b810[_0xed65('0x32')][_0xed65('0x1c')]);}return _0x558272[_0xed65('0x50')](_0x12287d);}})[_0xed65('0x25')](function(_0x40e59d){if(_0x40e59d){return _0x40e59d?{'count':_0x565d92,'rows':_0x40e59d}:null;}})['then'](respondWithResult(_0x2c9044,null))[_0xed65('0x44')](handleError(_0x2c9044,null));};exports['setTags']=function(_0x386236,_0x925955,_0x519f3f){if(_0x386236[_0xed65('0x47')]['id']){delete _0x386236[_0xed65('0x47')]['id'];}return db[_0xed65('0x40')]['findOne']({'where':{'id':_0x386236[_0xed65('0x49')]['id']}})[_0xed65('0x25')](handleEntityNotFound(_0x925955,null))[_0xed65('0x25')](function(_0x1128e6){if(_0x1128e6){return _0x1128e6[_0xed65('0x52')](_0x386236['body'][_0xed65('0x53')]||[]);}return null;})[_0xed65('0x25')](respondWithResult(_0x925955,null))[_0xed65('0x44')](handleError(_0x925955,null));};
\ No newline at end of file