From 595075db383c36fe7b3bab5712dfa6cb3426f8ec Mon Sep 17 00:00:00 2001 From: rupakkorde Date: Fri, 15 Nov 2024 14:22:50 +0530 Subject: [PATCH] lts/enh/added-rideid-and-driverid-in-StopDetectionReq --- .../src/domain/action/ui/location.rs | 4 +++- crates/location_tracking_service/src/outbound/external.rs | 4 ++++ crates/location_tracking_service/src/outbound/types.rs | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/location_tracking_service/src/domain/action/ui/location.rs b/crates/location_tracking_service/src/domain/action/ui/location.rs index fbe0ce1..f561088 100644 --- a/crates/location_tracking_service/src/domain/action/ui/location.rs +++ b/crates/location_tracking_service/src/domain/action/ui/location.rs @@ -452,10 +452,12 @@ async fn process_driver_locations( // } // } // } - if let Some(location) = stop_detected.as_ref() { + if let (Some(location), Some(ride_id)) = (stop_detected.as_ref(), driver_ride_id.as_ref()) { let _ = trigger_stop_detection_event( &data.stop_detection.stop_detection_update_callback_url, location, + ride_id.to_owned(), + driver_id.to_owned(), ) .await; } diff --git a/crates/location_tracking_service/src/outbound/external.rs b/crates/location_tracking_service/src/outbound/external.rs index df05a91..7f04915 100644 --- a/crates/location_tracking_service/src/outbound/external.rs +++ b/crates/location_tracking_service/src/outbound/external.rs @@ -109,6 +109,8 @@ pub async fn trigger_fcm_dobpp( pub async fn trigger_stop_detection_event( stop_detection_callback_url: &Url, location: &Point, + ride_id: RideId, + driver_id: DriverId, ) -> Result { call_api::( Protocol::Http1, @@ -117,6 +119,8 @@ pub async fn trigger_stop_detection_event( vec![("content-type", "application/json")], Some(StopDetectionReq { location: location.to_owned(), + ride_id, + driver_id, }), ) .await diff --git a/crates/location_tracking_service/src/outbound/types.rs b/crates/location_tracking_service/src/outbound/types.rs index 00073f6..ac8d746 100644 --- a/crates/location_tracking_service/src/outbound/types.rs +++ b/crates/location_tracking_service/src/outbound/types.rs @@ -42,6 +42,8 @@ pub struct TriggerFcmReq { #[serde(rename_all = "camelCase")] pub struct StopDetectionReq { pub location: Point, + pub ride_id: RideId, + pub driver_id: DriverId, } // Live activity notification trigger for IOS