feat(cms): localize legal pages with a lossless migration (MITHOME-112)

Legal page title, last-updated text and section titles/contents become
localized; slug and section ids stay shared. A Payload migration wraps
existing values into { hu: value } on every legal page and its whole
version history, like the globals migration (MITHOME-111).

The migration helper now handles collections as well as globals
(rewriteDocs) and can scope version rewrites to the latest working copy,
which the upcoming English import needs. Migration tests share an
in-memory Mongo fake that honours query filters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Do Siki
2026-09-29 10:54:44 +02:00
co-authored by Claude Opus 5.5
parent ef93cec935
commit 0eb6594acc
11 changed files with 233 additions and 53 deletions
+7
View File
@@ -1,5 +1,6 @@
import * as migration_20260929_localize_globals from './20260929_localize_globals'
import * as migration_20260929_cta_page_links from './20260929_cta_page_links'
import * as migration_20260929_localize_legal_pages from './20260929_localize_legal_pages'
/**
* Payload migrations, in order. Passed to `mongooseAdapter({ prodMigrations })`
@@ -17,4 +18,10 @@ export const migrations = [
down: migration_20260929_cta_page_links.down,
name: '20260929_cta_page_links',
},
{
// MITHOME-112 — LegalPages counterpart of the globals locale migration.
up: migration_20260929_localize_legal_pages.up,
down: migration_20260929_localize_legal_pages.down,
name: '20260929_localize_legal_pages',
},
]