Accounts 1.1.0: moving Events' users in, people.* requests, new recovery codes
POST /api/accounts/v1/requests (crosscode.identity-request/1): import.* keeps each person's Events id as sub, password hash and authenticator secret (sealed in transit), consent, notices and lockout; linked when the email already has an account. people.* for product admins, limited to people the product knows. New recovery codes after the first 2FA sign-in for people moved in with 2FA. screen=signup. auth-client: request(), seal(), signUp. 8 new tests (47 in all). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
-- Accounts 1.1.0 (docs/EVENTS-3.0-PLAN.md §8): moving a product's users in, and its people.* requests.
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Account" ADD COLUMN "recoveryCodesNeeded" BOOLEAN NOT NULL DEFAULT false;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "EmailToken" ADD COLUMN "returnUrl" TEXT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "ProductLink" ADD COLUMN "importStartedAt" TIMESTAMP(3);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "ProductPerson" (
|
||||
"id" TEXT NOT NULL,
|
||||
"linkId" TEXT NOT NULL,
|
||||
"accountId" TEXT NOT NULL,
|
||||
"via" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "ProductPerson_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "ProductRequest" (
|
||||
"requestId" TEXT NOT NULL,
|
||||
"linkId" TEXT NOT NULL,
|
||||
"type" TEXT NOT NULL,
|
||||
"reply" JSONB NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "ProductRequest_pkey" PRIMARY KEY ("requestId")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "ProductPerson_linkId_accountId_key" ON "ProductPerson"("linkId", "accountId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "ProductPerson_accountId_idx" ON "ProductPerson"("accountId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "ProductRequest_createdAt_idx" ON "ProductRequest"("createdAt");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "ProductPerson" ADD CONSTRAINT "ProductPerson_linkId_fkey" FOREIGN KEY ("linkId") REFERENCES "ProductLink"("installId") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "ProductPerson" ADD CONSTRAINT "ProductPerson_accountId_fkey" FOREIGN KEY ("accountId") REFERENCES "Account"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "ProductRequest" ADD CONSTRAINT "ProductRequest_linkId_fkey" FOREIGN KEY ("linkId") REFERENCES "ProductLink"("installId") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
Reference in New Issue
Block a user