feat: edit and delete settings history rows
Backend:
- SettingsStore: Add GetByID, Update, Delete, Count methods
- SettingsService: Add UpdateSettings (validates same rules as Upsert),
DeleteSettings (guards against deleting the last row → 409)
- New sentinels: ErrSettingsNotFound, ErrLastSettingsRow
- Handler: PUT /api/settings/history/{id} → 200 updated row
DELETE /api/settings/history/{id} → 204 / 404 / 409
Frontend:
- API client: settings.update(id, body) and settings.delete(id)
- Settings page: history table gains edit (pencil) and delete (×) buttons
- Inline edit form expands in place within the table row
- Delete button disabled and hint shown when only one row remains
- maskLabel() helper shows workday names instead of raw bitmask
- After save/delete: full reload to reflect changes in 'current' section
This commit is contained in:
@@ -137,7 +137,14 @@ export const settings = {
|
||||
hours_per_week: number;
|
||||
workdays_mask: number;
|
||||
timezone: string;
|
||||
}) => request<Settings>('PUT', '/settings', body)
|
||||
}) => request<Settings>('PUT', '/settings', body),
|
||||
update: (id: number, body: {
|
||||
effective_from: string;
|
||||
hours_per_week: number;
|
||||
workdays_mask: number;
|
||||
timezone: string;
|
||||
}) => request<Settings>('PUT', `/settings/history/${id}`, body),
|
||||
delete: (id: number) => request<void>('DELETE', `/settings/history/${id}`)
|
||||
};
|
||||
|
||||
// ─── Health ──────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user