OUT-3523: restore account refs instead of clearing them when QB account is missing#212
Merged
SandipBajracharya merged 4 commits intomasterfrom Apr 3, 2026
Merged
OUT-3523: restore account refs instead of clearing them when QB account is missing#212SandipBajracharya merged 4 commits intomasterfrom
SandipBajracharya merged 4 commits intomasterfrom
Conversation
…account is missing
checkAndUpdateAccountStatus previously called removeAccountMapping which set
incomeAccountRef/expenseAccountRef/assetAccountRef to empty string in the DB
when a QB account was not found. Only the auth (re-auth) flow had fallback
logic to recreate these — webhook callers (product, invoice, payment, sync)
permanently lost the values, causing invoice sync failures.
Changes:
- [x] Move manage{Income,Expense,Asset}AccountRef from AuthService to TokenService
- [x] Replace removeAccountMapping with updateAccountMapping that persists the restored ref
- [x] Add restoreAccountRef dispatcher to find-or-create the correct QB account
- [x] checkAndUpdateAccountStatus now restores (not clears) when account is missing or accountId is empty
- [x] Remove redundant fallback checks in AuthService#handleAccountReferences
- [x] Verify clean TypeScript compilation (tsc --noEmit)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Make manage{Income,Expense,Asset}AccountRef private in TokenService
- Add optional chaining on .Id access for safe null/undefined handling
- Split comma-chained const declarations into separate statements
- Restore doc comments on manageAssetAccountRef
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
priosshrsth
requested changes
Apr 3, 2026
Rename methods to better reflect their find-or-create semantics and add consistent logging across all three account ref methods. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…fety - Type payload as QBPortalConnectionUpdateSchemaType for compile-time safety - Log error when updateAccountMapping matches no DB row - Add null guard after createAccount in all getOrCreate*AccountRef methods - Add explicit Promise<string> return type on checkAndUpdateAccountStatus - Log restored account ref ID after restoration for debugging - Fix "vaalue" typo in auth.service.ts Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
checkAndUpdateAccountStatus previously called removeAccountMapping which set
incomeAccountRef/expenseAccountRef/assetAccountRef to empty string in the DB
when a QB account was not found. Only the auth (re-auth) flow had fallback
logic to recreate these — webhook callers (product, invoice, payment, sync)
permanently lost the values, causing invoice sync failures.
Changes
Testing Criteria
https://www.loom.com/share/167e02950dfe4db09c1b17597f4d3131