From 757cb72e9c8c475c4c0a244851a7d77ffa41c114 Mon Sep 17 00:00:00 2001 From: tkuzynow Date: Wed, 30 Aug 2023 11:57:54 +0200 Subject: [PATCH] fix: pass adviceseeker id to the booking event --- services/statisticsservice.yaml | 2 ++ .../statistics/event/BookingCreatedStatisticsEvent.java | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/services/statisticsservice.yaml b/services/statisticsservice.yaml index bf6c3d2..a72dd82 100644 --- a/services/statisticsservice.yaml +++ b/services/statisticsservice.yaml @@ -198,6 +198,8 @@ components: type: string bookingId: type: integer + adviceSeekerId: + type: string BookingRescheduledStatisticsEventMessage: type: object diff --git a/src/main/java/com/vi/appointmentservice/api/service/statistics/event/BookingCreatedStatisticsEvent.java b/src/main/java/com/vi/appointmentservice/api/service/statistics/event/BookingCreatedStatisticsEvent.java index 453baa2..162cae8 100644 --- a/src/main/java/com/vi/appointmentservice/api/service/statistics/event/BookingCreatedStatisticsEvent.java +++ b/src/main/java/com/vi/appointmentservice/api/service/statistics/event/BookingCreatedStatisticsEvent.java @@ -44,19 +44,21 @@ public EventType getEventType() { /** {@inheritDoc} */ @Override public Optional getPayload() { + var bookingCreatedStatisticsEventMessage = new BookingCreatedStatisticsEventMessage() .eventType(EVENT_TYPE) .userId(consultantId) - .userRole(com.vi.appointmentservice.statisticsservice.generated.web.model.UserRole.CONSULTANT) + .userRole( + com.vi.appointmentservice.statisticsservice.generated.web.model.UserRole.CONSULTANT) .timestamp(CustomOffsetDateTime.nowInUtc()) .type(payload.getType()) .title(payload.getTitle()) .startTime(toIsoTime(payload.getStartTime().toLocalDateTime())) .endTime(toIsoTime(payload.getEndTime().toLocalDateTime())) .uid(payload.getUid()) - .bookingId(payload.getBookingId() - ); + .bookingId(payload.getBookingId()) + .adviceSeekerId(payload.getMetadata().getUser()); try { return Optional.of(OBJECT_MAPPER.writeValueAsString(bookingCreatedStatisticsEventMessage));