service

CNA One

Franchise operating system (franchises and employees, pricing, products and learning books, school operations). Publishes access grants, employee, learning book, price table and audit messages; consumes the User, Franchise, LearningBook and PriceTable topics.

Service

Overview

cna-one is the application franchises and the franchisor use to run the schools: franchise and employee management, pricing, products and learning books, classrooms, students and calendar. It serves three scopes (franchise, franchisor, multi) through one GraphQL API. On the Kafka bus it is the busiest participant: it mirrors data published by 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, asks 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 to grant application access and to sync accounts, and uses the LearningBook and PriceTable topics as an internal work queue for pricing.

cna-one is the only application whose producer already reads owner from the event class, as the envelope contract requires, and the only one that guards against a missing routing key. Like the others it does not send producedBy yet.

Messages

Messages for this service

Sends messages (8)

Quickly find the message you need by searching for the name, type, or summary.
NameVersionTypeSummaryChannels
Grant Application Access
v1.0.0commandAsks CNA Auth to give a person access to an application, provisioning the account and user when they are new. Published by cna-one when an invited user is mirrored into a person; handled by cna-auth.
-
Employee Created
v1.0.0eventAn employee was created in CNA One, with the person it points at. Consumed by cna-auth to provision the account and the login user.
-
Employee Updated
v1.0.0eventAn 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.
-
Learning Book Published
v1.0.0eventA learning book was published and is on sale. cna-one's pricing consumer opens a pending price for it in every current and future default price group.
-
Learning Book Drafted
v1.0.0eventA learning book was created as a draft or moved back to draft, so it is not on sale. cna-one's pricing consumer removes its prices from current and future price tables.
-
Learning Book Discontinued
v1.0.0eventA learning book was discontinued and left the catalog. cna-one's pricing consumer removes its prices from current and future price tables.
-
Price Table Created
v1.0.0eventA price table was created with its default price groups. cna-one's pricing consumer seeds it with one price per available learning book, copying last year's amounts when they exist.
-
Entity Audited
v1.0.0eventA row of an audited table in CNA One was inserted, updated or deleted, with the old and new values. Infrastructure is wired but no entity opts in and nobody consumes it.
-

Receives messages (11)

Quickly find the message you need by searching for the name, type, or summary.
NameVersionTypeSummaryChannels
Invite User
v1.0.0commandInvites a person into the CNA platform. Published by cna-nexus and cna-placement when a user is created or re-invited; handled by cna-one, which creates the person and employee and then requests application access from cna-auth.
-
Franchise Created
v1.0.0eventA franchise unit was created in CNA Nexus by activating an opening contract. Full snapshot of the unit; cna-one mirrors it, its address and its partners as employees.
-
Economic Group Created
v1.0.0eventAn economic group was created in CNA Nexus. cna-one mirrors it by id so that franchises can reference it.
-
Economic Group Updated
v1.0.0eventAn economic group changed in CNA Nexus - renamed, toggled active or soft-deleted (there is no delete event). cna-one mirrors the new state by id.
-
Franchise Address Created
v1.0.0eventA franchise unit received its address in CNA Nexus. The address block of the franchise snapshot plus the franchise id. Published by cna-nexus, consumed by cna-one to mirror the address.
-
Franchise Address Updated
v1.0.0eventThe address of a franchise unit changed in CNA Nexus. The address block of the franchise snapshot plus the franchise id. Published by cna-nexus, consumed by cna-one to mirror the change.
-
Learning Book Published
v1.0.0eventA learning book was published and is on sale. cna-one's pricing consumer opens a pending price for it in every current and future default price group.
-
Learning Book Drafted
v1.0.0eventA learning book was created as a draft or moved back to draft, so it is not on sale. cna-one's pricing consumer removes its prices from current and future price tables.
-
Learning Book Discontinued
v1.0.0eventA learning book was discontinued and left the catalog. cna-one's pricing consumer removes its prices from current and future price tables.
-
Price Table Created
v1.0.0eventA price table was created with its default price groups. cna-one's pricing consumer seeds it with one price per available learning book, copying last year's amounts when they exist.
-
Partner Updated
v1.0.0eventThe personal data of a franchise partner changed in CNA Nexus - name, legal name, e-mail, phone or birth date. Snapshot of the person, keyed by the person id. To be published by cna-nexus and consumed by cna-one; neither side has the class yet.
-

Kafka consumers

Consumers run as separate processes: api/scripts/consumers/commonConsumer.ts, franchiseConsumer.ts and pricingConsumer.ts.

| Consumer group | Topics | Handler | | ---------------------------- | -------------- | -------------------------------------------------------------------- | ----------------------------- | | common-person-events | User | api/app/domains/common/person/consumers/personConsumer.ts | | franchise-franchise-events | Franchise | api/app/domains/franchise/franchise/consumers/franchiseConsumer.ts | | pricing-price-events | LearningBook | api/app/domains/pricing/price/consumers/priceConsumer.ts | | pricing-price-table-events | PriceTable | api/app/domains/pricing/priceTable/consumers/priceTableConsumer.ts | | (to be created) | Partner | target consumer of [[event | PartnerUpdated]], no code yet |

Custom properties

PropertyValue
Runtimex-runtimeExpress 5 + GraphQL Yoga + TypeORM/Postgres + kafkajs
Events Pathx-events-pathapi/app/events/<owner>/<aggregateRoot>/<EventName>.ts