fix: resolve database connection error for analytics settings
Mirror to GitHub / mirror (push) Successful in 20s
Test and Lint / backend-test (push) Successful in 1m10s
continuous-integration/drone/push Build is passing
Test and Lint / frontend-test (push) Successful in 2m23s
Version and Release / version-bump (push) Successful in 32s
Version and Release / trigger-drone (push) Successful in 3s

- Update publicSettings.js to handle missing analytics setting_type gracefully
- Add dedicated PUT /analytics endpoint for saving analytics settings
- Update frontend settings service to route to correct endpoints based on setting type
- Fix query to use WHERE clause that won't fail if analytics type doesn't exist

This fixes the "Connection terminated unexpectedly" error when fetching
public settings with analytics configuration.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-07-18 22:46:26 +02:00
parent 617f292516
commit 4966bc6a58
3 changed files with 59 additions and 6 deletions
+13 -1
View File
@@ -162,7 +162,19 @@ export const settingsService = {
// Update multiple settings at once
async updateSettings(settings: Record<string, any>): Promise<void> {
await api.put('/admin/settings/general', settings);
// Determine the endpoint based on setting keys
const firstKey = Object.keys(settings)[0];
let endpoint = '/admin/settings/general';
if (firstKey?.startsWith('security_')) {
endpoint = '/admin/settings/security';
} else if (firstKey?.startsWith('analytics_')) {
endpoint = '/admin/settings/analytics';
} else if (firstKey?.startsWith('branding_')) {
endpoint = '/admin/settings/branding';
}
await api.put(endpoint, settings);
},
// Get storage information