Built motion from commit f7863d46.|2.5.41
[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 _0xf013=['loginLogo','../../config/license/util','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','upperFirst','custom','default_logo.svg','ValidationError','\x20not\x20found','download','getLogoLogin','getLicense','defaultLoginLogo','default_loginLogo.svg','default','Sequelize','gdpr','addPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','stack','name','send','map','Setting','rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','includeAll','findAll','rows','keys','intersection','include','find','body','params','addLogo','file','logo','filename','addLogoLogin'];(function(_0x258586,_0xecdbdb){var _0x17bdbe=function(_0x697ff2){while(--_0x697ff2){_0x258586['push'](_0x258586['shift']());}};_0x17bdbe(++_0xecdbdb);}(_0xf013,0x118));var _0x3f01=function(_0x209b5b,_0x53a72f){_0x209b5b=_0x209b5b-0x0;var _0x311284=_0xf013[_0x209b5b];return _0x311284;};'use strict';var emlformat=require(_0x3f01('0x0'));var rimraf=require(_0x3f01('0x1'));var zipdir=require(_0x3f01('0x2'));var jsonpatch=require(_0x3f01('0x3'));var rp=require('request-promise');var moment=require(_0x3f01('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3f01('0x5'));var util=require(_0x3f01('0x6'));var path=require(_0x3f01('0x7'));var sox=require(_0x3f01('0x8'));var csv=require(_0x3f01('0x9'));var ejs=require(_0x3f01('0xa'));var fs=require('fs');var fs_extra=require(_0x3f01('0xb'));var _=require(_0x3f01('0xc'));var squel=require(_0x3f01('0xd'));var crypto=require(_0x3f01('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3f01('0xf'));var toCsv=require(_0x3f01('0x9'));var querystring=require('querystring');var Papa=require(_0x3f01('0x10'));var Redis=require(_0x3f01('0x11'));var authService=require(_0x3f01('0x12'));var qs=require(_0x3f01('0x13'));var as=require(_0x3f01('0x14'));var hardwareService=require(_0x3f01('0x15'));var logger=require(_0x3f01('0x16'))(_0x3f01('0x17'));var utils=require(_0x3f01('0x18'));var config=require(_0x3f01('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f01('0x1a'))['db'];var jayson=require(_0x3f01('0x1b'));var client=jayson['client'][_0x3f01('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1b191b,_0x180df9,_0x3e32ce,_0x4a0388){return new BPromise(function(_0x2ac401,_0x32effe){var _0x4092d2=_0x4a0388||client;return _0x4092d2['request'](_0x1b191b,_0x3e32ce)[_0x3f01('0x1d')](function(_0x5e7412){logger['info']('Setting,\x20%s,\x20%s',_0x180df9,_0x3f01('0x1e'));logger[_0x3f01('0x1f')](_0x3f01('0x20'),_0x180df9,'request\x20sent',JSON['stringify'](_0x5e7412));if(_0x5e7412[_0x3f01('0x21')]){if(_0x5e7412['error'][_0x3f01('0x22')]===0x1f4){logger[_0x3f01('0x21')](_0x3f01('0x23'),_0x180df9,_0x5e7412[_0x3f01('0x21')][_0x3f01('0x24')]);return _0x32effe(_0x5e7412['error'][_0x3f01('0x24')]);}logger[_0x3f01('0x21')](_0x3f01('0x23'),_0x180df9,_0x5e7412[_0x3f01('0x21')][_0x3f01('0x24')]);return _0x2ac401(_0x5e7412[_0x3f01('0x21')][_0x3f01('0x24')]);}else{logger[_0x3f01('0x25')]('Setting,\x20%s,\x20%s',_0x180df9,_0x3f01('0x1e'));_0x2ac401(_0x5e7412[_0x3f01('0x26')]['message']);}})[_0x3f01('0x27')](function(_0x5096d4){logger[_0x3f01('0x21')](_0x3f01('0x23'),_0x180df9,_0x5096d4);_0x32effe(_0x5096d4);});});}function respondWithStatusCode(_0x59e26e,_0x1266bb){_0x1266bb=_0x1266bb||0xcc;return function(_0x4c2588){if(_0x4c2588){return _0x59e26e[_0x3f01('0x28')](_0x1266bb);}return _0x59e26e[_0x3f01('0x29')](_0x1266bb)[_0x3f01('0x2a')]();};}function respondWithResult(_0x4e0e02,_0x538c27){_0x538c27=_0x538c27||0xc8;return function(_0x1d37f9){if(_0x1d37f9){return _0x4e0e02['status'](_0x538c27)[_0x3f01('0x2b')](_0x1d37f9);}};}function respondWithFilteredResult(_0x10fd81,_0x4b3b9c){return function(_0x56f4e5){if(_0x56f4e5){var _0x503115=typeof _0x4b3b9c[_0x3f01('0x2c')]===_0x3f01('0x2d')&&typeof _0x4b3b9c[_0x3f01('0x2e')]===_0x3f01('0x2d');var _0x2caba1=_0x56f4e5['count'];var _0x3a767a=_0x503115?0x0:_0x4b3b9c[_0x3f01('0x2c')];var _0x166424=_0x503115?_0x56f4e5[_0x3f01('0x2f')]:_0x4b3b9c[_0x3f01('0x2c')]+_0x4b3b9c[_0x3f01('0x2e')];var _0x5b2292;if(_0x166424>=_0x2caba1){_0x166424=_0x2caba1;_0x5b2292=0xc8;}else{_0x5b2292=0xce;}_0x10fd81['status'](_0x5b2292);return _0x10fd81['set'](_0x3f01('0x30'),_0x3a767a+'-'+_0x166424+'/'+_0x2caba1)[_0x3f01('0x2b')](_0x56f4e5);}return null;};}function patchUpdates(_0x172fef){return function(_0x336c39){try{jsonpatch['apply'](_0x336c39,_0x172fef,!![]);}catch(_0x33e938){return BPromise[_0x3f01('0x31')](_0x33e938);}return _0x336c39[_0x3f01('0x32')]();};}function saveUpdates(_0x3e93d3,_0x1c15ba){return function(_0x25826c){if(_0x25826c){return _0x25826c[_0x3f01('0x33')](_0x3e93d3)[_0x3f01('0x1d')](function(_0x897186){return _0x897186;});}return null;};}function removeEntity(_0x4035ba,_0x49f987){return function(_0x3862d7){if(_0x3862d7){return _0x3862d7[_0x3f01('0x34')]()[_0x3f01('0x1d')](function(){_0x4035ba[_0x3f01('0x29')](0xcc)[_0x3f01('0x2a')]();});}};}function handleEntityNotFound(_0x113e96,_0x4cf771){return function(_0x501ba4){if(!_0x501ba4){_0x113e96[_0x3f01('0x28')](0x194);}return _0x501ba4;};}function handleError(_0x548571,_0x58abc0){_0x58abc0=_0x58abc0||0x1f4;return function(_0x373d20){logger[_0x3f01('0x21')](_0x373d20[_0x3f01('0x35')]);if(_0x373d20[_0x3f01('0x36')]){delete _0x373d20['name'];}_0x548571[_0x3f01('0x29')](_0x58abc0)[_0x3f01('0x37')](_0x373d20);};}exports['index']=function(_0x24efa3,_0x9f3dd9){var _0x2be144={},_0x54c21c={},_0x10b51e={'count':0x0,'rows':[]};var _0x458fcf=_[_0x3f01('0x38')](db[_0x3f01('0x39')][_0x3f01('0x3a')],function(_0x553426){return{'name':_0x553426['fieldName'],'type':_0x553426[_0x3f01('0x3b')][_0x3f01('0x3c')]};});_0x54c21c[_0x3f01('0x3d')]=_[_0x3f01('0x38')](_0x458fcf,_0x3f01('0x36'));_0x54c21c[_0x3f01('0x3e')]=_['keys'](_0x24efa3[_0x3f01('0x3e')]);_0x54c21c[_0x3f01('0x3f')]=_['intersection'](_0x54c21c[_0x3f01('0x3d')],_0x54c21c[_0x3f01('0x3e')]);_0x2be144[_0x3f01('0x40')]=_['intersection'](_0x54c21c[_0x3f01('0x3d')],qs[_0x3f01('0x41')](_0x24efa3[_0x3f01('0x3e')]['fields']));_0x2be144[_0x3f01('0x40')]=_0x2be144['attributes'][_0x3f01('0x42')]?_0x2be144[_0x3f01('0x40')]:_0x54c21c[_0x3f01('0x3d')];if(!_0x24efa3[_0x3f01('0x3e')][_0x3f01('0x43')](_0x3f01('0x44'))){_0x2be144[_0x3f01('0x2e')]=qs[_0x3f01('0x2e')](_0x24efa3[_0x3f01('0x3e')][_0x3f01('0x2e')]);_0x2be144[_0x3f01('0x2c')]=qs[_0x3f01('0x2c')](_0x24efa3[_0x3f01('0x3e')][_0x3f01('0x2c')]);}_0x2be144[_0x3f01('0x45')]=qs[_0x3f01('0x46')](_0x24efa3[_0x3f01('0x3e')][_0x3f01('0x46')]);_0x2be144['where']=qs[_0x3f01('0x3f')](_[_0x3f01('0x47')](_0x24efa3[_0x3f01('0x3e')],_0x54c21c['filters']),_0x458fcf);if(_0x24efa3['query']['filter']){_0x2be144['where']=_['merge'](_0x2be144[_0x3f01('0x48')],{'$or':_[_0x3f01('0x38')](_0x458fcf,function(_0x497d8){if(_0x497d8[_0x3f01('0x3b')]!=='VIRTUAL'){var _0x28d08d={};_0x28d08d[_0x497d8[_0x3f01('0x36')]]={'$like':'%'+_0x24efa3[_0x3f01('0x3e')]['filter']+'%'};return _0x28d08d;}})});}_0x2be144=_[_0x3f01('0x49')]({},_0x2be144,_0x24efa3[_0x3f01('0x4a')]);var _0x62a723={'where':_0x2be144[_0x3f01('0x48')]};return db['Setting'][_0x3f01('0x2f')](_0x62a723)[_0x3f01('0x1d')](function(_0x1d1b05){_0x10b51e['count']=_0x1d1b05;if(_0x24efa3[_0x3f01('0x3e')][_0x3f01('0x4b')]){_0x2be144['include']=[{'all':!![]}];}return db[_0x3f01('0x39')][_0x3f01('0x4c')](_0x2be144);})['then'](function(_0xe99c67){_0x10b51e[_0x3f01('0x4d')]=_0xe99c67;return _0x10b51e;})['then'](respondWithFilteredResult(_0x9f3dd9,_0x2be144))['catch'](handleError(_0x9f3dd9,null));};exports['show']=function(_0x215d14,_0x63fd86){var _0x5ca7d6={'raw':![],'where':{'id':_0x215d14['params']['id']}},_0x4b9629={};_0x4b9629[_0x3f01('0x3d')]=_[_0x3f01('0x4e')](db[_0x3f01('0x39')][_0x3f01('0x3a')]);_0x4b9629[_0x3f01('0x3e')]=_[_0x3f01('0x4e')](_0x215d14[_0x3f01('0x3e')]);_0x4b9629[_0x3f01('0x3f')]=_['intersection'](_0x4b9629[_0x3f01('0x3d')],_0x4b9629[_0x3f01('0x3e')]);_0x5ca7d6[_0x3f01('0x40')]=_[_0x3f01('0x4f')](_0x4b9629['model'],qs[_0x3f01('0x41')](_0x215d14[_0x3f01('0x3e')][_0x3f01('0x41')]));_0x5ca7d6[_0x3f01('0x40')]=_0x5ca7d6['attributes'][_0x3f01('0x42')]?_0x5ca7d6[_0x3f01('0x40')]:_0x4b9629['model'];if(_0x215d14[_0x3f01('0x3e')]['includeAll']){_0x5ca7d6[_0x3f01('0x50')]=[{'all':!![]}];}_0x5ca7d6=_[_0x3f01('0x49')]({},_0x5ca7d6,_0x215d14['options']);return db[_0x3f01('0x39')][_0x3f01('0x51')](_0x5ca7d6)['then'](handleEntityNotFound(_0x63fd86,null))[_0x3f01('0x1d')](respondWithResult(_0x63fd86,null))['catch'](handleError(_0x63fd86,null));};exports[_0x3f01('0x33')]=function(_0x3691da,_0x51a70e){if(_0x3691da[_0x3f01('0x52')]['id']){delete _0x3691da[_0x3f01('0x52')]['id'];}return db['Setting']['find']({'where':{'id':_0x3691da[_0x3f01('0x53')]['id']}})[_0x3f01('0x1d')](handleEntityNotFound(_0x51a70e,null))[_0x3f01('0x1d')](saveUpdates(_0x3691da['body'],null))[_0x3f01('0x1d')](respondWithResult(_0x51a70e,null))[_0x3f01('0x27')](handleError(_0x51a70e,null));};exports[_0x3f01('0x54')]=function(_0x54d31f,_0x9c7ae7,_0x1a32a5){if(_0x54d31f[_0x3f01('0x55')]&&_0x54d31f[_0x3f01('0x55')]['filename']){_0x54d31f[_0x3f01('0x52')][_0x3f01('0x56')]=_0x54d31f[_0x3f01('0x55')][_0x3f01('0x57')];}return db[_0x3f01('0x39')][_0x3f01('0x51')]({'where':{'id':_0x54d31f[_0x3f01('0x53')]['id']}})[_0x3f01('0x1d')](handleEntityNotFound(_0x9c7ae7,null))[_0x3f01('0x1d')](saveUpdates(_0x54d31f['body'],null))[_0x3f01('0x1d')](respondWithResult(_0x9c7ae7,null))['catch'](handleError(_0x9c7ae7,null));};exports[_0x3f01('0x58')]=function(_0x35a15b,_0x146a6e,_0x267b8b){if(_0x35a15b[_0x3f01('0x55')]&&_0x35a15b[_0x3f01('0x55')][_0x3f01('0x57')]){_0x35a15b[_0x3f01('0x52')][_0x3f01('0x59')]=_0x35a15b[_0x3f01('0x55')][_0x3f01('0x57')];}return db[_0x3f01('0x39')][_0x3f01('0x51')]({'where':{'id':_0x35a15b['params']['id']}})['then'](handleEntityNotFound(_0x146a6e,null))[_0x3f01('0x1d')](saveUpdates(_0x35a15b['body'],null))[_0x3f01('0x1d')](respondWithResult(_0x146a6e,null))[_0x3f01('0x27')](handleError(_0x146a6e,null));};var utilLicense=require(_0x3f01('0x5a'));exports[_0x3f01('0x5b')]=function(_0x1f8707,_0x5d70f4,_0x1697ea){var _0x548753=_0x3f01('0x5c');var _0x5779d0={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x300179){if(_0x300179){_0x5779d0=_0x300179;}return db[_0x3f01('0x39')][_0x3f01('0x51')]({'where':{'id':_0x1f8707['params']['id']},'attributes':[_0x3f01('0x56'),_0x3f01('0x59'),_0x3f01('0x5d'),_0x3f01('0x5e'),_0x3f01('0x5f'),'defaultLoginLogo',_0x3f01('0x60'),_0x3f01('0x61')],'raw':!![]});})[_0x3f01('0x1d')](handleEntityNotFound(_0x5d70f4,null))[_0x3f01('0x1d')](function(_0x33ff5a){if(_0x33ff5a){var _0xd8bcfb=_0x33ff5a[_0x3f01('0x56')]&&fs[_0x3f01('0x62')](path[_0x3f01('0x63')](config[_0x3f01('0x64')],_0x548753,_[_0x3f01('0x65')](_0x33ff5a[_0x3f01('0x56')])))?path[_0x3f01('0x63')](config[_0x3f01('0x64')],_0x548753,_[_0x3f01('0x65')](_0x33ff5a[_0x3f01('0x56')])):path[_0x3f01('0x63')](config[_0x3f01('0x64')],_0x548753,_[_0x3f01('0x65')]('default_logo.svg'));var _0x22d045='default'+_[_0x3f01('0x66')]('logo');if(_0x33ff5a[_0x22d045]||!_0x5779d0[_0x3f01('0x67')]){_0xd8bcfb=path['join'](config[_0x3f01('0x64')],_0x548753,_[_0x3f01('0x65')](_0x3f01('0x68')));}if(!fs[_0x3f01('0x62')](_0xd8bcfb)){throw new db['Sequelize'][(_0x3f01('0x69'))](_[_0x3f01('0x66')](_0x3f01('0x56'))+_0x3f01('0x6a'));}return _0x5d70f4[_0x3f01('0x6b')](_0xd8bcfb);}})['catch'](handleError(_0x5d70f4,null));};var utilLicense=require('../../config/license/util');exports[_0x3f01('0x6c')]=function(_0x1ddfb7,_0x5a4fd6,_0x2ed345){var _0x35034f=_0x3f01('0x5c');var _0x3fa83f={'custom':![]};return utilLicense[_0x3f01('0x6d')]()[_0x3f01('0x1d')](function(_0x548882){if(_0x548882){_0x3fa83f=_0x548882;}return db[_0x3f01('0x39')]['find']({'where':{'id':_0x1ddfb7[_0x3f01('0x53')]['id']},'attributes':[_0x3f01('0x56'),_0x3f01('0x59'),_0x3f01('0x5d'),_0x3f01('0x5e'),_0x3f01('0x5f'),_0x3f01('0x6e'),_0x3f01('0x60'),_0x3f01('0x61')],'raw':!![]});})[_0x3f01('0x1d')](handleEntityNotFound(_0x5a4fd6,null))[_0x3f01('0x1d')](function(_0x49f6db){if(_0x49f6db){var _0x1ff26d=_0x49f6db['loginLogo']&&fs[_0x3f01('0x62')](path['join'](config[_0x3f01('0x64')],_0x35034f,_[_0x3f01('0x65')](_0x49f6db[_0x3f01('0x59')])))?path[_0x3f01('0x63')](config[_0x3f01('0x64')],_0x35034f,_[_0x3f01('0x65')](_0x49f6db[_0x3f01('0x59')])):path[_0x3f01('0x63')](config['root'],_0x35034f,_[_0x3f01('0x65')](_0x3f01('0x6f')));var _0x7bee9f=_0x3f01('0x70')+_[_0x3f01('0x66')](_0x3f01('0x59'));if(_0x49f6db[_0x7bee9f]||!_0x3fa83f[_0x3f01('0x67')]){_0x1ff26d=path[_0x3f01('0x63')](config[_0x3f01('0x64')],_0x35034f,_[_0x3f01('0x65')](_0x3f01('0x6f')));}if(!fs[_0x3f01('0x62')](_0x1ff26d)){throw new db[(_0x3f01('0x71'))][(_0x3f01('0x69'))](_[_0x3f01('0x66')]('loginLogo')+_0x3f01('0x6a'));}return _0x5a4fd6[_0x3f01('0x6b')](_0x1ff26d);}})[_0x3f01('0x27')](handleError(_0x5a4fd6,null));};exports[_0x3f01('0x72')]=function(_0x532b8c,_0x40f159){return db['Setting'][_0x3f01('0x51')]({'where':{'id':_0x532b8c['params']['id']},'attributes':['securePassword']})[_0x3f01('0x1d')](respondWithResult(_0x40f159,null))[_0x3f01('0x27')](handleError(_0x40f159,null));};exports[_0x3f01('0x73')]=function(_0x347336,_0x466534,_0xc872e8){if(_0x347336[_0x3f01('0x55')]&&_0x347336['file']['filename']){_0x347336[_0x3f01('0x52')][_0x3f01('0x5d')]=_0x347336[_0x3f01('0x55')][_0x3f01('0x57')];}return db[_0x3f01('0x39')][_0x3f01('0x51')]({'where':{'id':_0x347336['params']['id']}})['then'](handleEntityNotFound(_0x466534,null))['then'](saveUpdates(_0x347336['body'],null))['then'](respondWithResult(_0x466534,null))[_0x3f01('0x27')](handleError(_0x466534,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x24ee81,_0x165ecc,_0x68e3d5){var _0x866286='server/files/images/logos';var _0x3a63dd={'custom':![]};return utilLicense['getLicense']()[_0x3f01('0x1d')](function(_0x59f347){if(_0x59f347){_0x3a63dd=_0x59f347;}return db[_0x3f01('0x39')]['find']({'where':{'id':_0x24ee81[_0x3f01('0x53')]['id']},'attributes':[_0x3f01('0x56'),_0x3f01('0x59'),_0x3f01('0x5d'),_0x3f01('0x5e'),'defaultLogo',_0x3f01('0x6e'),_0x3f01('0x60'),'defaultFavicon'],'raw':!![]});})[_0x3f01('0x1d')](handleEntityNotFound(_0x165ecc,null))['then'](function(_0x170019){if(_0x170019){var _0x17352a=_0x170019[_0x3f01('0x5d')]&&fs[_0x3f01('0x62')](path[_0x3f01('0x63')](config[_0x3f01('0x64')],_0x866286,_[_0x3f01('0x65')](_0x170019[_0x3f01('0x5d')])))?path['join'](config['root'],_0x866286,_['toLower'](_0x170019[_0x3f01('0x5d')])):path[_0x3f01('0x63')](config[_0x3f01('0x64')],_0x866286,_[_0x3f01('0x65')]('default_preferred.png'));var _0x5618e9=_0x3f01('0x70')+_[_0x3f01('0x66')](_0x3f01('0x5d'));if(_0x170019[_0x5618e9]||!_0x3a63dd[_0x3f01('0x67')]||!_0x3a63dd[_0x3f01('0x5d')]){_0x17352a=path[_0x3f01('0x63')](config['root'],_0x866286,_['toLower'](_0x3f01('0x74')));}if(!fs[_0x3f01('0x62')](_0x17352a)){throw new db[(_0x3f01('0x71'))]['ValidationError'](_[_0x3f01('0x66')]('preferred')+_0x3f01('0x6a'));}return _0x165ecc[_0x3f01('0x6b')](_0x17352a);}})[_0x3f01('0x27')](handleError(_0x165ecc,null));};exports['addFavicon']=function(_0x523204,_0x57bc20,_0x3dd0f4){if(_0x523204[_0x3f01('0x55')]&&_0x523204[_0x3f01('0x55')][_0x3f01('0x57')]){_0x523204[_0x3f01('0x52')][_0x3f01('0x5e')]=_0x523204[_0x3f01('0x55')]['filename'];}return db[_0x3f01('0x39')]['find']({'where':{'id':_0x523204[_0x3f01('0x53')]['id']}})[_0x3f01('0x1d')](handleEntityNotFound(_0x57bc20,null))[_0x3f01('0x1d')](saveUpdates(_0x523204[_0x3f01('0x52')],null))[_0x3f01('0x1d')](respondWithResult(_0x57bc20,null))['catch'](handleError(_0x57bc20,null));};var utilLicense=require(_0x3f01('0x5a'));exports[_0x3f01('0x75')]=function(_0x50779e,_0x1705cd,_0x244dc6){var _0x5a19c8='server/files/images/logos';var _0x4bd8cb={'custom':![]};return utilLicense[_0x3f01('0x6d')]()[_0x3f01('0x1d')](function(_0x21e0a8){if(_0x21e0a8){_0x4bd8cb=_0x21e0a8;}return db[_0x3f01('0x39')]['find']({'where':{'id':_0x50779e[_0x3f01('0x53')]['id']},'attributes':['logo','loginLogo','preferred','favicon',_0x3f01('0x5f'),'defaultLoginLogo',_0x3f01('0x60'),_0x3f01('0x61')],'raw':!![]});})[_0x3f01('0x1d')](handleEntityNotFound(_0x1705cd,null))[_0x3f01('0x1d')](function(_0x2f45af){if(_0x2f45af){var _0x411350=_0x2f45af[_0x3f01('0x5e')]&&fs[_0x3f01('0x62')](path[_0x3f01('0x63')](config[_0x3f01('0x64')],_0x5a19c8,_[_0x3f01('0x65')](_0x2f45af[_0x3f01('0x5e')])))?path[_0x3f01('0x63')](config['root'],_0x5a19c8,_[_0x3f01('0x65')](_0x2f45af[_0x3f01('0x5e')])):path[_0x3f01('0x63')](config[_0x3f01('0x64')],_0x5a19c8,_[_0x3f01('0x65')](_0x3f01('0x76')));var _0x186198=_0x3f01('0x70')+_[_0x3f01('0x66')]('favicon');if(_0x2f45af[_0x186198]||!_0x4bd8cb[_0x3f01('0x67')]){_0x411350=path['join'](config[_0x3f01('0x64')],_0x5a19c8,_['toLower']('default_favicon.ico'));}if(!fs[_0x3f01('0x62')](_0x411350)){throw new db['Sequelize'][(_0x3f01('0x69'))](_[_0x3f01('0x66')](_0x3f01('0x5e'))+_0x3f01('0x6a'));}return _0x1705cd[_0x3f01('0x6b')](_0x411350);}})[_0x3f01('0x27')](handleError(_0x1705cd,null));};exports[_0x3f01('0x77')]=function(_0x2a79ce,_0x58dc17){var _0x197584={'offset':moment()[_0x3f01('0x78')]()};_0x197584['now']=moment()[_0x3f01('0x78')](_0x197584['offset'])[_0x3f01('0x79')](_0x3f01('0x7a'));return _0x58dc17['status'](0xc8)[_0x3f01('0x37')](_0x197584);};