feat: filter vehicles by synthetic device connection - #187
Merged
Merged
Conversation
Add a `connection` field to `VehiclesFilter` (keyed by connection address) so callers can list all vehicles paired with a synthetic device under a given connection. A vehicle links to a connection through its synthetic device, so this joins vehicles -> synthetic_devices -> connections and filters on the connection address. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Adds a
connectionfield toVehiclesFilterso callers can list all vehicles paired with a synthetic device that belongs to a given connection, keyed by the connection's address:{ vehicles(first: 100, filterBy: { connection: "0x1111...1111" }) { totalCount nodes { tokenId owner syntheticDevice { tokenId } } } }Because it's a filter on the existing
vehiclesquery, it composes with the other filters for free — e.g.filterBy: { connection: "0x...", make: "Toyota", owner: "0x..." }.How
A vehicle links to a connection only through its synthetic device, and
synthetic_devices.connection_idis a FK toconnections.id(the 32-byte padded name), not the address. So when the filter is set,queryModsFromFiltersjoinsvehicles → synthetic_devices → connectionsand filters onconnections.address. No migration required.Tests
Added connection + synthetic-device fixtures to the vehicle filter suite and three cases: connection alone, connection + owner, and a no-results combo. Full
internal/repositories/vehiclepackage suite passes.Notes / open questions
connectionon the filter.syntheticDeviceConnectionwould be more self-documenting but verbose — happy to rename.@mcpExampledemonstrating the connection filter on thevehiclesquery. Can add one if we want the MCP tool to advertise it.🤖 Generated with Claude Code