@folksdo/cqrs-es
v1.1.2
Published
Our goal is to encapsulate the core infrastructure for CQRS and Event Sourcing (ES) in a module.
Readme
CQRS - Event Source
Our goal is to encapsulate the core infrastructure for CQRS and Event Sourcing (ES) in a module.
Getting Started
npm install --save @folksdo/cqrs-esOr
yarn add @folksdo/cqrs-esimport { BaseCommand } from ' @folksdo/cqrs-es';
import { AddProductPayload } from './types';
import { ProductAddedToCartEvent } from '../events/cart-events';
export class AddProductToCartCommand extends BaseCommand<AddProductPayload, ProductAddedToCartEvent> {
protected process(payload: AddProductPayload): ProductAddedToCartEvent {
return new ProductAddedToCartEvent(payload.cartId, payload.currentVersion, { productId: payload.productId, quantity: payload.quantity });
}
}