event

Learning Book Drafted

A 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.

Event Topic: LearningBookKey: id

Overview

Fact: a learning book is in status DRAFT. Same payload as Learning Book PublishedLearning Book PublishedEventv1.0.0A learning book was published and is on sale. cna-one's pricing consumer opens a pending price for it in every current a...Ownercna-platformSchemaMapView docs.

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, on two occasions: when the franchisor creates a learning book (franchisorCreateLearningBook saves it as DRAFT and publishes right after), and when a status update lands on DRAFT (franchisorUpdateLearningBookStatus, for example unpublishing a book, which requires a reason). Published after the write, not inside afterCommit.

What the consumer does. cna-one’s pricing process (priceConsumer, handler syncLearningBookUnavailableToPrices, shared with LearningBookDiscontinued): loads every price of the book in the default groups of current and future price tables and soft-deletes them. An already-deleted price is deleted again so its deletedAt reflects the last exit from the catalog; nothing to delete is a silent no-op. A freshly created draft therefore has nothing to do.

Kafka

Topic (aggregateRoot)LearningBook
Message key (routingKey)payload.id
Contract ownerONE
metadata.eventLearningBookDrafted
Consumer grouppricing-price-events

Payload schema

Same payload type as LearningBookPublished (LearningBookPayload); status is DRAFT.

Source of truth

import { LearningBookPayload } from "events/one/learningBook/LearningBookPublished";
class LearningBookDrafted extends Event<LearningBookPayload> {
public static owner = "ONE";
public static aggregateRoot = "LearningBook";
public static routingKey = "id";
}

Custom properties

PropertyValue
Contract Ownerx-contract-ownerONE
Kafka Topicx-kafka-topicLearningBook
Message Keyx-message-keyid
Sourcex-sourcecna-one api/app/events/one/learningBook/LearningBookDrafted.ts
10 properties
idstring
required

Learning book id (UUID). Kafka message key.

productIdstring
required

Product the edition belongs to (product.products, type LEARNING_BOOK).

publisherIdstring
required

Publisher id (product.publishers).

editioninteger
required

Edition number.

protheusIdstring
required

Id in the Protheus ERP (4 characters).

isbnstring | null

ISBN (13 characters), or null.

urlstring | null

URL of the digital book, or null.

imageUrlstring | null

Cover image URL, or null.

isDigitalContentAvailableboolean
required

Whether digital content is available.

statusstring
required

Publication status (cna-one LearningBookStatus). Matches the event: PUBLISHED, DRAFT or DISCONTINUED; UNDER_REVIEW never reaches the topic.

Allowed values: DRAFT PUBLISHED DISCONTINUED UNDER_REVIEW