feat: Add debug logging to settings persistence
Some checks failed
ParentFlow CI/CD Pipeline / Backend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Frontend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Security Scanning (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-app/maternal-app-backend dockerfile:Dockerfile.production name:backend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-web dockerfile:Dockerfile.production name:frontend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Development (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled

This commit is contained in:
Andrei
2025-10-08 15:02:14 +00:00
parent c228ed4292
commit ced46cbe7f
2 changed files with 9 additions and 1 deletions

View File

@@ -438,6 +438,8 @@ export class DashboardService {
}
async updateSettings(settings: any) {
console.log('📝 updateSettings called with:', JSON.stringify(settings, null, 2));
// Define which settings can be stored in database
const dbSettingsMap = {
registrationMode: { key: 'registration_mode', type: 'string' },
@@ -468,10 +470,12 @@ export class DashboardService {
// Update or create setting
let setting = await this.settingsRepository.findOne({ where: { key } });
if (setting) {
console.log(`✏️ Updating ${key}: ${setting.value} -> ${value}`);
setting.value = value;
setting.type = type;
await this.settingsRepository.save(setting);
} else {
console.log(` Creating ${key}: ${value}`);
setting = this.settingsRepository.create({ key, value, type });
await this.settingsRepository.save(setting);
}
@@ -480,6 +484,8 @@ export class DashboardService {
}
}
console.log('✅ Settings updated:', updatedSettings);
return {
success: true,
message: `Settings updated successfully: ${updatedSettings.join(', ')}`,

View File

@@ -75,7 +75,9 @@ export default function SettingsPage() {
const handleSave = async () => {
try {
setSaving(true);
await apiClient.post('/admin/dashboard/settings', settings);
console.log('Saving settings:', settings);
const response = await apiClient.post('/admin/dashboard/settings', settings);
console.log('Save response:', response);
setSaveSuccess(true);
setTimeout(() => setSaveSuccess(false), 3000);
} catch (error) {