Skip to content

Instantly share code, notes, and snippets.

@MaxLarue
Last active July 9, 2022 15:59
Show Gist options
  • Save MaxLarue/c73832c579a94c2a6f8eca7dd560af8d to your computer and use it in GitHub Desktop.
Save MaxLarue/c73832c579a94c2a6f8eca7dd560af8d to your computer and use it in GitHub Desktop.
appointment-rating-listener
@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