From 71e3e121bec41eb7439c9ca5784a4db8b471a095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20My=C5=9Bliwiec?= Date: Thu, 20 Aug 2020 10:06:12 +0200 Subject: [PATCH] docs(): some comment improvements --- src/decorators/command-handler.decorator.ts | 9 +++++++-- src/decorators/events-handler.decorator.ts | 9 +++++++-- src/decorators/query-handler.decorator.ts | 8 +++++++- src/decorators/saga.decorator.ts | 3 ++- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/decorators/command-handler.decorator.ts b/src/decorators/command-handler.decorator.ts index b8d4e16c..8da554cb 100644 --- a/src/decorators/command-handler.decorator.ts +++ b/src/decorators/command-handler.decorator.ts @@ -3,8 +3,13 @@ import { ICommand } from '../index'; import { COMMAND_HANDLER_METADATA } from './constants'; /** - * CommandHandler handles actions dispatched on `CommandBus` - * @param command `ICommand` + * Decorator that marks a class as a Nest command handler. A command handler + * handles commands (actions) executed by your application code. + * + * The decorated class must implement the `ICommandHandler` interface. + * + * @param command command *type* to be handled by this handler. + * * @see https://docs.nestjs.com/recipes/cqrs#commands */ export const CommandHandler = (command: ICommand): ClassDecorator => { diff --git a/src/decorators/events-handler.decorator.ts b/src/decorators/events-handler.decorator.ts index c1abb716..c2c74296 100644 --- a/src/decorators/events-handler.decorator.ts +++ b/src/decorators/events-handler.decorator.ts @@ -3,8 +3,13 @@ import { IEvent } from '../index'; import { EVENTS_HANDLER_METADATA } from './constants'; /** - * EventHandler handle dispatched on `EventPublisher` - * @param events List of `IEvent` + * Decorator that marks a class as a Nest event handler. An event handler + * handles events executed by your application code. + * + * The decorated class must implement the `IEventHandler` interface. + * + * @param events one or more event *types* to be handled by this handler. + * * @see https://docs.nestjs.com/recipes/cqrs#events */ export const EventsHandler = (...events: IEvent[]): ClassDecorator => { diff --git a/src/decorators/query-handler.decorator.ts b/src/decorators/query-handler.decorator.ts index e6b50c18..c555f46c 100644 --- a/src/decorators/query-handler.decorator.ts +++ b/src/decorators/query-handler.decorator.ts @@ -3,7 +3,13 @@ import { IQuery } from '../interfaces'; import { QUERY_HANDLER_METADATA } from './constants'; /** - * QueryHandler's are responsive for the queries dispatch in `QueryBus` and usually used to `reads` + * Decorator that marks a class as a Nest query handler. A query handler + * handles queries executed by your application code. + * + * The decorated class must implement the `IQueryHandler` interface. + * + * @param query query *type* to be handled by this handler. + * * @see https://docs.nestjs.com/recipes/cqrs#queries */ export const QueryHandler = (query: IQuery): ClassDecorator => { diff --git a/src/decorators/saga.decorator.ts b/src/decorators/saga.decorator.ts index 0e287fd1..6fd09be8 100644 --- a/src/decorators/saga.decorator.ts +++ b/src/decorators/saga.decorator.ts @@ -2,7 +2,8 @@ import 'reflect-metadata'; import { SAGA_METADATA } from './constants'; /** - * Sagas may listen and react for N events + * Decorator that marks a class as a Nest saga. Sagas may listen and react to 1..N events. + * * @see https://docs.nestjs.com/recipes/cqrs#sagas */ export const Saga = (): PropertyDecorator => {