feat(shopping): custom categories - add, rename, delete and reorder (#26)
- New DB table shopping_categories (migration v5) seeds 9 default categories with Lucide icons and sort_order - Backend CRUD routes: GET/POST/PUT/DELETE /shopping/categories plus PATCH /shopping/categories/reorder - Category validation now uses DB instead of hardcoded constant; items of deleted category are moved to the next available one - Frontend shopping page loads categories from API, dropdown and grouping reflect custom order dynamically - Settings -> Shopping section: list categories with up/down buttons, click-to-rename, delete with confirmation; add new categories inline - i18n keys added in de/en/sv/it
This commit is contained in:
@@ -331,6 +331,30 @@ const MIGRATIONS = [
|
||||
CREATE INDEX IF NOT EXISTS idx_tasks_due ON tasks(due_date);
|
||||
`,
|
||||
},
|
||||
{
|
||||
version: 5,
|
||||
description: 'Einkaufskategorien als eigene Tabelle (anpassbar, sortierbar)',
|
||||
up: `
|
||||
CREATE TABLE IF NOT EXISTS shopping_categories (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL UNIQUE,
|
||||
icon TEXT NOT NULL DEFAULT 'tag',
|
||||
sort_order INTEGER NOT NULL DEFAULT 0,
|
||||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now'))
|
||||
);
|
||||
|
||||
INSERT INTO shopping_categories (name, icon, sort_order) VALUES
|
||||
('Obst & Gemüse', 'apple', 0),
|
||||
('Backwaren', 'wheat', 1),
|
||||
('Milchprodukte', 'milk', 2),
|
||||
('Fleisch & Fisch', 'beef', 3),
|
||||
('Tiefkühl', 'snowflake', 4),
|
||||
('Getränke', 'cup-soda', 5),
|
||||
('Haushalt', 'spray-can', 6),
|
||||
('Drogerie', 'pill', 7),
|
||||
('Sonstiges', 'shopping-basket', 8);
|
||||
`,
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user