From 0ef399c2f5793b2aae6432d343b176deeec68295 Mon Sep 17 00:00:00 2001 From: Vadym Samoilenko Date: Wed, 3 Jun 2026 14:06:02 +0100 Subject: [PATCH] =?UTF-8?q?fix(seed-forms):=20always=20run=20updateGlobal?= =?UTF-8?q?=20=E2=80=94=20fixes=20re-link=20on=20partial=20state?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/app/api/admin/seed-forms/route.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/app/api/admin/seed-forms/route.ts b/src/app/api/admin/seed-forms/route.ts index 5470e47..b1fa635 100644 --- a/src/app/api/admin/seed-forms/route.ts +++ b/src/app/api/admin/seed-forms/route.ts @@ -47,9 +47,6 @@ export async function POST(req: NextRequest): Promise { 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 =