IF Commons GitHub

invitation

conceptpersonal data

An invitation to join a tenant

Model identity. Written in commons/data/models/identity/concepts.ts:315. Identified by invitationId.

Governance: attributes

acceptedAtinstantoptional

When it was taken up

Becomes the column accepted_at of invitation.

Written at commons/data/models/identity/concepts.ts:323

emailtextrequiredpersonal data

The address it was sent to

Becomes the column email of invitation.

Annotations: privacy.personal={"category":"EmailAddress","purposes":["invite the person"]}

Written at commons/data/models/identity/concepts.ts:319

expiresAtinstantrequired

When it stops being valid

Becomes the column expires_at of invitation.

Written at commons/data/models/identity/concepts.ts:322

invitationIdidentifierrequired

What identifies the invitation, made by the application

Becomes the column invitation_id of invitation.

Written at commons/data/models/identity/concepts.ts:318

messagetextoptional

What the inviter wrote

Becomes the column message of invitation.

Written at commons/data/models/identity/concepts.ts:324

statuscode of invitationStatusrequired

Where it is

Becomes the column status of invitation.

Written at commons/data/models/identity/concepts.ts:321

tokenHashtextrequired

The hash of the secret in the link

Becomes the column token_hash of invitation.

Written at commons/data/models/identity/concepts.ts:320

Governance: relationships

acceptedByoptional

Who took it up To userAccount. Written at commons/data/models/identity/concepts.ts:330

invitedByone

Who invited To principal. Written at commons/data/models/identity/concepts.ts:329

tenantone

The tenant the person is invited to To tenant. Written at commons/data/models/identity/concepts.ts:328

Logical: the table

Projects to the table invitation with the primary key invitation_id.

ColumnTypeNullRoleFrom
accepted_attimestamptrueattributeinvitation.acceptedAt
accepted_by_user_account_principal_idtexttruereferenceinvitation.acceptedBy
emailtextfalseattributeinvitation.email
expires_attimestampfalseattributeinvitation.expiresAt
invitation_idtextfalseattributeinvitation.invitationId
invited_by_principal_idtextfalsereferenceinvitation.invitedBy
messagetexttrueattributeinvitation.message
statustextfalseattributeinvitation.status
tenant_idtextfalsereferenceinvitation.tenant
token_hashtextfalseattributeinvitation.tokenHash

Physical: SQL

CREATE TABLE IF NOT EXISTS "invitation" (
    "invitation_id" VARCHAR NOT NULL PRIMARY KEY,
    "email" VARCHAR NOT NULL,
    "token_hash" VARCHAR NOT NULL,
    "status" VARCHAR NOT NULL,
    "expires_at" TIMESTAMPTZ NOT NULL,
    "accepted_at" TIMESTAMPTZ,
    "message" VARCHAR,
    "tenant_id" VARCHAR NOT NULL,
    "invited_by_principal_id" VARCHAR NOT NULL,
    "accepted_by_user_account_principal_id" VARCHAR,
    CONSTRAINT "invitation_tenant_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "tenant" ("tenant_id"),
    CONSTRAINT "invitation_invited_by_principal_id_fk" FOREIGN KEY ("invited_by_principal_id") REFERENCES "principal" ("principal_id"),
    CONSTRAINT "invitation_accepted_by_user_account_principal_id_fk" FOREIGN KEY ("accepted_by_user_account_principal_id") REFERENCES "user_account" ("principal_id"),
    CONSTRAINT "invitation_status_ck" CHECK ("status" IN ('pending', 'accepted', 'expired', 'revoked'))
);

Physical: the typed table

Read and written from TypeScript with the types the model gives: import { invitation } from "@intellectual-frontiers/data/sql/typed/models". Generated in commons/data/sql/typed/models/identity.auto.ts: do not edit.

import { from } from "@intellectual-frontiers/data/sql/typed";
import { invitation } from "@intellectual-frontiers/data/sql/typed/models";

const rows = await from(invitation).select((s) => ({ invitationId: s.invitation.invitationId, email: s.invitation.email })).run(runner);

Titles, headings, exports, tables, columns and requirements. Esc closes.