Skip to content

fix(users): add fallback for missing createdAt in translateToUser - #694

Open
blink-claw-bot wants to merge 2 commits into
blinkbitcoin:mainfrom
blink-claw-bot:fix/audited-user-created-at-fallback
Open

fix(users): add fallback for missing createdAt in translateToUser#694
blink-claw-bot wants to merge 2 commits into
blinkbitcoin:mainfrom
blink-claw-bot:fix/audited-user-created-at-fallback

Conversation

@blink-claw-bot

Copy link
Copy Markdown
Collaborator

Summary

  • Adds || new Date(0) fallback in translateToUser for user records missing createdAt
  • Old pre-migration MongoDB documents may lack this field, causing a Cannot return null for non-nullable field AuditedUser.createdAt GraphQL error in the admin panel

This matches the existing fallback pattern already used on line 35 for missing records (translateToUser({ userId: id, createdAt: new Date() })).

Test plan

  • Verify admin panel accountDetailsByAccountId no longer errors for accounts with legacy user records missing createdAt
  • Confirm existing user lookups are unaffected (records with createdAt still use the stored value)

Closes blinkbitcoin/blink-wip#973

Old user records in MongoDB may lack a createdAt field. When the
record exists but the field is absent, translateToUser passes undefined
through, which causes a GraphQL NonNull violation on AuditedUser.createdAt
in the admin panel.

Fall back to epoch (Date(0)) to match the existing pattern used for
missing records on line 35.

Closes blinkbitcoin/blink-wip#973
@github-actions github-actions Bot added the core label Jul 19, 2026
@littledino2112
littledino2112 self-requested a review July 19, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant