fix(seed-forms): always run updateGlobal — fixes re-link on partial state
Some checks are pending
CI / Type Check (push) Waiting to run
CI / Lint (push) Waiting to run
CI / Unit Tests (push) Waiting to run
Deploy / Build & Push Image (push) Waiting to run
Deploy / Deploy to VPS (push) Blocked by required conditions

Remove early-return guard that skipped global linking when both forms already existed. Per-form idempotency is handled by the '?? await payload.create()' pattern, so we can safely always run updateGlobal to ensure forms are linked to their globals even after re-runs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Vadym Samoilenko 2026-06-03 14:06:02 +01:00
parent 41593c8edc
commit 0ef399c2f5

View file

@ -47,9 +47,6 @@ export async function POST(req: NextRequest): Promise<NextResponse> {
limit: 1,
overrideAccess: true,
})
if (existingBirthday.totalDocs >= 1 && existingGroup.totalDocs >= 1) {
return NextResponse.json({ message: 'Forms already seeded', count: 2 })
}
// ── 1. Birthday form ──────────────────────────────────────────────
const birthdayForm =