appointment_system/backend/test-config-update.js
2025-12-11 22:50:18 +08:00

42 lines
1008 B
JavaScript

/**
* Test Config Update
*/
const { sequelize } = require('./src/config/database');
const configService = require('./src/services/configService');
const testUpdate = async () => {
try {
console.log('Testing config update...');
// Test database connection
await sequelize.authenticate();
console.log('✓ Database connected');
// Test update
console.log('\nUpdating app_logo...');
const result = await configService.setConfig(
'app_logo',
'/uploads/test123.jpg',
'image',
'appearance',
'Application logo image URL'
);
console.log('✓ Update successful:', result.toJSON());
// Verify update
console.log('\nVerifying update...');
const config = await configService.getConfig('app_logo');
console.log('✓ Current value:', config);
process.exit(0);
} catch (error) {
console.error('✗ Error:', error);
console.error('Stack:', error.stack);
process.exit(1);
}
};
testUpdate();