import { CommandBus, EventsHandler, IEventHandler } from '@nestjs/cqrs'; import { OrganizationRegisteredEvent } from '@energyweb/origin-backend'; import { CreateOrganizationBeneficiaryCommand } from '@energyweb/origin-organization-irec-api'; @EventsHandler(OrganizationRegisteredEvent) export class CreateIrecBeneficiaryHandler implements IEventHandler { constructor(private readonly commandBus: CommandBus) {} public async handle({ organization }: OrganizationRegisteredEvent): Promise { await this.commandBus.execute(new CreateOrganizationBeneficiaryCommand(organization)); } }