json icon

Person Created

v1.0.0events

A person was registered in CNA One: the civil data, the access cna-one grants them in astro, per franchise, and the students they answer for as a guardian. Snapshot keyed by the person id. Published by cna-one, in production since v0.4.0; astro has no consumer.

1{
2  "$schema": "https://json-schema.org/draft/2020-12/schema",
3  "title": "PersonCreated payload",
4  "type": "object",
5  "additionalProperties": false,
6  "properties": {
7    "id": {
8      "type": "string",
9      "description": "Person id (UUID) in cna-one common.persons. Kafka message key and the only id consumers correlate by; never the document."
10    },
11    "snapshotAt": {
12      "type": "string",
13      "format": "date-time",
14      "description": "Instant the snapshot was read from the database. Consumers keep the last applied value per person and discard a snapshot older than it, which absorbs redeliveries and concurrent publishes."
15    },
16    "name": {
17      "type": "string",
18      "description": "First name(s)."
19    },
20    "surname": {
21      "type": "string",
22      "description": "Surname."
23    },
24    "document": {
25      "type": "object",
26      "description": "Identity document, always present. A student under 18 enrolled without a CPF (ADR-0069) carries the code cna-one generates for them, with type CNA_CODE (cna-br/cna-one#1109), never a null document. An object from the start so the passport of a foreign student (RN-ALU-005) does not need a major version.",
27      "additionalProperties": false,
28      "properties": {
29        "type": {
30          "type": "string",
31          "enum": ["CPF", "CNPJ", "RNM", "PASSPORT", "CNA_CODE"],
32          "description": "Document type (cna-one DocumentType). CNA_CODE is the code cna-one generates for a student under 18 enrolled without a CPF; once the CPF is informed (a flow that does not exist yet) the same person, with the same id, goes out with CPF. PASSPORT is declared in the payload type but not in DocumentType, so it is never sent."
33        },
34        "number": {
35          "type": "string",
36          "description": "Document number without mask. For CNA_CODE, the generated code: CNA- followed by ten Crockford Base32 characters, 14 in all. Nobody shows or types it; it only keeps the document column unique and is never a key to correlate by (use id)."
37        },
38        "country": {
39          "type": ["string", "null"],
40          "description": "Issuing country of a passport (unique together with type and number), null for Brazilian documents. Always null today: cna-one has no passport."
41        }
42      },
43      "required": ["type", "number", "country"]
44    },
45    "email": {
46      "type": ["string", "null"],
47      "description": "Contact e-mail of the person, or null. Not the employee login e-mail, which belongs to CNA Auth."
48    },
49    "phone": {
50      "type": ["string", "null"],
51      "description": "Contact phone, or null."
52    },
53    "birthdate": {
54      "type": ["string", "null"],
55      "format": "date",
56      "description": "Birth date as YYYY-MM-DD, or null."
57    },
58    "gender": {
59      "type": "string",
60      "enum": ["MALE", "FEMALE", "OTHER", "NOT_INFORMED"],
61      "description": "Gender (cna-one Gender)."
62    },
63    "access": {
64      "type": "array",
65      "description": "What the person may do in astro right now, decided by cna-one: one entry per franchise where the person has access, with every profile they hold there at the same time (a coordinator who teaches gets TEACHER and UNIT_ADMIN in the same entry) and, for GUARDIAN, the students they answer for there. Only what is active. The same profile can appear in several franchises (a student enrolled in two schools gets STUDENT in both; there is no owning school). A franchise never appears twice. An empty list means no access: astro creates no user, or deactivates the one it has (never deletes).",
66      "items": {
67        "type": "object",
68        "additionalProperties": false,
69        "properties": {
70          "franchiseId": {
71            "type": "string",
72            "description": "Franchise id (UUID), the same id the franchise has in Nexus."
73          },
74          "profiles": {
75            "type": "array",
76            "description": "Every profile the person holds in that franchise now. Never empty: a franchise with no profile is left out of the list. Rules on the message page.",
77            "minItems": 1,
78            "uniqueItems": true,
79            "items": {
80              "type": "string",
81              "enum": ["TEACHER", "UNIT_ADMIN", "STUDENT", "GUARDIAN"]
82            }
83          },
84          "guardianOf": {
85            "type": "array",
86            "description": "The students the person answers for in this franchise, with their roles here. Not empty exactly when profiles has GUARDIAN; empty otherwise. Per franchise because the student is active school by school: every role comes from the guardian link and holds in each franchise where the student is active. Applied declaratively: in this franchise the consumer ends up with exactly these guardian-student links. The only place the link travels: the student's own snapshot carries no guardians (RN-AST-032).",
87            "items": {
88              "type": "object",
89              "additionalProperties": false,
90              "properties": {
91                "studentPersonId": {
92                  "type": "string",
93                  "description": "Person id (UUID) of the student in cna-one common.persons, the id of the student's own Person snapshot. The student has STUDENT in this franchise."
94                },
95                "relationship": {
96                  "type": ["string", "null"],
97                  "description": "Kinship from the guardian link (cna-one school_ops.student_guardians), free text such as mother or uncle, or null. The same in every franchise."
98                },
99                "roles": {
100                  "type": "array",
101                  "description": "Roles of the person for this student in this franchise (cna-one StudentGuardianRole): LEGAL, FINANCIAL and PEDAGOGICAL come from the guardian link and hold in every franchise where the student is active; PICKUP comes from the guardian link too (RN-AST-030). Never only PICKUP: a person who is only allowed to pick the student up gets no entry.",
102                  "items": {
103                    "type": "string",
104                    "enum": ["LEGAL", "FINANCIAL", "PEDAGOGICAL", "PICKUP"]
105                  },
106                  "minItems": 1,
107                  "uniqueItems": true
108                }
109              },
110              "required": ["studentPersonId", "relationship", "roles"]
111            }
112          }
113        },
114        "required": ["franchiseId", "profiles", "guardianOf"]
115      }
116    }
117  },
118  "required": [
119    "id",
120    "snapshotAt",
121    "name",
122    "surname",
123    "document",
124    "email",
125    "phone",
126    "birthdate",
127    "gender",
128    "access"
129  ]
130}
131

Details

Format
JSON Schema
Resource
events
Filename
schema.json

Versions