docs: plan/spec auf recipe_view (singular) angeglichen
Tabellen-Konvention im Repo ist singular — siehe Code-Review-Findings
zu Task 1 (commit 543008b). Plan und Spec angeglichen damit weitere
Tasks nicht mit dem alten Plural arbeiten.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,18 +23,18 @@ beschäftigte mich" Rezepte ohne Suche.
|
||||
|
||||
### Migration
|
||||
|
||||
Neue Datei `src/lib/server/db/migrations/014_recipe_views.sql`
|
||||
Neue Datei `src/lib/server/db/migrations/014_recipe_view.sql`
|
||||
(Numbering: aktuell ist die letzte Migration `013_shopping_list.sql`):
|
||||
|
||||
```sql
|
||||
CREATE TABLE recipe_views (
|
||||
CREATE TABLE recipe_view (
|
||||
profile_id INTEGER NOT NULL REFERENCES profiles(id) ON DELETE CASCADE,
|
||||
recipe_id INTEGER NOT NULL REFERENCES recipes(id) ON DELETE CASCADE,
|
||||
last_viewed_at TEXT NOT NULL DEFAULT (datetime('now')),
|
||||
PRIMARY KEY (profile_id, recipe_id)
|
||||
);
|
||||
CREATE INDEX idx_recipe_views_recent
|
||||
ON recipe_views(profile_id, last_viewed_at DESC);
|
||||
CREATE INDEX idx_recipe_view_recent
|
||||
ON recipe_view(profile_id, last_viewed_at DESC);
|
||||
```
|
||||
|
||||
Idempotent über `INSERT OR REPLACE` — mehrfache Visits ein- und desselben
|
||||
@@ -106,7 +106,7 @@ bekommt einen optionalen `profileId: number | null`-Parameter. Wenn
|
||||
```sql
|
||||
SELECT r.*, ...
|
||||
FROM recipes r
|
||||
LEFT JOIN recipe_views v
|
||||
LEFT JOIN recipe_view v
|
||||
ON v.recipe_id = r.id AND v.profile_id = :profileId
|
||||
ORDER BY v.last_viewed_at DESC NULLS LAST,
|
||||
r.title COLLATE NOCASE ASC
|
||||
@@ -205,7 +205,7 @@ Hauptliste, immer sichtbar — User würde das Scrollen verlieren.
|
||||
### Schema/Migration
|
||||
|
||||
- Migrations-Test (existierendes Pattern in `tests/integration`): nach
|
||||
`applyMigrations` muss `recipe_views` existieren mit erwarteten
|
||||
`applyMigrations` muss `recipe_view` existieren mit erwarteten
|
||||
Spalten
|
||||
|
||||
### View-Endpoint
|
||||
|
||||
Reference in New Issue
Block a user