feat(consent): add versioned append-only consent ledger C1-C5
This commit is contained in:
1 parent
008254e44a
commit
de49f93b0b
64 files changed
+9244
-132
No files matched your search
@@ -21,6 +21,8 @@ tags:
|
||||
description: 'Hiring needs of an organization: requirements with their confirmation state and provenance, immutable versions, readiness, and category recommendations. Access comes only from an active membership in the organization; a need never requires a vacancy.'
|
||||
- name: invitation
|
||||
description: 'Invitations from an organization to one candidate: drafts with complete terms, immutable terms versions, sending, the candidate''s inbox, acceptance with the consent C4, structured declines, withdrawal and cancellation, and the contact grant. Contacts are readable only through an active grant, in a response separate from the terms.'
|
||||
- name: consent
|
||||
description: 'The consent ledger of the current account: the independent consents C1-C5 with their text versions, sources, states, and revocations. The ledger is append-only and returns only the caller''s own records.'
|
||||
- name: support
|
||||
description: 'Support cases of the current account: questions, complaints, appeals of a grade or an anti-cheat decision, and manual assessment requests. The author sees the number, the status, the response target, the decision, and the public history; moderators and internal notes stay hidden.'
|
||||
paths:
|
||||
@@ -1809,6 +1811,52 @@ paths:
|
||||
$ref: '#/components/responses/TooManyRequests'
|
||||
default:
|
||||
$ref: '#/components/responses/Problem'
|
||||
/api/v1/me/consents:
|
||||
get:
|
||||
operationId: ListMyConsents
|
||||
summary: List the consents of the current account with their history.
|
||||
description: |-
|
||||
Requires the session cookie of a candidate or an employer account. The subject comes from the session, never from a request parameter, so the response holds only the caller's own consents: no request can name another account, and records of other accounts are never listed. Returns a page of the consent ledger of the account, newest grant first with the identifier as the tie-breaker, with cursor pagination.
|
||||
|
||||
The ledger is append-only. Every grant is a record with its purpose, the accepted text version, the source, and the grant time; the server also stores the hash of exactly the text the subject saw. A newer text version of the same purpose is a new record, and the earlier one becomes `superseded` without any change. A revocation stamps every unrevoked record of the purpose, and for c4 of one organization, once; a later grant is a new record. Purposes are independent.
|
||||
|
||||
Without `state` the page lists the whole history; `state=active` lists the consents that hold now, one per purpose for c1, c2, c3, and c5 and one per accepted invitation for c4. A c4 record names the organization with the name its consent text showed (a snapshot that a later rename does not change), the selected contact fields, and the invitation with its terms version; it never carries a contact value. A c2 record proves the consent to the publication text; the published field set and its changes are evidence of the publication history (TASK-088).
|
||||
|
||||
Granting c1, c2, c3, and c5 in the consent settings and revoking any purpose are planned operations of this tag (TASK-063 and TASK-064); c1 is given at registration and c4 only in AcceptMyInvitation.
|
||||
|
||||
Access: a missing, unknown, expired, or revoked session answers 401 unauthenticated. A malformed `limit`, `cursor`, or `state` answers 400 validation_failed.
|
||||
security:
|
||||
- sessionCookie: []
|
||||
tags:
|
||||
- consent
|
||||
parameters:
|
||||
- name: state
|
||||
in: query
|
||||
required: false
|
||||
description: Lists only the records in this state; omit it for the whole history.
|
||||
schema:
|
||||
$ref: '#/components/schemas/ConsentState'
|
||||
- $ref: '#/components/parameters/PageLimit'
|
||||
- $ref: '#/components/parameters/PageCursor'
|
||||
responses:
|
||||
'200':
|
||||
description: A page of the consent ledger of the current account.
|
||||
headers:
|
||||
Cache-Control:
|
||||
$ref: '#/components/headers/CacheControlNoStore'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ConsentRecordList'
|
||||
examples:
|
||||
history:
|
||||
$ref: '#/components/examples/ConsentRecordListPage'
|
||||
'400':
|
||||
$ref: '#/components/responses/ValidationFailed'
|
||||
'401':
|
||||
$ref: '#/components/responses/Unauthenticated'
|
||||
default:
|
||||
$ref: '#/components/responses/Problem'
|
||||
/api/v1/me/support-cases:
|
||||
get:
|
||||
operationId: ListMySupportCases
|
||||
@@ -6236,6 +6284,163 @@ components:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/ContactTelegramUsername'
|
||||
- type: 'null'
|
||||
ConsentPurposeCode:
|
||||
type: string
|
||||
description: |-
|
||||
One of the independent consents of PRD FR01. A grant or a revocation of one purpose never changes another.
|
||||
|
||||
- c1: processing of personal data, given at registration.
|
||||
- c2: publication of the candidate card. The record proves the consent to the published text; which fields were published and when is evidence of the publication history (TASK-088), not of this record. Adding a field scope to c2 records later is an additive change.
|
||||
- c3: automatic categorization. Without it the candidate can request a manual assessment by the same rubric.
|
||||
- c4: transfer of the selected contact data to one organization, currently given only in an invitation acceptance.
|
||||
- c5: import of FSP results.
|
||||
|
||||
ConsentPurpose lists the subset whose text the client may read before an account exists.
|
||||
enum:
|
||||
- c1
|
||||
- c2
|
||||
- c3
|
||||
- c4
|
||||
- c5
|
||||
ConsentState:
|
||||
type: string
|
||||
description: |-
|
||||
State of a consent record, computed from the ledger.
|
||||
|
||||
- active: the consent holds. For c1, c2, c3, and c5 it is the newest unrevoked record of its purpose; every unrevoked c4 record is active, one per accepted invitation.
|
||||
- superseded: the subject later accepted another text version of the same purpose and has not revoked either. The record stays as evidence for its own time; it never applies to c4.
|
||||
- revoked: the consent was revoked. The record keeps its grant and its one revocation time; a later grant is a new record and never reopens it.
|
||||
enum:
|
||||
- active
|
||||
- superseded
|
||||
- revoked
|
||||
ConsentSource:
|
||||
type: string
|
||||
description: |-
|
||||
Where the subject gave the consent.
|
||||
|
||||
- registration: the c1 acceptance of RegisterAccount.
|
||||
- consent_settings: the consent settings of the account, for c1, c2, c3, and c5 (planned, TASK-063 and TASK-064).
|
||||
- invitation_acceptance: the c4 acceptance of AcceptMyInvitation.
|
||||
|
||||
A c4 given when sending an application (PRD Q9) is planned as an additional value.
|
||||
enum:
|
||||
- registration
|
||||
- consent_settings
|
||||
- invitation_acceptance
|
||||
ConsentRevocationSource:
|
||||
type: string
|
||||
description: |-
|
||||
Who recorded a revocation.
|
||||
|
||||
- consent_settings: the subject revoked the consent in the product.
|
||||
- support_request: an operator recorded a revocation that the subject requested through support.
|
||||
enum:
|
||||
- consent_settings
|
||||
- support_request
|
||||
ConsentOrganization:
|
||||
type: object
|
||||
description: Organization of a c4 consent as the consent recorded it. `name` is a snapshot of the name that the shown consent text carried at the time of the consent, and the stored text hash proves that text with this name; a later rename of the organization does not change it, so it can differ from the current name.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- id
|
||||
- name
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
description: Identifier of the organization.
|
||||
name:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 200
|
||||
description: Name of the organization in the consent text at the time of the consent. Plain text; clients show it as text, never as HTML.
|
||||
ConsentRecord:
|
||||
type: object
|
||||
description: 'One record of the consent ledger as its subject reads it: the purpose, the text version the subject accepted, where and when the consent was given, its state, and the revocation. A c4 record also names the organization, the contact fields, and the invitation with its terms version; these fields are null for every other purpose. The server also stores the SHA-256 hash of exactly the text the subject saw, which a client never sends or receives.'
|
||||
additionalProperties: false
|
||||
required:
|
||||
- id
|
||||
- purpose
|
||||
- state
|
||||
- text_version
|
||||
- source
|
||||
- granted_at
|
||||
- revoked_at
|
||||
- revocation_source
|
||||
- organization
|
||||
- fields
|
||||
- invitation_id
|
||||
- invitation_terms_version
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
description: Identifier of the record.
|
||||
purpose:
|
||||
$ref: '#/components/schemas/ConsentPurposeCode'
|
||||
state:
|
||||
$ref: '#/components/schemas/ConsentState'
|
||||
text_version:
|
||||
description: Version of the consent text that the subject accepted.
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ConsentTextVersion'
|
||||
source:
|
||||
$ref: '#/components/schemas/ConsentSource'
|
||||
granted_at:
|
||||
$ref: '#/components/schemas/Timestamp'
|
||||
revoked_at:
|
||||
description: Moment of the revocation, or null unless `state` is `revoked`.
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/Timestamp'
|
||||
- type: 'null'
|
||||
revocation_source:
|
||||
description: Who recorded the revocation, or null unless `state` is `revoked`.
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/ConsentRevocationSource'
|
||||
- type: 'null'
|
||||
organization:
|
||||
description: Organization that a c4 consent allows to read the fields, with the name the consent text showed, or null for every other purpose.
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/ConsentOrganization'
|
||||
- type: 'null'
|
||||
fields:
|
||||
type:
|
||||
- array
|
||||
- 'null'
|
||||
minItems: 1
|
||||
maxItems: 4
|
||||
uniqueItems: true
|
||||
description: Contact fields that a c4 consent covers, or null for every other purpose. One kind never implies another.
|
||||
items:
|
||||
$ref: '#/components/schemas/ContactFieldKind'
|
||||
invitation_id:
|
||||
type:
|
||||
- string
|
||||
- 'null'
|
||||
format: uuid
|
||||
description: Invitation whose acceptance gave a c4 consent, or null for every other purpose.
|
||||
invitation_terms_version:
|
||||
description: Terms version that the acceptance accepted, or null for every other purpose.
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/InvitationTermsVersion'
|
||||
- type: 'null'
|
||||
ConsentRecordList:
|
||||
type: object
|
||||
description: One page of the consent ledger of the current account, newest grant first.
|
||||
additionalProperties: false
|
||||
required:
|
||||
- items
|
||||
- page
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
maxItems: 100
|
||||
description: Records of the page.
|
||||
items:
|
||||
$ref: '#/components/schemas/ConsentRecord'
|
||||
page:
|
||||
$ref: '#/components/schemas/PageInfo'
|
||||
HealthResponse:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
@@ -10012,6 +10217,65 @@ components:
|
||||
granted_at: '2026-10-06T15:00:00Z'
|
||||
revoked_at: '2026-10-07T10:00:00Z'
|
||||
revocation_reason: participation_cancelled
|
||||
ConsentRecordListPage:
|
||||
summary: The whole consent history of a candidate on one page
|
||||
description: C1 was accepted at registration and again for a newer text version, so the first record is superseded; the version c1-2026-10-05 is an illustration, since the migration publishes only c1-2026-10-01 so far. C2 was granted and revoked. C4 was given in the acceptance of one invitation with the email only; the organization name is the one the consent text showed.
|
||||
value:
|
||||
items:
|
||||
- id: 01928f7a-9c0d-7e1f-8a2b-3c4d5e6f7a80
|
||||
purpose: c4
|
||||
state: active
|
||||
text_version: c4-2026-10-01
|
||||
source: invitation_acceptance
|
||||
granted_at: '2026-10-06T10:15:00Z'
|
||||
revoked_at: null
|
||||
revocation_source: null
|
||||
organization:
|
||||
id: 01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01
|
||||
name: ООО Пример Платежи
|
||||
fields:
|
||||
- email
|
||||
invitation_id: 01928f7a-7a8b-7c9d-8e0f-1a2b3c4d5e6f
|
||||
invitation_terms_version: 3
|
||||
- id: 01928f7a-8b9c-7d0e-9f1a-2b3c4d5e6f70
|
||||
purpose: c1
|
||||
state: active
|
||||
text_version: c1-2026-10-05
|
||||
source: consent_settings
|
||||
granted_at: '2026-10-05T12:00:00Z'
|
||||
revoked_at: null
|
||||
revocation_source: null
|
||||
organization: null
|
||||
fields: null
|
||||
invitation_id: null
|
||||
invitation_terms_version: null
|
||||
- id: 01928f7a-7a8b-7c9d-8e0f-1a2b3c4d5e60
|
||||
purpose: c2
|
||||
state: revoked
|
||||
text_version: c2-2026-10-01
|
||||
source: consent_settings
|
||||
granted_at: '2026-10-02T09:00:00Z'
|
||||
revoked_at: '2026-10-04T18:30:00Z'
|
||||
revocation_source: consent_settings
|
||||
organization: null
|
||||
fields: null
|
||||
invitation_id: null
|
||||
invitation_terms_version: null
|
||||
- id: 01928f7a-6f7a-7b8c-9d0e-1f2a3b4c5d50
|
||||
purpose: c1
|
||||
state: superseded
|
||||
text_version: c1-2026-10-01
|
||||
source: registration
|
||||
granted_at: '2026-10-01T08:00:00Z'
|
||||
revoked_at: null
|
||||
revocation_source: null
|
||||
organization: null
|
||||
fields: null
|
||||
invitation_id: null
|
||||
invitation_terms_version: null
|
||||
page:
|
||||
has_more: false
|
||||
next_cursor: null
|
||||
SupportCaseListPage:
|
||||
summary: The last page of the case summaries of the current account
|
||||
value:
|
||||
|
||||
Reference in new issue
Block a user