WIP 2.0.0: v1 removed; Argon2id passwords; node-fetch gone

- /api (v1) answers 410 API_V1_REMOVED, except provider webhooks
  (/api/webhooks/*, /api/whatsapp/webhook) and links in sent messages
  (308s, one-click POST). 43 v1 route files and deprecation.ts removed;
  /docs redirects to /docs/v2; API_DOCUMENTATION.md points there.
- Read-only and impersonation lists name v2 paths only. The campus
  scope route test now runs over v2 routes (v2CampusScope.test.ts).
- Passwords hashed with Argon2id (@node-rs/argon2); bcrypt hashes still
  sign in and are re-hashed at the next sign-in.
- e2e on /api/v2 only (v2() helper); Playwright waits on /api/v2.
- MIGRATING-TO-2.md with the full v1 -> v2 table.
- Two documented response shapes corrected.

Backend 690 tests and e2e 102/102 (PayFast sandbox skipped) pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-02 16:35:06 +02:00
co-authored by Claude Opus 5.5
parent 89a952dedb
commit 9913a13f70
97 changed files with 1099 additions and 4398 deletions
+5 -5
View File
@@ -1,4 +1,4 @@
import { test, expect, seed, loginAs, api, pickEvent } from "./fixtures";
import { test, expect, seed, loginAs, api, pickEvent, v2 } from "./fixtures";
type EventRow = { id: string; title: string; scheduleType?: string; sessions?: { cancelled?: boolean }[] };
@@ -26,7 +26,7 @@ test.describe("supervisor tools", () => {
const row = page.locator("li", { hasText: "E2E Wizard Course" });
await expect(row.getByText(/5 sessions · /)).toBeVisible();
const all = await api<EventRow[]>(page, "supervisor", "GET", "/api/events/all");
const all = await v2<EventRow[]>(page, "supervisor", "GET", "/api/v2/events/manage");
const created = all.find((e) => e.title === "E2E Wizard Course");
expect(created?.scheduleType).toBe("sessions");
expect(created?.sessions?.filter((s) => !s.cancelled)).toHaveLength(5);
@@ -34,7 +34,7 @@ test.describe("supervisor tools", () => {
test("copy an event: the popup is filled in and every date moves with the new start", async ({ page }) => {
type Full = EventRow & { eventOptions: { name: string; price: number }[]; sessions: { startsAt: string; label?: string | null }[] };
const source = await api<Full>(page, "supervisor", "GET", `/api/events/${seed().events.course}`);
const source = await v2<Full>(page, "supervisor", "GET", `/api/v2/events/${seed().events.course}/full`);
await loginAs(page, "supervisor");
await page.goto("/dashboard/supervisor/events");
@@ -57,10 +57,10 @@ test.describe("supervisor tools", () => {
await create.click();
await expect(page.getByRole("heading", { name: "Copy Event" })).toBeHidden();
const all = await api<EventRow[]>(page, "supervisor", "GET", "/api/events/all?includePast=true");
const all = await v2<EventRow[]>(page, "supervisor", "GET", "/api/v2/events/manage?past=true");
const row = all.find((e) => e.title === "E2E Alpha Course (next term)");
expect(row).toBeTruthy();
const copy = await api<Full>(page, "supervisor", "GET", `/api/events/${row!.id}`);
const copy = await v2<Full>(page, "supervisor", "GET", `/api/v2/events/${row!.id}/full`);
expect(copy.scheduleType).toBe("sessions");
const active = (s: Full) => s.sessions.filter((x) => !(x as { cancelled?: boolean }).cancelled);
expect(active(copy)).toHaveLength(active(source).length);