event

Franchise Partner Added(v1.0.0)

A person became a partner of a franchise unit, with their roles. One message per partner. Consumed by cna-nexus itself to invalidate the economic group statistics cache.

Event Topic: FranchiseKey: franchiseId
New version found

You are looking at a previous version of the event Franchise Partner Added. The latest version of this event isv1.1.0 →

Overview

Fact: a Franchise PartnerFranchise PartnerEntityv1.0.0The link between a franchise unit and a person behind it, with one or more roles - FRANCHISEE (leads the unit) or OPERAT...Ownercna-platformView docs row was added. The payload carries the unit, the partner’s roles and a snapshot of the person.

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 addPartners, which runs inside replaceFranchisePartners whenever a franchise is created from a contract, its legal information is edited, or a contract is applied onto it. Registered with manager.afterCommit(), one message per added partner, batched in a single send. The same commit may also carry Franchise Partner RemovedFranchise Partner RemovedEventv1.1.0A person stopped being a partner of a franchise unit. One message per partner. Consumed by cna-nexus itself to invalidat...Ownercna-platformSchemaMapView docs and Franchise Partner UpdatedFranchise Partner UpdatedEventv1.1.0The roles of a franchise partner changed - roles are the only mutable field. Carries the roles before and after. Consume...Ownercna-platformSchemaMapView docs messages.

What the consumer does. cna-nexus (touchEconomicGroupOnFranchisePartnerChange, group economic-group-partner-touch): loads the franchise; if it has an economic group, bumps the group’s updatedAt. That timestamp versions the Redis cache of the economic group statistics (units, franchisees, active groups), so the next read recomputes them. Franchises without a group are ignored. 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 has no class for this event and drops it.

Kafka

Topic (aggregateRoot)Franchise
Message key (routingKey)payload.franchiseId
Contract ownerNEXUS
metadata.eventFranchisePartnerAdded
Consumer groupeconomic-group-partner-touch

Payload schema

Source of truth

export type FranchisePartnerEventPerson = {
id: string;
document: string;
documentType: PersonsDocumentType;
name: string;
email?: string | null;
phone?: string | null;
birthDate?: Date | null;
legalName?: string | null;
isFranchisee: boolean;
};
export type FranchisePartnerEventPayload = {
franchiseId: string;
roles: FranchisePartnerRole[];
person: FranchisePartnerEventPerson;
};
export class FranchisePartnerAdded extends Event<FranchisePartnerEventPayload> {
static readonly owner = 'NEXUS';
static readonly aggregateRoot = 'Franchise';
static readonly routingKey = 'franchiseId';
}

Known drift

  • person.birthDate is a Date in code, sourced from a date column, and reaches the wire as a full ISO-8601 timestamp rather than YYYY-MM-DD.
  • person.isFranchisee is true when the person holds FRANCHISEE in any franchise, not only in franchiseId.

Custom properties

PropertyValue
Contract Ownerx-contract-ownerNEXUS
Kafka Topicx-kafka-topicFranchise
Message Keyx-message-keyfranchiseId
Sourcex-sourcecna-nexus api/app/events/nexus/franchise/FranchisePartnerAdded.ts
Driftx-driftperson.birthDate is typed Date but serialised as a full ISO-8601 timestamp for a date column; isFranchisee is global across franchises, not scoped to franchiseId.
12 properties
franchiseIdstring
required

Franchise id (UUID). Kafka message key.

rolesarray[string]
required

Roles of the partner in this unit (FranchisePartnerRole). Never empty.

personobject
required

Snapshot of the person (common.persons).