Skip to content

feat(api): expose updated timestamp on card stub/brief shapes - #2197

Open
FrostyFitz wants to merge 3 commits into
tcgdex:masterfrom
FrostyFitz:feat/card-stub-updated-timestamp
Open

feat(api): expose updated timestamp on card stub/brief shapes#2197
FrostyFitz wants to merge 3 commits into
tcgdex:masterfrom
FrostyFitz:feat/card-stub-updated-timestamp

Conversation

@FrostyFitz

@FrostyFitz FrostyFitz commented Aug 17, 2026

Copy link
Copy Markdown

CardResume (the stub shape used for cards nested inside /sets/:id
and /series/:id responses, and for the flat /cards listing) doesn't
carry an updated field, even though it's already computed via
getCardLastEdit() 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 card
    lists) now includes updated, same as its sibling cardToCardSingle()
    already does for full card fetches.
  • toBrief() (used for the /cards listing endpoint) now includes
    updated, since the SDKCard it derives from already carries the
    field.
  • CardResume gains an optional updated?: string field.
    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.

FrostyFitz and others added 3 commits August 17, 2026 14:08
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 thomas-bassett left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants