feat(api): expose updated timestamp on card stub/brief shapes - #2197
Open
FrostyFitz wants to merge 3 commits into
Open
feat(api): expose updated timestamp on card stub/brief shapes#2197FrostyFitz wants to merge 3 commits into
FrostyFitz wants to merge 3 commits into
Conversation
Card stubs returned in nested set/series card lists (CardResume, via cardToCardSimple) and in the /cards listing endpoint (via toBrief) omit the 'updated' field that's already computed for full single-card fetches via getCardLastEdit(). Consumers who need incremental sync currently have to re-fetch every card individually, or the entire catalog, since there's no cheap way to tell which cards changed. This just plumbs the already-computed timestamp through to both brief shapes. No new data collection, no schema-breaking change (field is optional), no behavior change for full single-card responses.
…t declare it toBrief() maps an SDKCard (from the @tcgdex/sdk npm package) down to CardResume -- but that CardResume/Card pair is the SDK package's own bundled type declarations, not this repo's meta/definitions/api.d.ts (which cardToCardSimple() uses and where `updated` actually is now declared). The published @tcgdex/sdk@2.9.0 types don't have `updated` on either type, even though the live API returns it on full card fetches -- that's a separate, pre-existing gap in the SDK package itself, out of scope here. Keeps the actual fix (updated on the Set/Series-nested card stub shape via cardToCardSimple + CardResume in meta/definitions/api.d.ts) intact -- that path doesn't touch @tcgdex/sdk's types at all.
thomas-bassett
requested changes
Aug 27, 2026
thomas-bassett
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the PR. I want to push back on it just a little and maybe steer in a better direction. instead of increasing the response of the briefs and requiring more checks for users can expand the filtering behaviour instead. at the moment we have a Greater Than but that only supports numbers. we should expand the support to include datetime stamps aswell. this would allow a user to call https://api.tcgdex.net/v2/en/cards?updated=gte:2026-08-19T08:25:49+01:00 and get a list of all the cards that have been updated, without the need to go through every set.
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.
CardResume(the stub shape used for cards nested inside/sets/:idand
/series/:idresponses, and for the flat/cardslisting) doesn'tcarry an
updatedfield, even though it's already computed viagetCardLastEdit()for the full single-card shape.This makes incremental sync effectively impossible for API consumers —
there's no way to tell which cards changed without re-fetching every
card individually, or the entire catalog on every sync.
This PR just plumbs the already-computed value through:
cardToCardSimple()(used when compiling nested Set/Series cardlists) now includes
updated, same as its siblingcardToCardSingle()already does for full card fetches.
toBrief()(used for the/cardslisting endpoint) now includesupdated, since theSDKCardit derives from already carries thefield.
CardResumegains an optionalupdated?: stringfield.No new data collection, no breaking change (field is additive and
optional), no change to existing full single-card response shape.
Happy to adjust scope/direction if you'd rather this land differently.