event

Franchise Updated

A franchise unit changed in CNA Nexus - edited in one of the franchise screens, re-activated from a contract, or amended. Full snapshot. Nobody consumes it today; cna-one has no class for it and drops it.

Event Topic: FranchiseKey: idNo consumer

Overview

Fact: a franchise unit changed. Same payload as 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: a full snapshot re-read after commit. Since 1.1.0 it carries the unit’s primary contact (email, whatsapp, phone). Since 1.2.0 the address also carries countryId, foreignCity, foreignState, latitude and longitude, and each partner is identified by id (the person id) instead of personId.

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, always through manager.afterCommit(), from six places: the four franchise edit commands (legal information, operational data, financial data, location and contact), applyContractToFranchiseAggregate (a renewal, resale or re-activation projecting a ContractContractEntityv1.0.0A franchise contract in CNA Nexus - opening, renewal or resale - uploaded as a document, analysed by AI, reviewed by a p...Ownercna-platformView docs onto the unit, see Contract Activation RequestedContract Activation RequestedEventv1.0.0A user saved a contract for activation. cna-nexus's activation consumer turns it ACTIVE and creates or updates the franc...Ownercna-platformSchemaMapView docs) and applyAmendmentChanges (one message per applied Contract AmendmentContract AmendmentEntityv1.0.0A supplementary document attached to a contract - attachment, addendum or rescission - carrying one change per contract ...Ownercna-platformView docs, see Amendment Apply RequestedAmendment Apply RequestedEventv1.0.0A user finished reviewing a contract amendment and asked for its changes to be applied. cna-nexus's amendment consumer e...Ownercna-platformSchemaMapView docs).

Consumers. None. 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 subscribes to the topic but has no FranchiseUpdated class, so its consumer skips the message with a debug log. Franchise changes made in Nexus after creation are therefore not mirrored into One. Tracked in the drift list as a decision to make: consume it in One or stop producing it.

Kafka

Topic (aggregateRoot)Franchise
Message key (routingKey)payload.id
Contract ownerNEXUS
metadata.eventFranchiseUpdated
Consumer groupnone

Payload schema

Same payload type as FranchiseCreated (FranchisePayload).

Source of truth

import { FranchisePayload } from 'events/nexus/franchise/FranchiseCreated';
export class FranchiseUpdated extends Event<FranchisePayload> {
static readonly owner = 'NEXUS';
static readonly aggregateRoot = 'Franchise';
static readonly routingKey = 'id';
static readonly version = '1.2.0';
}

The class exists only in cna-nexus.

Custom properties

PropertyValue
Contract Ownerx-contract-ownerNEXUS
Kafka Topicx-kafka-topicFranchise
Message Keyx-message-keyid
Sourcex-sourcecna-nexus api/app/events/nexus/franchise/FranchiseUpdated.ts
Driftx-driftProduced by cna-nexus in six places; cna-one has no class for it, so franchise changes made in Nexus never reach One.
54 properties
idstring
required

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

namestring
required

Unit name.

codestring | null

Internal unit code, unique.

cnpjstring | null

Company registration number as stored (no normalisation). cna-one requires and validates it.

legalNamestring | null

Legal company name. cna-one requires it.

emailstring | null<email>

Primary contact e-mail of the unit (franchises.email in cna-nexus, not unique there). cna-one mirrors it and requires it to be unique across its franchises.

whatsappstring | null

WhatsApp number in E.164 (+5511912345678). Mirrored by cna-one.

Match pattern: ^\+[1-9]\d{6,14}$
phonestring | null

Primary contact phone in E.164. Mirrored by cna-one.

Match pattern: ^\+[1-9]\d{6,14}$
stateRegistrationstring | null

State registration number.

taxRegimestring | null

Tax regime (FranchiseTaxRegime), typed as string in the class.

Allowed values: SIMPLES_NACIONAL LUCRO_PRESUMIDO LUCRO_REAL
protheusIdstring | null

Id in the Protheus ERP.

conectaEnabledboolean
required

Inter-school sharing enabled.

openingStatusstring
required

Lifecycle stage (FranchiseOpeningStatus), typed as string in the class.

Allowed values: CREATED BUILT TRAINED SUSPENDED UNDER_REVIEW DEFAULTING
operationalStatusstring
required

Operational status (FranchiseOperationalStatus). cna-one maps OPERATIONAL to ACTIVE, anything else to INACTIVE.

Allowed values: OPERATIONAL NON_OPERATIONAL UNDER_DEVELOPMENT
financialStatusstring | null

Financial standing (FranchiseFinancialStatus).

Allowed values: ACTIVE INACTIVE SUSPENDED DEFAULTING UNDER_REVIEW
operationalStartAtstring | null<date-time>

ISO-8601 instant when operations started.

operationalEndAtstring | null<date-time>

ISO-8601 instant when operations ended.

firstContractStartsOnstring | null<date>

YYYY-MM-DD start of the earliest opening contract, or null. Ignored by cna-one.

categoryobject
required

Size/type category of the unit.

economicGroupobject | null

Economic group of the unit, or null. cna-one requires the group to have been mirrored first (EconomicGroupCreated).

operationalRegionobject | null

Operational region, or null.

addressobject | null

Unit address, or null. cna-one requires street, number, neighborhood, postalCode and cityId to mirror it; it ignores countryId, foreignCity, foreignState, latitude and longitude.

partnersarray[object]
required

People behind the unit. May be empty. Roles are not included; cna-one turns each into a FRANCHISEE employee.

productsarray[object]
required

Products the unit is enabled to sell. cna-one keeps only the distinct sub-categories.