Skip to content

fix: adds a function to get latest token by createdAt#1597

Merged
sandsinh merged 3 commits into
mainfrom
SITES-44250
May 13, 2026
Merged

fix: adds a function to get latest token by createdAt#1597
sandsinh merged 3 commits into
mainfrom
SITES-44250

Conversation

@sandsinh
Copy link
Copy Markdown
Contributor

@sandsinh sandsinh commented May 8, 2026

Summary

  • Adds findLastCreatedBySiteIdAndTokenType to TokenCollection to retrieve the most recently created token for a given site and token type, regardless of cycle
  • Useful when callers need the latest token across all cycles rather than a specific cycle
  • Validates required parameters and throws DataAccessError on missing input

Test plan

  • Unit tests pass: npm test -w packages/spacecat-shared-data-access
  • Integration tests pass: npm run test:it -w packages/spacecat-shared-data-access (requires Docker)
  • Verify findLastCreatedBySiteIdAndTokenType returns null when no tokens exist for a site/type
  • Verify it returns the most recently created token when multiple cycles exist
  • Verify it throws when siteId or tokenType is missing

🤖 Generated with Claude Code

tarunsinghdev
tarunsinghdev previously approved these changes May 12, 2026
# Conflicts:
#	packages/spacecat-shared-data-access/test/it/token/token.test.js
@github-actions
Copy link
Copy Markdown

This PR will trigger a patch release when merged.

@sandsinh sandsinh merged commit fb4d5f9 into main May 13, 2026
5 checks passed
@sandsinh sandsinh deleted the SITES-44250 branch May 13, 2026 09:30
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.

2 participants