Phase 10, part 2: the first owner, from a one-time setup link

A new server prints a link to create its owner (supermarket setup-link
makes another); until it's used, every page says the setup isn't
finished. One-time links (schema 33) are kept as hashes and used up in
one statement; resets and invitations will use them too. The server
edition opens Postgres.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 08:53:14 -07:00
co-authored by Claude Opus 5.5
parent 96404a3580
commit 72455438c9
16 changed files with 553 additions and 10 deletions
+18
View File
@@ -2185,6 +2185,24 @@ This makes the server edition usable by a team. A commit after each part.
- Sessions aren't exported (`supermarket export`); users and memberships
are.
**Part 2 built 2026-11-25** on `phase10`.
- Schema 33: `links`, one-time links (setup, password reset, invitation),
kept as the hash of their token, each lasting its own time (a day, an
hour, 7 days). A new link replaces the user's earlier one for the same
purpose; using one is a single `DELETE … RETURNING`, so of two people
using it together, one gets *expired*. Not exported.
- The server edition opens Postgres (`SUPERMARKET_DATABASE_URL`). With no
owner yet, the start-up log prints `https://<domain>/setup/<token>`;
`supermarket setup-link` prints a new one, replacing it.
- The setup page (no sidebar, like the sign-in pages to come) asks for the
owner's email, name and password twice. Mistakes are shown and the link
stays usable; on success the owner is signed in and taken to the company
profile. Afterwards `/setup/…` leads to `/signin`.
- Until the owner exists, every page but the public ones answers 503,
*Supermarket isn't set up yet*, with the command for a new link.
- The server edition still won't start (`config.Ready`): signing in comes
in part 3.
1. **Users and sessions.**
- Tables:
- `users`: email, name, kind (person or agent), status (invited,