Skip to content

B2: Use fixed date category keys - #5

Merged
Filionus merged 2 commits into
mainfrom
feat/b2-date-categories
Nov 26, 2026
Merged

Filionus merged 2 commits into
mainfrom
feat/b2-date-categories

Conversation

@ChargingCrystal

Copy link
Copy Markdown
Owner

B2 · F4, F8, F9

  • Migration 003 normalizes legacy German, English, and Dutch aliases after trimming whitespace and ignoring case. It stores unrecognized values as other and enforces the seven keys with a database check constraint.
  • The shared enum validates date creation, updates, filters, date responses, and dashboard categories. The existing dashboard query combines aliases after the migration rewrites their stored values.
  • Apply migration 003 from main before serving this API version on the hosted backend.

Frontend impact

Import DATE_CATEGORIES and DateCategory from shared/date-categories.ts and use these keys for forms, filters, returned dates, and dashboard labels. Add German, English, and Dutch translations for all seven keys. Clear the category filter by omitting the query parameter.

For example, POST /api/dates with {"title":"Movie night","category":"movie"} returns a date row with "category":"movie". GET /api/dates?category=movie filters by that key. Sending a legacy label such as Kino returns HTTP 400 with data.code = "validation_failed". Existing Kino, film, and cinema rows migrate to movie and share the same dashboard category.

Verification

  • Red commit df8f641 showed five invalid requests returned 200, legacy values were not rewritten, and the database accepted an unsupported category.
  • PGlite now checks migration from legacy rows, dashboard grouping, acceptance of every shared key, and constraint enforcement on insert and update.
  • HTTP contract tests cover category validation and parsing of date and dashboard responses.
  • npm test passed all 60 tests and npm run build passed.

@Filionus
Filionus merged commit 9e15157 into main Nov 26, 2026
1 check passed
@Filionus
Filionus deleted the feat/b2-date-categories branch November 26, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants