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 57b3c41067
commit 3f59164ab2
97 changed files with 1099 additions and 4398 deletions
+5 -5
View File
@@ -1,10 +1,10 @@
import { test, expect, seed, loginAs, api } from "./fixtures";
import { test, expect, seed, loginAs, api, v2 } from "./fixtures";
// 1.50.1: long lists load a page (or just what's needed) at a time, with search and filters.
test.describe("long lists", () => {
test("Payments: today, recent and a person's payments for a refund", async ({ page }) => {
// A donation recorded today for the seeded user (on an event no other test totals up).
await api(page, "supervisor", "POST", "/api/payments", {
await v2(page, "supervisor", "POST", "/api/v2/payments", {
amount: 77, method: "cash", isDonation: true, eventId: seed().events.conference, userId: seed().users.user.id,
});
@@ -21,11 +21,11 @@ test.describe("long lists", () => {
test("Payments API: narrowing filters", async ({ page }) => {
const userId = seed().users.user.id;
const mine = await api<{ data: { userId: string }[] }>(page, "supervisor", "GET", `/api/payments?userId=${userId}&limit=200`);
const mine = await v2<{ data: { userId: string }[] }>(page, "supervisor", "GET", `/api/v2/payments?userId=${userId}&limit=200`);
expect(mine.data.length).toBeGreaterThan(0);
expect(mine.data.every((p) => p.userId === userId)).toBe(true);
const unpaid = await api<{ status: string }[]>(page, "supervisor", "GET", "/api/registrations?unpaid=1");
const unpaid = await v2<{ status: string }[]>(page, "supervisor", "GET", "/api/v2/registrations?unpaid=true");
expect(unpaid.every((r) => ["pending", "confirmed", "partial_paid"].includes(r.status))).toBe(true);
});
@@ -44,7 +44,7 @@ test.describe("long lists", () => {
});
test("Data requests: search", async ({ page }) => {
const res = await api<{ requests: unknown[]; total: number }>(page, "admin", "GET", "/api/privacy/requests?status=closed&search=nobody-matches-this-xyz");
const res = await v2<{ requests: unknown[]; total: number }>(page, "admin", "GET", "/api/v2/privacy/requests?status=closed&search=nobody-matches-this-xyz");
expect(res.requests).toEqual([]);
expect(res.total).toBe(0);
});