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,4 +1,4 @@
import { test, expect, seed, api, API } from "./fixtures";
import { test, expect, seed, api, API, v2 } from "./fixtures";
// Multi-campus. The campuses and the two events' campuses are seeded (e2e/support/prepare-db.js)
// with campuses off; these tests turn them on, and off again afterwards so the other specs see a
@@ -6,13 +6,13 @@ import { test, expect, seed, api, API } from "./fixtures";
test.describe("campuses", () => {
test.beforeAll(async ({ browser }) => {
const page = await browser.newPage();
await api(page, "admin", "PUT", "/api/campuses/settings", { enabled: true });
await v2(page, "admin", "PUT", "/api/v2/campuses/enabled", { enabled: true });
await page.close();
});
test.afterAll(async ({ browser }) => {
const page = await browser.newPage();
await api(page, "admin", "PUT", "/api/campuses/settings", { enabled: false });
await v2(page, "admin", "PUT", "/api/v2/campuses/enabled", { enabled: false });
await page.close();
});
@@ -38,8 +38,8 @@ test.describe("campuses", () => {
});
test("a campus with events can't be deleted", async ({ page }) => {
const res = await page.request.delete(`${API}/api/campuses/${seed().campuses.north.id}`, { headers: { Authorization: `Bearer ${seed().users.admin.token}` } });
const res = await page.request.delete(`${API}/api/v2/campuses/${seed().campuses.north.id}`, { headers: { Authorization: `Bearer ${seed().users.admin.token}` } });
expect(res.status()).toBe(409);
expect((await res.json()).code).toBe("CAMPUS_HAS_EVENTS");
expect((await res.json()).error.reason).toBe("CAMPUS_HAS_EVENTS");
});
});