ownedvehicles graphql endpoint and custom address type - #1
Merged
Merged
Conversation
PRO-1631 Owned vehicles API
Let's look at a vehicle mint: and try to display that information in a GraphQL API. The table:
I want to serve this from a GraphQL API like |
elffjs
requested changes
Jun 28, 2023
elffjs
requested changes
Jul 5, 2023
|
|
||
| func (v *VehiclesCtrl) GetOwnedVehicles(addr common.Address) ([]*gmodel.Vehicle, error) { | ||
| mv, err := models.MintedVehicles( | ||
| models.MintedVehicleWhere.OwnerAddress.EQ(null.BytesFrom(addr.Bytes())), |
Member
There was a problem hiding this comment.
I'd have to see the table, but: it would be nice if the owner always had to be present, and then we wouldn't need to bother with null. It's difficult to have vehicles without owners.
elffjs
reviewed
Jul 5, 2023
elffjs
reviewed
Jul 5, 2023
Member
|
I see a request for a review, but no recent commits. |
Contributor
Author
Apologies, fixed |
Member
|
What do you think of this? |
Member
|
I'm just going to merge this and we'll explore it later. |
Merged
zer0stars
added a commit
that referenced
this pull request
Sep 15, 2026
The only source was <base>/manifest.json, a route definitions-worker #1 deletes without a replacement. Its cutover deploys the worker before identity, and worker deploys are manual, so the ordering is an operator's to get right: once the new worker is out, warm pods take the stale-serve path every minute and freeze on a snapshot that no template edit can reach, and the first pod restarted afterwards fails every device-definition query. Nothing here guarded against that or migrated away from it. Ask <base>/idx/current.json first, conditionally. 200: the deployment publishes template builds. A build id equal to the one held means nothing to do -- shards are immutable -- so an unchanged catalog costs one small conditional GET a minute instead of a 7.7 MB download. A new build is fetched shard by shard, eight at a time, and each Template is flattened the way device-definitions-api flattens it (template-level attributes only, sorted by name, strconv-rendered, manufacturer from the template, no ksuid), so both services describe a template identically. A build is vetted whole: a half-empty shard is a catalog that lost definitions, not a shard to serve around. Shard keys are matched against idx/<build>/shard-<n>.json before they are fetched, because the index is data from the network and must not name a URL of the producer's choosing. 304: unchanged. 404: no index deployed, so the flat manifest is read exactly as before. Anything else: a refresh failure. A 5xx must never be read as "this deployment has no index" and flip a pod to the other source. A listing in template mode only changes when a build is published, so a definition created since then is missing from the snapshot. A by-id miss falls back to <base>/t/<id>.json, which the worker writes when the definition is created: found is cached (1024 entries, cleared when a build is adopted), missing is remembered for five minutes (4096 entries), one fetch per id serves every concurrent caller, and the fetch outlives the caller that started it. Any other status is a wrapped error. DefinitionsByManufacturer stays snapshot-only and says so: a listing is a page of results, and fetching it from the origin would put the catalog back in the request path. ToAPI now leaves legacyId null when the ksuid is empty. Templates have none, the schema field is nullable, and &"" answers with a legacy id that resolves to nothing. The devicedefinition fixture called require.Equal inside its httptest handler, which runs on a server goroutine: a path it did not expect would call runtime.Goexit there, kill the connection without writing a response, and surface on the test goroutine as an unexplained EOF. It now routes by path (404 for the index so these tests exercise the legacy manifest), records anything unexpected, and asserts on that from the test goroutine.
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.
No description provided.