Last active
July 9, 2022 15:59
-
-
Save MaxLarue/c73832c579a94c2a6f8eca7dd560af8d to your computer and use it in GitHub Desktop.
appointment-rating-listener
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Injectable() | |
export class RatingAppointmentListener { | |
constructor(@Inject(EVENT_SUBSCRIBE_SERVICE_TOKEN) eventSubscribeService: EventSubscribeService, | |
@Inject(RatingGateway) private readonly ratingGateway: RatingGateway) { | |
this.onAppointmentCreated = this.onAppointmentCreated.bind(this) | |
eventSubscribeService.subscribe(APPOINTMENT_CREATED_EVENT_TYPE, this.onAppointmentCreated) | |
} | |
async onAppointmentCreated(event: AppointmentCreatedEvent) { | |
await this.ratingGateway.sendRatingRequest(event.appointmentId) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment