Fix: Add driverAssigned eager loading to public API OrderController#201
Closed
PremSharma-Intelegencia wants to merge 1 commit intofleetbase:mainfrom
Closed
Conversation
The refactor in commit 9dd0d8b changed OrderResource to use relationLoaded() checks for driver_assigned, but only added eager loading to OrderFilter (internal) and LiveController. The public API OrderController was not updated, causing driver_assigned to always return null in API responses. This fix adds the missing eager loading to match the pattern already in place for internal requests. Fixes: Navigator app not seeing assigned drivers on adhoc orders
Member
|
Patched in #202 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The refactor introduced in commit 9dd0d8b updated
OrderResourceto rely onrelationLoaded()checks for thedriver_assignedrelationship. However, eager loading for this relation was only added to internal controllers (OrderFilterandLiveController) and was missed in the public APIOrderController.As a result,
driver_assignedwas always returned asnullin public API responses, even when a driver was assigned.This PR adds the missing eager loading to the public API controller to align it with the existing internal request pattern.
Issue Fixed
Changes
driverAssignedeager loading to:query()methodfind()methodsetDestination()method vialoadMissingdriver_assignedis correctly populated in public API responsesFiles Changed
server/src/Http/Controllers/Api/v1/OrderController.php🧠 Notes
This change maintains consistency with the eager loading strategy already used for internal requests and prevents unintended
nullvalues caused byrelationLoaded()checks inOrderResource.