import { DomainEventClass } from '../../../../Shared/domain/DomainEvent' ; import { DomainEventSubscriber } from '../../../../Shared/domain/DomainEventSubscriber' ; import { CourseCreatedDomainEvent } from '../../../Courses/domain/CourseCreatedDomainEvent' ; import { CourseId } from '../../../Shared/domain/Courses/CourseId' ; import { CoursesCounterIncrementer } from './CoursesCounterIncrementer' ; export class IncrementCoursesCounterOnCourseCreated implements DomainEventSubscriber < CourseCreatedDomainEvent > { constructor ( private incrementer ) { } subscribedTo ( ) { return [ CourseCreatedDomainEvent ] ; } async on ( domainEvent ) { await this . incrementer . run ( new CourseId ( domainEvent . aggregateId ) ) ; } }