consentIdidentifierrequiredWhat identifies the consent
Becomes the column consent_id of consent.
Written at commons/data/models/contract/mod.ts:134
A subject's consent to a purpose between two dates, and whether it was taken back: what makes a use of their data allowed or not
Model contract. Written in commons/data/models/contract/mod.ts:131. Identified by consentId.
consentIdidentifierrequiredWhat identifies the consent
Becomes the column consent_id of consent.
Written at commons/data/models/contract/mod.ts:134
purposetextrequiredWhat the data may be used for
Becomes the column purpose of consent.
Written at commons/data/models/contract/mod.ts:136
statuscode of consentStatusrequiredWhether it is in force
Becomes the column status of consent.
Written at commons/data/models/contract/mod.ts:137
subjecttextrequiredWhose it is, as a pseudonymous key
Becomes the column subject of consent.
Written at commons/data/models/contract/mod.ts:135
validFrominstantrequiredFrom when it holds
Becomes the column valid_from of consent.
Written at commons/data/models/contract/mod.ts:138
validToinstantoptionalUntil when it holds, where it ends
Becomes the column valid_to of consent.
Written at commons/data/models/contract/mod.ts:139
Projects to the table consent with the primary key consent_id.
| Column | Type | Null | Role | From |
|---|---|---|---|---|
consent_id | text | false | attribute | consent.consentId |
purpose | text | false | attribute | consent.purpose |
status | text | false | attribute | consent.status |
subject | text | false | attribute | consent.subject |
valid_from | timestamp | false | attribute | consent.validFrom |
valid_to | timestamp | true | attribute | consent.validTo |
CREATE TABLE IF NOT EXISTS "consent" (
"consent_id" VARCHAR NOT NULL PRIMARY KEY,
"subject" VARCHAR NOT NULL,
"purpose" VARCHAR NOT NULL,
"status" VARCHAR NOT NULL,
"valid_from" TIMESTAMPTZ NOT NULL,
"valid_to" TIMESTAMPTZ,
CONSTRAINT "consent_status_ck" CHECK ("status" IN ('granted', 'withdrawn'))
);CREATE TABLE IF NOT EXISTS "consent" (
"consent_id" TEXT NOT NULL PRIMARY KEY,
"subject" TEXT NOT NULL,
"purpose" TEXT NOT NULL,
"status" TEXT NOT NULL,
"valid_from" TIMESTAMPTZ NOT NULL,
"valid_to" TIMESTAMPTZ,
CONSTRAINT "consent_status_ck" CHECK ("status" IN ('granted', 'withdrawn'))
);CREATE TABLE IF NOT EXISTS "consent" (
"consent_id" TEXT NOT NULL PRIMARY KEY,
"subject" TEXT NOT NULL,
"purpose" TEXT NOT NULL,
"status" TEXT NOT NULL,
"valid_from" TEXT NOT NULL,
"valid_to" TEXT,
CONSTRAINT "consent_status_ck" CHECK ("status" IN ('granted', 'withdrawn'))
);Read and written from TypeScript with the types the model gives: import { consent } from "@intellectual-frontiers/data/sql/typed/models". Generated in commons/data/sql/typed/models/contract.auto.ts: do not edit.
import { from } from "@intellectual-frontiers/data/sql/typed";
import { consent } from "@intellectual-frontiers/data/sql/typed/models";
const rows = await from(consent).select((s) => ({ consentId: s.consent.consentId, subject: s.consent.subject })).run(runner);