Refactor dashboard widget management: Update dashboardService to handle user-specific widget configurations with create and update logic. Enhance LoggedInView to support adding the same widget type and display error messages for save operations. Ensure effective endpoint handling for widgets and improve UI interactions.
This commit is contained in:
@@ -108,6 +108,23 @@ const syncDatabase = async () => {
|
||||
console.warn('⚠️ Konnte type.widget_type nicht anlegen:', e?.message || e);
|
||||
}
|
||||
|
||||
// Dashboard: Benutzer-Konfiguration (Widgets pro User)
|
||||
console.log("Ensuring user_dashboard table exists...");
|
||||
try {
|
||||
await sequelize.query(`
|
||||
CREATE TABLE IF NOT EXISTS community.user_dashboard (
|
||||
user_id INTEGER NOT NULL PRIMARY KEY,
|
||||
config JSONB NOT NULL DEFAULT '{"widgets":[]}'::jsonb,
|
||||
CONSTRAINT user_dashboard_user_fk
|
||||
FOREIGN KEY (user_id)
|
||||
REFERENCES community."user"(id)
|
||||
ON DELETE CASCADE
|
||||
);
|
||||
`);
|
||||
} catch (e) {
|
||||
console.warn('⚠️ Konnte community.user_dashboard nicht anlegen:', e?.message || e);
|
||||
}
|
||||
|
||||
// Vokabeltrainer: Tabellen sicherstellen (auch ohne manuell ausgeführte Migrations)
|
||||
// Hintergrund: In Produktion sind Schema-Updates deaktiviert, und Migrations werden nicht automatisch ausgeführt.
|
||||
// Damit API/Menu nicht mit "relation does not exist" (42P01) scheitert, legen wir die Tabellen idempotent an.
|
||||
|
||||
Reference in New Issue
Block a user