fix: remove spatial data cache in MyLiveTrucksController and fix upcoming pickups logic
This commit is contained in:
@@ -21,11 +21,9 @@ class MyLiveTrucksController extends ApiController
|
||||
public function trucks(Request $request): JsonResponse
|
||||
{
|
||||
$userId = $request->user()->id;
|
||||
$household = \Illuminate\Support\Facades\Cache::remember("user:{$userId}:household", now()->addMinutes(10), function () use ($userId) {
|
||||
return Household::with('assignedDropOffPoint')
|
||||
->where('head_user_id', $userId)
|
||||
->first();
|
||||
});
|
||||
$household = Household::with('assignedDropOffPoint')
|
||||
->where('head_user_id', $userId)
|
||||
->first();
|
||||
|
||||
if (! $household || ! $household->assigned_drop_off_point_id) {
|
||||
return $this->ok([
|
||||
|
||||
@@ -106,6 +106,8 @@ class UpcomingPickupsController extends ApiController
|
||||
'drop_off_point' => $household->assignedDropOffPoint ? [
|
||||
'id' => $household->assignedDropOffPoint->uuid,
|
||||
'name' => $household->assignedDropOffPoint->name,
|
||||
'lat' => $household->assignedDropOffPoint->coordinates?->latitude,
|
||||
'lng' => $household->assignedDropOffPoint->coordinates?->longitude,
|
||||
] : null,
|
||||
'pickups' => $pickups,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user