Change unfulfilled subscriptions endpoint to retrieve vehicle data and not just a count #799
This commit is contained in:
parent
f554658c7f
commit
d1104b7416
1 changed files with 5 additions and 3 deletions
|
|
@ -291,8 +291,10 @@ class SubscriptionController extends ApiController
|
||||||
|
|
||||||
// NOTE: this functions like an outer join as far as DQL is concerned
|
// NOTE: this functions like an outer join as far as DQL is concerned
|
||||||
// get all customer vehicles for the current customer that do not have a JO
|
// get all customer vehicles for the current customer that do not have a JO
|
||||||
$sql = 'SELECT COUNT(cv.id) AS count
|
$sql = 'SELECT cv.id, cv.name, cv.model_year, cv.plate_number, v.id AS make_id, v.make AS make, vm.name AS manufacturer
|
||||||
FROM App\Entity\CustomerVehicle cv
|
FROM App\Entity\CustomerVehicle cv
|
||||||
|
JOIN App\Entity\Vehicle v WITH cv.vehicle = v
|
||||||
|
JOIN App\Entity\VehicleManufacturer vm WITH v.manufacturer = vm
|
||||||
JOIN App\Entity\Subscription s WITH s.customer_vehicle = cv AND s.status = :status
|
JOIN App\Entity\Subscription s WITH s.customer_vehicle = cv AND s.status = :status
|
||||||
LEFT JOIN App\Entity\JobOrder jo WITH jo.subscription = s
|
LEFT JOIN App\Entity\JobOrder jo WITH jo.subscription = s
|
||||||
WHERE jo.id IS NULL
|
WHERE jo.id IS NULL
|
||||||
|
|
@ -304,11 +306,11 @@ class SubscriptionController extends ApiController
|
||||||
'customer' => $cust,
|
'customer' => $cust,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$count = $query->getSingleScalarResult();
|
$vehicles = $query->getResult();
|
||||||
|
|
||||||
// response
|
// response
|
||||||
return new ApiResponse(true, '', [
|
return new ApiResponse(true, '', [
|
||||||
'count' => $count,
|
'vehicles' => $vehicles,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue