ab0bd2de49f3585c815ecc96b2dfd00e716d9c00
[motion2.git] / server / api / setting / setting.controller.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x0bf0=['\x20not\x20found','gdpr','securePassword','server/files/images/logos','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','test','Sequelize','ValidationError','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','Setting','includeAll','rows','catch','show','length','include','find','body','params','addLogo','file','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.png','default','upperFirst','existsSync','download','getLogoLogin','getLicense','default_loginLogo.png','custom'];(function(_0x2a5fd6,_0x35a9d6){var _0x12b634=function(_0x4dda0e){while(--_0x4dda0e){_0x2a5fd6['push'](_0x2a5fd6['shift']());}};_0x12b634(++_0x35a9d6);}(_0x0bf0,0x80));var _0x00bf=function(_0xf46abe,_0x403fe){_0xf46abe=_0xf46abe-0x0;var _0x98160=_0x0bf0[_0xf46abe];return _0x98160;};'use strict';var pdf=require(_0x00bf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x00bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00bf('0x2'));var rp=require(_0x00bf('0x3'));var moment=require(_0x00bf('0x4'));var BPromise=require(_0x00bf('0x5'));var Mustache=require(_0x00bf('0x6'));var util=require(_0x00bf('0x7'));var path=require('path');var sox=require(_0x00bf('0x8'));var csv=require(_0x00bf('0x9'));var ejs=require(_0x00bf('0xa'));var fs=require('fs');var _=require(_0x00bf('0xb'));var squel=require(_0x00bf('0xc'));var crypto=require('crypto');var jsforce=require(_0x00bf('0xd'));var deskjs=require(_0x00bf('0xe'));var toCsv=require(_0x00bf('0x9'));var querystring=require('querystring');var Papa=require(_0x00bf('0xf'));var Redis=require(_0x00bf('0x10'));var authService=require(_0x00bf('0x11'));var qs=require(_0x00bf('0x12'));var as=require(_0x00bf('0x13'));var hardwareService=require(_0x00bf('0x14'));var logger=require(_0x00bf('0x15'))(_0x00bf('0x16'));var utils=require('../../config/utils');var config=require(_0x00bf('0x17'));var db=require(_0x00bf('0x18'))['db'];var jayson=require(_0x00bf('0x19'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x2f1d3d,_0x2cf093,_0x531393){if(_0x531393){var _0x208820=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x208820[_0x00bf('0x1a')](_0x2cf093)){return _0x2f1d3d;}else{throw new db[(_0x00bf('0x1b'))][(_0x00bf('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2f1d3d;}}function respondWithRpcPromise(_0x257add,_0x4e929d,_0x40bd12,_0x45098e){return new BPromise(function(_0xff3014,_0x2602ab){var _0x3c3a62=_0x45098e||client;return _0x3c3a62[_0x00bf('0x1d')](_0x257add,_0x40bd12)[_0x00bf('0x1e')](function(_0x48fa87){logger[_0x00bf('0x1f')](_0x00bf('0x20'),_0x4e929d,_0x00bf('0x21'));logger[_0x00bf('0x22')]('Setting,\x20%s,\x20%s,\x20%s',_0x4e929d,_0x00bf('0x21'),JSON[_0x00bf('0x23')](_0x48fa87));if(_0x48fa87['error']){if(_0x48fa87[_0x00bf('0x24')][_0x00bf('0x25')]===0x1f4){logger[_0x00bf('0x24')](_0x00bf('0x20'),_0x4e929d,_0x48fa87['error']['message']);return _0x2602ab(_0x48fa87[_0x00bf('0x24')][_0x00bf('0x26')]);}logger[_0x00bf('0x24')](_0x00bf('0x20'),_0x4e929d,_0x48fa87['error'][_0x00bf('0x26')]);return _0xff3014(_0x48fa87[_0x00bf('0x24')][_0x00bf('0x26')]);}else{logger[_0x00bf('0x1f')]('Setting,\x20%s,\x20%s',_0x4e929d,_0x00bf('0x21'));_0xff3014(_0x48fa87[_0x00bf('0x27')][_0x00bf('0x26')]);}})['catch'](function(_0x488a55){logger['error']('Setting,\x20%s,\x20%s',_0x4e929d,_0x488a55);_0x2602ab(_0x488a55);});});}function respondWithStatusCode(_0x354fe0,_0x381757){_0x381757=_0x381757||0xcc;return function(_0x5c003f){if(_0x5c003f){return _0x354fe0[_0x00bf('0x28')](_0x381757);}return _0x354fe0['status'](_0x381757)[_0x00bf('0x29')]();};}function respondWithResult(_0x331dcd,_0x3a9f71){_0x3a9f71=_0x3a9f71||0xc8;return function(_0x51b376){if(_0x51b376){return _0x331dcd[_0x00bf('0x2a')](_0x3a9f71)['json'](_0x51b376);}};}function respondWithFilteredResult(_0x10d115,_0x3b1924){return function(_0x1ef24d){if(_0x1ef24d){var _0x2d25f0=_0x1ef24d[_0x00bf('0x2b')],_0xeaabc4=_0x3b1924[_0x00bf('0x2c')],_0x44468c=_0x3b1924[_0x00bf('0x2c')]+_0x3b1924[_0x00bf('0x2d')],_0x2bfb56;if(_0x44468c>=_0x2d25f0){_0x44468c=_0x2d25f0;_0x2bfb56=0xc8;}else{_0x2bfb56=0xce;}_0x10d115['status'](_0x2bfb56);return _0x10d115[_0x00bf('0x2e')](_0x00bf('0x2f'),_0xeaabc4+'-'+_0x44468c+'/'+_0x2d25f0)[_0x00bf('0x30')](_0x1ef24d);}return null;};}function patchUpdates(_0x4c997b){return function(_0x58b8cf){try{jsonpatch[_0x00bf('0x31')](_0x58b8cf,_0x4c997b,!![]);}catch(_0x404274){return BPromise[_0x00bf('0x32')](_0x404274);}return _0x58b8cf[_0x00bf('0x33')]();};}function saveUpdates(_0x21e32f,_0x359825){return function(_0x576077){if(_0x576077){return _0x576077['update'](_0x21e32f)['then'](function(_0x584e30){return _0x584e30;});}return null;};}function removeEntity(_0x4a7329,_0x245a7d){return function(_0x5d7ab9){if(_0x5d7ab9){return _0x5d7ab9[_0x00bf('0x34')]()['then'](function(){_0x4a7329['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b2950,_0x58be74){return function(_0x1c2bc5){if(!_0x1c2bc5){_0x1b2950[_0x00bf('0x28')](0x194);}return _0x1c2bc5;};}function handleError(_0x2feb03,_0x4be79d){_0x4be79d=_0x4be79d||0x1f4;return function(_0x5a162d){logger['error'](_0x5a162d[_0x00bf('0x35')]);if(_0x5a162d[_0x00bf('0x36')]){delete _0x5a162d[_0x00bf('0x36')];}_0x2feb03[_0x00bf('0x2a')](_0x4be79d)[_0x00bf('0x37')](_0x5a162d);};}exports['index']=function(_0x5d2978,_0x22ef22){var _0x3810f4={},_0x3e863e={},_0x5a7137={'count':0x0,'rows':[]};var _0x5a576c=_[_0x00bf('0x38')](db['Setting']['rawAttributes'],function(_0x367395){return{'name':_0x367395[_0x00bf('0x39')],'type':_0x367395[_0x00bf('0x3a')][_0x00bf('0x3b')]};});_0x3e863e[_0x00bf('0x3c')]=_[_0x00bf('0x38')](_0x5a576c,_0x00bf('0x36'));_0x3e863e[_0x00bf('0x3d')]=_[_0x00bf('0x3e')](_0x5d2978[_0x00bf('0x3d')]);_0x3e863e['filters']=_[_0x00bf('0x3f')](_0x3e863e['model'],_0x3e863e[_0x00bf('0x3d')]);_0x3810f4['attributes']=_[_0x00bf('0x3f')](_0x3e863e[_0x00bf('0x3c')],qs[_0x00bf('0x40')](_0x5d2978[_0x00bf('0x3d')][_0x00bf('0x40')]));_0x3810f4['attributes']=_0x3810f4['attributes']['length']?_0x3810f4[_0x00bf('0x41')]:_0x3e863e[_0x00bf('0x3c')];if(!_0x5d2978[_0x00bf('0x3d')][_0x00bf('0x42')](_0x00bf('0x43'))){_0x3810f4[_0x00bf('0x2d')]=qs[_0x00bf('0x2d')](_0x5d2978[_0x00bf('0x3d')]['limit']);_0x3810f4['offset']=qs[_0x00bf('0x2c')](_0x5d2978['query'][_0x00bf('0x2c')]);}_0x3810f4['order']=qs[_0x00bf('0x44')](_0x5d2978[_0x00bf('0x3d')][_0x00bf('0x44')]);_0x3810f4[_0x00bf('0x45')]=qs[_0x00bf('0x46')](_[_0x00bf('0x47')](_0x5d2978[_0x00bf('0x3d')],_0x3e863e[_0x00bf('0x46')]),_0x5a576c);if(_0x5d2978[_0x00bf('0x3d')]['filter']){_0x3810f4[_0x00bf('0x45')]=_[_0x00bf('0x48')](_0x3810f4['where'],{'$or':_['map'](_0x5a576c,function(_0x3b6bca){if(_0x3b6bca[_0x00bf('0x3a')]!==_0x00bf('0x49')){var _0x56190b={};_0x56190b[_0x3b6bca['name']]={'$like':'%'+_0x5d2978[_0x00bf('0x3d')][_0x00bf('0x4a')]+'%'};return _0x56190b;}})});}_0x3810f4=_[_0x00bf('0x48')]({},_0x3810f4,_0x5d2978[_0x00bf('0x4b')]);var _0x1b86e1={'where':_0x3810f4[_0x00bf('0x45')]};return db[_0x00bf('0x4c')]['count'](_0x1b86e1)['then'](function(_0x2b285b){_0x5a7137[_0x00bf('0x2b')]=_0x2b285b;if(_0x5d2978[_0x00bf('0x3d')][_0x00bf('0x4d')]){_0x3810f4['include']=[{'all':!![]}];}return db[_0x00bf('0x4c')]['findAll'](_0x3810f4);})[_0x00bf('0x1e')](function(_0xb5495c){_0x5a7137[_0x00bf('0x4e')]=_0xb5495c;return _0x5a7137;})[_0x00bf('0x1e')](respondWithFilteredResult(_0x22ef22,_0x3810f4))[_0x00bf('0x4f')](handleError(_0x22ef22,null));};exports[_0x00bf('0x50')]=function(_0x53d9d6,_0x56a2e5){var _0x3b652a={'raw':![],'where':{'id':_0x53d9d6['params']['id']}},_0x3d73a4={};_0x3d73a4[_0x00bf('0x3c')]=_[_0x00bf('0x3e')](db[_0x00bf('0x4c')]['rawAttributes']);_0x3d73a4[_0x00bf('0x3d')]=_[_0x00bf('0x3e')](_0x53d9d6[_0x00bf('0x3d')]);_0x3d73a4['filters']=_[_0x00bf('0x3f')](_0x3d73a4[_0x00bf('0x3c')],_0x3d73a4[_0x00bf('0x3d')]);_0x3b652a[_0x00bf('0x41')]=_['intersection'](_0x3d73a4[_0x00bf('0x3c')],qs[_0x00bf('0x40')](_0x53d9d6[_0x00bf('0x3d')][_0x00bf('0x40')]));_0x3b652a[_0x00bf('0x41')]=_0x3b652a[_0x00bf('0x41')][_0x00bf('0x51')]?_0x3b652a[_0x00bf('0x41')]:_0x3d73a4[_0x00bf('0x3c')];if(_0x53d9d6[_0x00bf('0x3d')]['includeAll']){_0x3b652a[_0x00bf('0x52')]=[{'all':!![]}];}_0x3b652a=_[_0x00bf('0x48')]({},_0x3b652a,_0x53d9d6[_0x00bf('0x4b')]);return db[_0x00bf('0x4c')][_0x00bf('0x53')](_0x3b652a)[_0x00bf('0x1e')](handleEntityNotFound(_0x56a2e5,null))[_0x00bf('0x1e')](respondWithResult(_0x56a2e5,null))['catch'](handleError(_0x56a2e5,null));};exports['update']=function(_0x45b7b0,_0x95db6f){if(_0x45b7b0[_0x00bf('0x54')]['id']){delete _0x45b7b0[_0x00bf('0x54')]['id'];}return db[_0x00bf('0x4c')][_0x00bf('0x53')]({'where':{'id':_0x45b7b0[_0x00bf('0x55')]['id']}})[_0x00bf('0x1e')](handleEntityNotFound(_0x95db6f,null))['then'](saveUpdates(_0x45b7b0[_0x00bf('0x54')],null))[_0x00bf('0x1e')](respondWithResult(_0x95db6f,null))[_0x00bf('0x4f')](handleError(_0x95db6f,null));};exports[_0x00bf('0x56')]=function(_0x3a0475,_0x5d6fd6,_0x2c3bb2){if(_0x3a0475[_0x00bf('0x57')]&&_0x3a0475[_0x00bf('0x57')][_0x00bf('0x58')]){_0x3a0475[_0x00bf('0x54')]['logo']=_0x3a0475['file'][_0x00bf('0x58')];}return db[_0x00bf('0x4c')][_0x00bf('0x53')]({'where':{'id':_0x3a0475[_0x00bf('0x55')]['id']}})['then'](handleEntityNotFound(_0x5d6fd6,null))[_0x00bf('0x1e')](saveUpdates(_0x3a0475['body'],null))[_0x00bf('0x1e')](respondWithResult(_0x5d6fd6,null))[_0x00bf('0x4f')](handleError(_0x5d6fd6,null));};exports[_0x00bf('0x59')]=function(_0x1d64f7,_0x970a9f,_0x285a73){if(_0x1d64f7[_0x00bf('0x57')]&&_0x1d64f7[_0x00bf('0x57')][_0x00bf('0x58')]){_0x1d64f7['body'][_0x00bf('0x5a')]=_0x1d64f7[_0x00bf('0x57')][_0x00bf('0x58')];}return db['Setting'][_0x00bf('0x53')]({'where':{'id':_0x1d64f7[_0x00bf('0x55')]['id']}})[_0x00bf('0x1e')](handleEntityNotFound(_0x970a9f,null))['then'](saveUpdates(_0x1d64f7[_0x00bf('0x54')],null))[_0x00bf('0x1e')](respondWithResult(_0x970a9f,null))[_0x00bf('0x4f')](handleError(_0x970a9f,null));};var utilLicense=require(_0x00bf('0x5b'));exports[_0x00bf('0x5c')]=function(_0x39b624,_0x411769,_0x3e25e6){var _0x16515a='server/files/images/logos';var _0x27c16c={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x1bf7a9){if(_0x1bf7a9){_0x27c16c=_0x1bf7a9;}return db[_0x00bf('0x4c')]['find']({'where':{'id':_0x39b624['params']['id']},'attributes':[_0x00bf('0x5d'),_0x00bf('0x5a'),_0x00bf('0x5e'),_0x00bf('0x5f'),_0x00bf('0x60'),_0x00bf('0x61'),_0x00bf('0x62'),_0x00bf('0x63')],'raw':!![]});})[_0x00bf('0x1e')](handleEntityNotFound(_0x411769,null))[_0x00bf('0x1e')](function(_0x1e1527){if(_0x1e1527){var _0x44e4ff=_0x1e1527['logo']&&fs['existsSync'](path[_0x00bf('0x64')](config[_0x00bf('0x65')],_0x16515a,_[_0x00bf('0x66')](_0x1e1527[_0x00bf('0x5d')])))?path[_0x00bf('0x64')](config['root'],_0x16515a,_['toLower'](_0x1e1527[_0x00bf('0x5d')])):path[_0x00bf('0x64')](config[_0x00bf('0x65')],_0x16515a,_['toLower'](_0x00bf('0x67')));var _0x416340=_0x00bf('0x68')+_[_0x00bf('0x69')](_0x00bf('0x5d'));if(_0x1e1527[_0x416340]||!_0x27c16c['custom']){_0x44e4ff=path[_0x00bf('0x64')](config[_0x00bf('0x65')],_0x16515a,_[_0x00bf('0x66')](_0x00bf('0x67')));}if(!fs[_0x00bf('0x6a')](_0x44e4ff)){throw new db[(_0x00bf('0x1b'))][(_0x00bf('0x1c'))](_['upperFirst'](_0x00bf('0x5d'))+'\x20not\x20found');}return _0x411769[_0x00bf('0x6b')](_0x44e4ff);}})['catch'](handleError(_0x411769,null));};var utilLicense=require(_0x00bf('0x5b'));exports[_0x00bf('0x6c')]=function(_0x537ad3,_0x1de809,_0x177a01){var _0xae890='server/files/images/logos';var _0x16ed6b={'custom':![]};return utilLicense[_0x00bf('0x6d')]()[_0x00bf('0x1e')](function(_0x4372c4){if(_0x4372c4){_0x16ed6b=_0x4372c4;}return db['Setting'][_0x00bf('0x53')]({'where':{'id':_0x537ad3[_0x00bf('0x55')]['id']},'attributes':[_0x00bf('0x5d'),_0x00bf('0x5a'),_0x00bf('0x5e'),_0x00bf('0x5f'),_0x00bf('0x60'),'defaultLoginLogo',_0x00bf('0x62'),_0x00bf('0x63')],'raw':!![]});})['then'](handleEntityNotFound(_0x1de809,null))[_0x00bf('0x1e')](function(_0x2947b0){if(_0x2947b0){var _0x382578=_0x2947b0[_0x00bf('0x5a')]&&fs['existsSync'](path[_0x00bf('0x64')](config[_0x00bf('0x65')],_0xae890,_[_0x00bf('0x66')](_0x2947b0['loginLogo'])))?path[_0x00bf('0x64')](config['root'],_0xae890,_[_0x00bf('0x66')](_0x2947b0[_0x00bf('0x5a')])):path[_0x00bf('0x64')](config[_0x00bf('0x65')],_0xae890,_[_0x00bf('0x66')](_0x00bf('0x6e')));var _0x1830d3=_0x00bf('0x68')+_[_0x00bf('0x69')]('loginLogo');if(_0x2947b0[_0x1830d3]||!_0x16ed6b[_0x00bf('0x6f')]){_0x382578=path['join'](config[_0x00bf('0x65')],_0xae890,_[_0x00bf('0x66')](_0x00bf('0x6e')));}if(!fs[_0x00bf('0x6a')](_0x382578)){throw new db[(_0x00bf('0x1b'))][(_0x00bf('0x1c'))](_[_0x00bf('0x69')](_0x00bf('0x5a'))+_0x00bf('0x70'));}return _0x1de809[_0x00bf('0x6b')](_0x382578);}})[_0x00bf('0x4f')](handleError(_0x1de809,null));};exports[_0x00bf('0x71')]=function(_0x3c108f,_0x4dfb8c){return db[_0x00bf('0x4c')]['find']({'where':{'id':_0x3c108f[_0x00bf('0x55')]['id']},'attributes':[_0x00bf('0x72')]})[_0x00bf('0x1e')](respondWithResult(_0x4dfb8c,null))['catch'](handleError(_0x4dfb8c,null));};exports['addPreferred']=function(_0x4d606a,_0x111420,_0x45141d){if(_0x4d606a[_0x00bf('0x57')]&&_0x4d606a['file'][_0x00bf('0x58')]){_0x4d606a[_0x00bf('0x54')][_0x00bf('0x5e')]=_0x4d606a[_0x00bf('0x57')]['filename'];}return db['Setting'][_0x00bf('0x53')]({'where':{'id':_0x4d606a[_0x00bf('0x55')]['id']}})[_0x00bf('0x1e')](handleEntityNotFound(_0x111420,null))[_0x00bf('0x1e')](saveUpdates(_0x4d606a[_0x00bf('0x54')],null))[_0x00bf('0x1e')](respondWithResult(_0x111420,null))[_0x00bf('0x4f')](handleError(_0x111420,null));};var utilLicense=require(_0x00bf('0x5b'));exports['getPreferred']=function(_0x5ab4b9,_0x1411f4,_0x3b355a){var _0x5704f0=_0x00bf('0x73');var _0x3e1653={'custom':![]};return utilLicense[_0x00bf('0x6d')]()[_0x00bf('0x1e')](function(_0xc09412){if(_0xc09412){_0x3e1653=_0xc09412;}return db[_0x00bf('0x4c')]['find']({'where':{'id':_0x5ab4b9[_0x00bf('0x55')]['id']},'attributes':[_0x00bf('0x5d'),'loginLogo',_0x00bf('0x5e'),_0x00bf('0x5f'),_0x00bf('0x60'),_0x00bf('0x61'),_0x00bf('0x62'),_0x00bf('0x63')],'raw':!![]});})[_0x00bf('0x1e')](handleEntityNotFound(_0x1411f4,null))[_0x00bf('0x1e')](function(_0xe389e5){if(_0xe389e5){var _0x40547c=_0xe389e5[_0x00bf('0x5e')]&&fs['existsSync'](path[_0x00bf('0x64')](config[_0x00bf('0x65')],_0x5704f0,_[_0x00bf('0x66')](_0xe389e5[_0x00bf('0x5e')])))?path['join'](config['root'],_0x5704f0,_[_0x00bf('0x66')](_0xe389e5['preferred'])):path[_0x00bf('0x64')](config[_0x00bf('0x65')],_0x5704f0,_['toLower'](_0x00bf('0x74')));var _0x435a21=_0x00bf('0x68')+_['upperFirst'](_0x00bf('0x5e'));if(_0xe389e5[_0x435a21]||!_0x3e1653['custom']||!_0x3e1653[_0x00bf('0x5e')]){_0x40547c=path[_0x00bf('0x64')](config[_0x00bf('0x65')],_0x5704f0,_[_0x00bf('0x66')](_0x00bf('0x74')));}if(!fs[_0x00bf('0x6a')](_0x40547c)){throw new db[(_0x00bf('0x1b'))]['ValidationError'](_[_0x00bf('0x69')](_0x00bf('0x5e'))+'\x20not\x20found');}return _0x1411f4[_0x00bf('0x6b')](_0x40547c);}})[_0x00bf('0x4f')](handleError(_0x1411f4,null));};exports[_0x00bf('0x75')]=function(_0xc25c7f,_0x1cf089,_0x197587){if(_0xc25c7f['file']&&_0xc25c7f[_0x00bf('0x57')][_0x00bf('0x58')]){_0xc25c7f['body']['favicon']=_0xc25c7f['file'][_0x00bf('0x58')];}return db[_0x00bf('0x4c')][_0x00bf('0x53')]({'where':{'id':_0xc25c7f[_0x00bf('0x55')]['id']}})[_0x00bf('0x1e')](handleEntityNotFound(_0x1cf089,null))[_0x00bf('0x1e')](saveUpdates(_0xc25c7f[_0x00bf('0x54')],null))[_0x00bf('0x1e')](respondWithResult(_0x1cf089,null))[_0x00bf('0x4f')](handleError(_0x1cf089,null));};var utilLicense=require(_0x00bf('0x5b'));exports[_0x00bf('0x76')]=function(_0x51df1f,_0x5a2b3c,_0x40bb79){var _0x46969c=_0x00bf('0x73');var _0x2112ba={'custom':![]};return utilLicense[_0x00bf('0x6d')]()[_0x00bf('0x1e')](function(_0x44df7d){if(_0x44df7d){_0x2112ba=_0x44df7d;}return db['Setting'][_0x00bf('0x53')]({'where':{'id':_0x51df1f['params']['id']},'attributes':[_0x00bf('0x5d'),_0x00bf('0x5a'),_0x00bf('0x5e'),_0x00bf('0x5f'),'defaultLogo',_0x00bf('0x61'),_0x00bf('0x62'),_0x00bf('0x63')],'raw':!![]});})[_0x00bf('0x1e')](handleEntityNotFound(_0x5a2b3c,null))[_0x00bf('0x1e')](function(_0x3179f3){if(_0x3179f3){var _0x3f7f7a=_0x3179f3[_0x00bf('0x5f')]&&fs['existsSync'](path['join'](config[_0x00bf('0x65')],_0x46969c,_[_0x00bf('0x66')](_0x3179f3[_0x00bf('0x5f')])))?path[_0x00bf('0x64')](config[_0x00bf('0x65')],_0x46969c,_['toLower'](_0x3179f3['favicon'])):path['join'](config[_0x00bf('0x65')],_0x46969c,_[_0x00bf('0x66')](_0x00bf('0x77')));var _0x4cbfa4=_0x00bf('0x68')+_[_0x00bf('0x69')]('favicon');if(_0x3179f3[_0x4cbfa4]||!_0x2112ba[_0x00bf('0x6f')]){_0x3f7f7a=path[_0x00bf('0x64')](config[_0x00bf('0x65')],_0x46969c,_['toLower'](_0x00bf('0x77')));}if(!fs['existsSync'](_0x3f7f7a)){throw new db['Sequelize']['ValidationError'](_[_0x00bf('0x69')](_0x00bf('0x5f'))+_0x00bf('0x70'));}return _0x5a2b3c['download'](_0x3f7f7a);}})[_0x00bf('0x4f')](handleError(_0x5a2b3c,null));};