Enhance login functionality in AuthController and AuthService; add optional action parameter to login method, execute corresponding actions post-login, and handle action warnings. Update frontend components to trigger data refresh on successful login and display warnings if actions fail. Adjust SQL query in TimeEntryService for improved grouping.

This commit is contained in:
Torsten Schulz (local)
2025-10-20 07:48:53 +02:00
parent e55f20367d
commit 648a94c4da
8 changed files with 261 additions and 14 deletions

View File

@@ -0,0 +1,55 @@
# Migration: Timewish-Tabelle erweitern
## Problem
Die Produktions-Datenbank fehlen die Spalten `start_date` und `end_date` in der `timewish` Tabelle.
Dies führt zu Fehler 500 bei `/api/time-entries/stats/summary`.
## Fehler-Log
```
ER_BAD_FIELD_ERROR: Unknown column 'start_date' in 'field list'
```
## Lösung
Führe das Migrations-Skript auf dem Produktionsserver aus:
```bash
# 1. Auf den Server verbinden
ssh ihr-server
# 2. Zum Backend-Verzeichnis wechseln
cd /var/www/timeclock/backend
# 3. Migration ausführen
mysql -u timeclock -p timeclock < add-timewish-dates.sql
# Oder mit root-User:
sudo mysql timeclock < add-timewish-dates.sql
```
## Was macht das Skript?
1. Prüft ob die Spalten bereits existieren
2. Fügt `start_date` hinzu (DEFAULT '2000-01-01')
3. Fügt `end_date` hinzu (DEFAULT NULL = unbegrenzt gültig)
4. Zeigt die neue Tabellenstruktur an
## Nach der Migration
Alle bestehenden timewish-Einträge erhalten:
- `start_date` = '2000-01-01' (gilt seit langem)
- `end_date` = NULL (gilt unbegrenzt)
Das entspricht dem bisherigen Verhalten.
## Testen
Nach der Migration sollte dieser API-Call erfolgreich sein:
```bash
curl http://localhost:3010/api/time-entries/stats/summary \
-H "Authorization: Bearer YOUR_TOKEN"
```
## Rollback (falls nötig)
Falls Probleme auftreten:
```sql
ALTER TABLE timewish DROP COLUMN start_date;
ALTER TABLE timewish DROP COLUMN end_date;
```