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.
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 owner | ONE |
metadata.event | LearningBookDrafted |
| Consumer group | pricing-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
| Property | Value |
|---|---|
| Contract Ownerx-contract-owner | ONE |
| Kafka Topicx-kafka-topic | LearningBook |
| Message Keyx-message-key | id |
| Sourcex-source | cna-one api/app/events/one/learningBook/LearningBookDrafted.ts |
Learning book id (UUID). Kafka message key.
Product the edition belongs to (product.products, type LEARNING_BOOK).
Publisher id (product.publishers).
Edition number.
Id in the Protheus ERP (4 characters).
ISBN (13 characters), or null.
URL of the digital book, or null.
Cover image URL, or null.
Whether digital content is available.
Publication status (cna-one LearningBookStatus). Matches the event: PUBLISHED, DRAFT or DISCONTINUED; UNDER_REVIEW never reaches the topic.
DRAFT PUBLISHED DISCONTINUED UNDER_REVIEW