event

Person Updated

The civil data of a person, the access cna-one grants them in astro or the students they answer for changed, including losing all access. Same snapshot as PersonCreated, keyed by the person id. Published by cna-one, in production since v0.4.0; astro has no consumer.

Event Topic: PersonKey: idNo consumer
Under discussion with the Astro team

cna-one publishes this event in production since v0.4.0 (cna-br/cna-one#1102). astro has no consumer yet; the open points are on the PersonCreated page.

Overview

Fact: the snapshot of a person changed - the civil data, the profiles cna-one grants them in astro in some franchise, or the students they answer for in some franchise (guardianOf). Same payload as Person CreatedPerson CreatedEventv1.0.0A person was registered in CNA One: the civil data, the access cna-one grants them in astro, per franchise, and the stud...Ownercna-platformSchemaMapView docs: a full snapshot, not a delta. The consumer behaviour, how access is decided and the open questions are on that page.

There is no PersonDeleted. No person is deleted in CNA One; losing every role shows up as access: [], which deactivates the user in astro without deleting it (ADR-0065).

The guardian links travel only in the guardian’s snapshot. A change of link publishes the guardians who gained or lost something, never the student: their snapshot carries no guardians and goes out only when their civil data or the schools where they are active change (RN-AST-032).

When it is published. One rule: CNA OneCNA OneServicev1.0.0Franchise operating system (franchises and employees, pricing, products and learning books, school operations, receivabl...PublishesGrantApplicationAccess, EmployeeCreated +19SubscribesInviteUser, FranchiseCreated +17Ownercna-platformMapRepoView docs publishes it after the commit of any write that changes the civil data or the access of a person (its profiles or its guardianOf), whatever flow made it, re-reading the person from the database. Each flow reads the snapshot of the persons it touches before its write, and publishPersonSnapshots publishes only those whose payload, snapshotAt left out, differs after the commit: the flow says who it touched, the comparison says what changed. For a guardian that means whenever what their snapshot carries changes: the students, the roles or the franchises of each role, whatever the cause (RN-AST-032). A write that changes none of them (a new staff link that is still inactive, a pending employment contract, a renamed job role) publishes nothing. The status of a franchise is not an input of access either: a Franchise UpdatedFranchise UpdatedEventv2.1.0A franchise unit changed in CNA Nexus - edited in one of the franchise screens, re-activated from a contract, or amended...Ownercna-platformSchemaMapView docs from Nexus that inactivates or suspends a franchise publishes nothing for its students and guardians, who stay active in astro (RN-AST-031); on a termination they leave through the transfer and contract-ending flows below. The flows that call it, in production since cna-one v0.4.0 (cna-br/cna-one#1102):

FlowPersonsWhat changes
updateEmployee (franchise) and franchisorUpdateEmployeeThe employeeCivil data. The only place where the civil data of a person who is an employee is edited: a student who is also an employee gets one PersonUpdated, and no enrollment message
createEmployee (franchise), also behind franchisorCreateEmployee, for a person already storedThe employeeUsually nothing, so nothing goes out: the new staff link is born inactive
toggleTeachingProfileThe employeeTEACHER in that franchise, gained or lost, when the staff link is active and stands on an ACTIVE employment contract
updateEmploymentContract and franchisorUpdateEmploymentContractThe employee of the contract. A contract no longer changes employee (cna-br/cna-one#1130)Staff link activated or deactivated, job role changed: TEACHER and UNIT_ADMIN in that franchise
franchisorUpdateJobRoleEvery person with an ACTIVE employment contract in the job roleUNIT_ADMIN in the franchise of each contract, when the set of functions of the job role changes (COORDINATOR, SECRETARY; the functions of the FRANCHISEE job role cannot change). Renaming the job role or sending the same functions in another order publishes nothing. A job role belongs to the whole network, so one change can publish many persons
Partner sync from Nexus: FranchisePartnerAdded, FranchisePartnerUpdated and the partners of FranchiseCreated / FranchiseUpdatedThe partner, when the person already existed (a new one gets PersonCreated): a teacher, a student, a guardian or a partner of another franchiseName and e-mail from Nexus, written over the stored person; UNIT_ADMIN in that franchise, gained or regained. A franchise snapshot applies every partner again, so only the partners whose snapshot changed are published
Partner removal from Nexus: FranchisePartnerRemoved and the partners a FranchiseCreated / FranchiseUpdated stops namingThe removed partner, when an active partner link was actually revokedThe staff link in that franchise is deactivated: UNIT_ADMIN, and TEACHER when the link had it, leave that franchise
Partner update from Nexus: Partner UpdatedPartner UpdatedEventv1.0.0The personal data of a franchise partner changed in CNA Nexus - name, legal name, e-mail, phone or birth date. Snapshot ...Ownercna-platformSchemaMapView docs (syncPerson)The partner, when already mirrored as an employee who holds or held a FRANCHISEE contract; anyone else is dropped, and no one is createdName, surname, e-mail, phone and birth date from Nexus, written over the stored person; a field the message omits keeps the stored value, and one out of format or an e-mail taken by someone else is dropped on its own. Written in cna-br/cna-one#1171
createContract (enrollment), not published yetEvery existing person whose empty civil fields the contract filled in; for an existing student, each guardian whose link the contract created or gave a new role or relationship. Not the student: their snapshot carries no guardians (RN-AST-032)Civil data. The new contract links no school before its first payment, but a link with LEGAL counts at once in every franchise where the student is already active (RN-AST-030). Written on the cna-one branch of/feature/CWH-52991-publish-person-school-ops, with no pull request yet
updateStudentGuardian (guardians card), from cna-br/cna-one#1261, not in production yetThe guardian of the link and, from cna-br/cna-one#1323, each replacement that takes over a role the link drops (one the update registers with a new CPF gets PersonCreated); never the student, and each only when their snapshot changedThe roles or the relationship of the link: the guardianOf of every franchise where the student is active. A replacement gains the role it lacked. An enrollment that moves to another pedagogical guardian changes nobody’s access
createStudentGuardian (guardians card), from cna-br/cna-one#1261, not in production yetThe new guardian, when the person already existed (a new one gets PersonCreated)The student in the guardianOf of every franchise where the student is active

updateStudent publishes nothing: since cna-br/cna-one#1022 it writes only the student’s observation, which is not in the payload.

Flows that do not exist in the code yet, or that exist and do not publish yet, carry the same call in their definition of done, for the persons whose access they change:

  • the first payment of a contract (registerChargePayment and registerCardSale, which activate the contract in the payment’s transaction from cna-br/cna-one#1322, not in production yet, and do not publish yet): the student gains STUDENT in the franchise of the contract, even when already active in another one, and each guardian who holds a role there for the student (rules on the Person CreatedPerson CreatedEventv1.0.0A person was registered in CNA One: the civil data, the access cna-one grants them in astro, per franchise, and the stud...Ownercna-platformSchemaMapView docs page) gains the student in the guardianOf of that franchise, and GUARDIAN with it (RN-AST-031). For a re-enrollment contract the first payment is also what resolves the opportunity (RN-MTR-048): the student stays active throughout, nothing goes out for them, and a change of holder moves no role by itself, since the roles are on the guardian links: the previous holder keeps theirs until the school changes them on the guardians card (RN-AST-030 has the holder of an adult student’s contract lose FINANCIAL once they hold no contract of the student in progress; no flow does it yet);
  • a contract leaving ACTIVE (concluded, cancelled, expired or transferred) with no re-enrollment opportunity open in that franchise, and a re-enrollment opportunity closing at the re-enrollment deadline without a first payment of the new contract: the student stops being active there, even when still active in another franchise, and leaves the guardianOf of that franchise for each guardian. While the opportunity is open the concluded contract still counts: the student stays active there, and so do their guardians’ roles (RN-AST-030). That includes the automatic cancellation when a lock expires (RN-MTR-034). Locking and unlocking a module, and an enrollment waiting for a classroom, publish nothing: the contract stays ACTIVE, and the change goes in the enrollment message (RN-AST-031);
  • transferring an enrollment to another franchise: STUDENT and GUARDIAN move;
  • adding or removing a guardian of a student, or changing the roles of the link: a PersonUpdated for the one who gained the role and for the one who lost it, not for the student (RN-AST-032). Adding from the registration card (createStudentGuardian) and changing the roles (updateStudentGuardian) publish from cna-br/cna-one#1261, not in production yet; removing does not exist. Whoever lost their last link to a student still gets the message, without that student, so astro undoes the link; the franchise entry only disappears when no profile is left in it, so a teacher of school A who stops being a guardian there stays TEACHER in A. A change of the contract holder, if that flow ever exists, follows the same rule, since it changes the links. Turning 18 publishes nothing: the school removes the guardians at the student’s request, through this flow. An enrollment message goes out too only when the enrollment itself changed, that is when it now points at another pedagogical guardian, and after the persons; changing the roles of a link touches an enrollment only when it takes the pedagogical role from the guardian the enrollment points at;
  • the job that ends employment contracts on their endsOn (the scheduler worker has no Kafka producer today);
  • informing the CPF of a student enrolled without one (ADR-0069): the document goes from CNA_CODE to CPF, with the same id.

Republish. RN-AST-033 asks for a command that publishes the full snapshot of one or more persons by their CNA One id, or of every person: for the initial load of astro, to recover a message lost after the commit (the producer logs a failure and has no outbox), and after a change made straight in the database that touches a person, a job role, a linked school or a guardian role. cna-br/cna-one#1261 adds it as the job jobs/republishPersonSnapshots, run by hand with --personIds=<id,id> or --allGuardians and a required --reason and --operator, which it logs; it announces every person as PersonUpdated, in batches of 500. It is on staging since 2026-11-24, not in production yet; until someone runs it, a lost message or a change made straight in the database reaches the topic only with the next write that changes the person.

In the same request, persons are published before the contract and enrollment messages that point at them.

Kafka

Topic (aggregateRoot)Person
Message key (routingKey)payload.id
Contract ownerONE
metadata.eventPersonUpdated
Consumer group(to be created)

Payload schema

Source of truth

PersonPayload comes from Person CreatedPerson CreatedEventv1.0.0A person was registered in CNA One: the civil data, the access cna-one grants them in astro, per franchise, and the stud...Ownercna-platformSchemaMapView docs.

api/app/events/one/person/PersonUpdated.ts
import Event from 'events/lib/event';
import { PersonPayload } from 'events/one/person/PersonCreated';
class PersonUpdated extends Event<PersonPayload> {
public static owner = 'ONE';
public static aggregateRoot = 'Person';
public static routingKey = 'id';
public static version = '1.0.0';
}
export default PersonUpdated;

Known drift

Observed on 2026-10-28 against cna-one staging (12e02d89c), and on 2026-11-30 against staging (800187d64) for the guardians card (cna-br/cna-one#1261, cna-br/cna-one#1323) and the republish job; the producer rechecked on 2026-11-17 against production (v0.4.0).

  • Same gaps as Person CreatedPerson CreatedEventv1.0.0A person was registered in CNA One: the civil data, the access cna-one grants them in astro, per franchise, and the stud...Ownercna-platformSchemaMapView docs: no consumer in astro, the enrollment that publishes nothing yet, the wizard still writing the previous guardian rule, no publication when the first payment activates a student contract, no re-enrollment opportunity, the passport, and no flow to remove a guardian.
  • The republish job of RN-AST-033 comes with cna-br/cna-one#1261, not in production yet; cna-br/cna-one#1121 was closed unmerged on 2026-10-26.

Custom properties

PropertyValue
Contract Ownerx-contract-ownerONE
Kafka Topicx-kafka-topicPerson
Message Keyx-message-keyid
Sourcex-sourcecna-one api/app/events/one/person/PersonUpdated.ts
Driftx-driftastro has no consumer. cna-one publishes from its franchise flows, in production since v0.4.0 (cna-br/cna-one#1102); the guardians card and the republish job come with cna-br/cna-one#1261, not in production yet, and the enrollment publishes nothing yet.
19 properties
idstring
required

Person id (UUID) in cna-one common.persons. Kafka message key and the only id consumers correlate by; never the document.

snapshotAtstring<date-time>
required

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.

namestring
required

First name(s).

surnamestring
required

Surname.

documentobject
required

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.

emailstring | null
required

Contact e-mail of the person, or null. Not the employee login e-mail, which belongs to CNA Auth.

phonestring | null
required

Contact phone, or null.

birthdatestring | null<date>
required

Birth date as YYYY-MM-DD, or null.

genderstring
required

Gender (cna-one Gender).

Allowed values: MALE FEMALE OTHER NOT_INFORMED
accessarray[object]
required

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).