Add first-class Trailer data models - #75
Open
roncodes wants to merge 3 commits into
Open
Conversation
This was referenced Sep 3, 2026
- Declare attachment_state and vehicle_id on the Trailer model; the console never received the attachment state because the attribute was missing. - Add displayName, isAttached, isOnline, and formatted last-online/attached-at projections to Trailer, and formatted timing plus duration to AssetConnection. - Add the attachable-driver model so equipment issued to a driver normalizes instead of failing on an unknown model. - Set explicit inverses on the vehicle trailer/equipment relationships and embed the trailer category. - Cover query and single-record envelope normalization, the new projections, and the driver mapping.
The live map feed now sends each vehicle's currently coupled trailers alongside its devices so map popovers can list both. Declare the relationship as embedded so normalization pushes the trailer records instead of treating the objects as ids, and cover it with a normalizeResponse test.
Open
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
Trailer data contracts for the Fleet-Ops console, completing the first-class Trailer feature (fleetbase/fleetops#309).
trailermodel: first-class towed asset extendingasset, with towing (current_vehicle,current_connection,connections), capacity, running-gear, reefer, ownership and telemetry attributes. Declaresattachment_stateandvehicle_id(previously missing, so the console never saw the attachment state) and derivesdisplayName,isAttached,isOnline,lastOnlineAt,lastOnlineAgoandattachedAt.asset-connectionmodel: effective-dated towing connection withisActive, formattedconnectedAt/disconnectedAtand a humanduration.attachable-trailer,attachable-driverandmaintenance-subject-trailerpolymorphic models.attachable-driverwas missing, so equipment issued to a driver failed to normalize once the equipment serializer started embeddingequipable.trailerembeds category, vendor, warranty, photo, custom field values and the read-only towing/device/equipment projections;asset-connectionembeds vehicle and trailer;deviceandequipmentresolvefleet-ops:trailer/fleet-ops:driverpolymorphic types.vehiclegainstrailers,trailer_connectionsandequipmentsrelationships with explicit inverses.Contract
The console API answers
{ "trailers": [...], "meta": {...} }for collections and{ "trailer": {...} }for records; embedded relationships are always present (empty arrays when not loaded). Tests cover both envelopes, the empty collection, embedded towing state, the derived projections and the polymorphic driver mapping.Live map popover
The live vehicles feed now embeds each vehicle's currently coupled trailers next to its devices, so the vehicle serializer declares
trailersas an embedded relationship. AnormalizeResponsetest covers the embedded trailers and devices.Validation
eslinton the changed files passes.ember testin this workspace launches Chrome through testem and was stopped at the user's request; CI is the authoritative run.Related PRs