async execute(command: KillDragonCommand, resolve: (value?) => void) { console.log(clc.greenBright('KillDragonCommand...')); const { heroId, dragonId } = command; const hero = this.publisher.mergeObjectContext( await this.repository.findOneById(+heroId), ); hero.killEnemy(dragonId); hero.commit(); resolve(); }
handle(event: HeroKilledDragonEvent) { console.log(clc.greenBright('HeroKilledDragonEvent...')); }