event

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.

Event Topic: EmployeeKey: id

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) and franchisorUpdateEmployee (franchisor scope), after the transaction that updates the person and the employee.
  • syncFranchisePartners, while handling a FranchiseCreated from Nexus, for every partner that already existed as an employee. Re-processing the same FranchiseCreated therefore 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 ownerONE
metadata.eventEmployeeUpdated
Consumer groupauth-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

PropertyValue
Contract Ownerx-contract-ownerONE
Kafka Topicx-kafka-topicEmployee
Message Keyx-message-keyid
Sourcex-sourcecna-one api/app/events/one/employee/EmployeeUpdated.ts
Driftx-driftcna-auth's copy types person.birthdate as Date, while the wire carries a YYYY-MM-DD string.
12 properties
idstring
required

Employee id (UUID) in cna-one franchise.employees. Kafka message key; stored as employeeId on the cna-auth account and user.

emailstring
required

Employee work e-mail, unique across employees. Becomes the cna-auth user e-mail.

isActiveboolean
required

Whether the employee is active. cna-auth sets blockedAt on the user when false and clears it when true.

personobject
required

Snapshot of the Person the employee points at (cna-one common.persons).