Add in_transit mqtt event for new app #730

This commit is contained in:
Ramon Gutierrez 2023-05-12 15:05:21 +08:00
parent 63526d65f2
commit c32b7d68c7

View file

@ -389,7 +389,7 @@ class RiderAppController extends APIController
}
public function acceptJobOrder(Request $req, EntityManagerInterface $em)
public function acceptJobOrder(Request $req, EntityManagerInterface $em, MQTTClientApiv2 $mclientv2)
{
$required_params = ['jo_id'];
@ -412,6 +412,14 @@ class RiderAppController extends APIController
// set jo status to in transit
$jo->setStatus(JOStatus::IN_TRANSIT);
// NOTE: send new in transit event to new app
$payload = [
'event' => 'in_transit',
'jo_id' => $jo->getID(),
];
$mclientv2->sendEvent($jo, $payload);
// set delivery status
$jo->setDeliveryStatus(DeliveryStatus::RIDER_ACCEPT);