Employee Updated
An employee or the person it points at changed in CNA One. Consumed by cna-auth to update the account and the user, including blocking or unblocking the login.
Overview
Fact: an employee, or the person behind it, changed in CNA One. Same payload as Employee CreatedEmployee CreatedEventv1.0.0An employee was created in CNA One, with the person it points at. Consumed by cna-auth to provision the account and the ...Ownercna-platformSchemaMapView docs: a full snapshot, not a delta.
When it is published. CNA OneCNA OneServicev1.0.0Franchise operating system (franchises and employees, pricing, products and learning books, school operations). Publishe...PublishesGrantApplicationAccess, EmployeeCreated +6SubscribesInviteUser, FranchiseCreated +9Ownercna-platformMapRepoView docs publishes it after the write completes:
updateEmployee(franchise scope) andfranchisorUpdateEmployee(franchisor scope), after the transaction that updates the person and the employee.syncFranchisePartners, while handling aFranchiseCreatedfrom Nexus, for every partner that already existed as an employee. Re-processing the sameFranchiseCreatedtherefore re-announces partners as updates, never as duplicate creations.
What the consumer does. CNA AuthCNA AuthServicev1.0.0Authentication and identity provider for the CNA platform (accounts, tokens, OTP/2FA, per-application access grants). Co...SubscribesGrantApplicationAccess, RevokeApplicationAccess +2Ownercna-platformMapRepoView docs runs the same handler as for EmployeeCreated (syncEmployeeEvent): rejects non-CPF persons, upserts the Account by document, then finds the User by employeeId or email and updates name, email, employeeId and blockedAt (set when isActive is false, cleared when true). A user missing at this point is created, with the first-access e-mail.
Kafka
Topic (aggregateRoot) | Employee |
Message key (routingKey) | payload.id |
| Contract owner | ONE |
metadata.event | EmployeeUpdated |
| Consumer group | auth-user-events |
Payload schema
Same payload type as EmployeeCreated (EmployeePayload).
Source of truth
import { EmployeePayload } from "events/one/employee/EmployeeCreated";
class EmployeeUpdated extends Event<EmployeePayload> { public static owner = "ONE"; public static aggregateRoot = "Employee"; public static routingKey = "id";}Known drift
Same as EmployeeCreated: cna-auth’s copy types person.birthdate as Date | null; the wire value is a YYYY-MM-DD string.
Custom properties
| Property | Value |
|---|---|
| Contract Ownerx-contract-owner | ONE |
| Kafka Topicx-kafka-topic | Employee |
| Message Keyx-message-key | id |
| Sourcex-source | cna-one api/app/events/one/employee/EmployeeUpdated.ts |
| Driftx-drift | cna-auth's copy types person.birthdate as Date, while the wire carries a YYYY-MM-DD string. |
Employee id (UUID) in cna-one franchise.employees. Kafka message key; stored as employeeId on the cna-auth account and user.
Employee work e-mail, unique across employees. Becomes the cna-auth user e-mail.
Whether the employee is active. cna-auth sets blockedAt on the user when false and clears it when true.
Snapshot of the Person the employee points at (cna-one common.persons).