CQRS & Events
Commands
import { BaseCommand } from '@soapjs/soap/cqrs';
import { CommandHandler } from '@soapjs/soap-express/cqrs';
import { Inject, Result } from '@soapjs/soap';
export class CreateUserCommand extends BaseCommand {
constructor(public readonly email: string) { super(); }
}
@CommandHandler(CreateUserCommand)
export class CreateUserHandler {
constructor(@Inject('UserRepository') private readonly repo: UserRepository) {}
async handle(cmd: CreateUserCommand): Promise<Result<User>> {
// ...validate, build the entity, persist
return Result.withSuccess(user);
}
}Queries
Wiring & dispatching
Domain Events
Read models & projections
Guidelines
Last updated