event

Economic Group Created

An economic group was created in CNA Nexus. cna-one mirrors it by id so that franchises can reference it.

Event Topic: FranchiseKey: idPayload drift

Overview

Fact: an Economic GroupEconomic GroupEntityv1.0.0A grouping of franchise units under one economic owner, used for reporting and statistics. Optional on a franchise; soft...Ownercna-platformView docs now exists in Nexus. The payload is the group row.

When it is published. CNA NexusCNA NexusServicev1.0.0Franchise network back-office (franchises, economic groups, partners, contracts and amendments, document storage, AI doc...PublishesInviteUser, ContractActivationRequested +13SubscribesContractActivationRequested, AmendmentApplyRequested +4Ownercna-platformMapRepoView docs, in createEconomicGroup, right after the insert. Published after the write, without afterCommit.

What the consumer does. 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 (franchiseConsumer, handler syncEconomicGroup, shared with Economic Group UpdatedEconomic Group UpdatedEventv1.0.0An economic group changed in CNA Nexus - renamed, toggled active or soft-deleted (there is no delete event). cna-one mir...Ownercna-platformSchemaMapView docs): upserts the group by id with name, isActive and deletedAt, storing them as they arrive without validation. createdAt and updatedAt are ignored. The mirrored group is what a later Franchise CreatedFranchise CreatedEventv1.2.0A franchise unit was created in CNA Nexus by activating an opening contract. Full snapshot of the unit; cna-one mirrors ...Ownercna-platformSchemaMapView docs needs to resolve economicGroup.id; a franchise arriving before its group fails to mirror.

Failures are logged and reported to Sentry, never rethrown.

Kafka

Topic (aggregateRoot)Franchise
Message key (routingKey)payload.id
Contract ownerNEXUS
metadata.eventEconomicGroupCreated
Consumer groupfranchise-franchise-events

Payload schema

Source of truth

export type EconomicGroupPayload = {
id: string;
name: string;
isActive: boolean;
createdAt: string;
updatedAt: string;
deletedAt: string | null;
};
export class EconomicGroupCreated extends Event<EconomicGroupPayload> {
static readonly owner = 'NEXUS';
static readonly aggregateRoot = 'Franchise';
static readonly routingKey = 'id';
}

Known drift

cna-one api/app/events/nexus/economicGroup/EconomicGroupCreated.ts has no createdAt or updatedAt, and is stored under a different folder than the canonical copy.

Custom properties

PropertyValue
Contract Ownerx-contract-ownerNEXUS
Kafka Topicx-kafka-topicFranchise
Message Keyx-message-keyid
Sourcex-sourcecna-nexus api/app/events/nexus/franchise/EconomicGroupCreated.ts
Driftx-driftcna-one's copy of EconomicGroupPayload lacks createdAt and updatedAt and lives under events/nexus/economicGroup/ instead of events/nexus/franchise/.
6 properties
idstring
required

Economic group id (UUID). Kafka message key; cna-one mirrors the group under this id.

namestring
required

Group name, unique among non-deleted groups.

isActiveboolean
required

Whether the group is active. False after a soft delete.

createdAtstring<date-time>
required

Creation instant. Absent from cna-one's copy of the type.

updatedAtstring<date-time>
required

Last update instant. Absent from cna-one's copy of the type.

deletedAtstring | null<date-time>
required

Soft-delete instant, or null. Always present as a key.