Fix/auth tests logout decimal transformer - #281
Merged
martinzhames merged 4 commits intoSep 1, 2026
Merged
Conversation
…hService AuthService.logout()/isBlacklisted() existed but were unreachable from the API surface, so merchants had no way to invalidate a JWT before its natural expiry. Adds a JwtAuthGuard-protected logout endpoint that pulls jti/exp from the validated request and calls authService.logout(), and makes JwtStrategy.validate() delegate its blacklist check to authService.isBlacklisted() instead of re-implementing the cache-key lookup inline. jwt.strategy.spec.ts updated to match.
Postgres numeric/decimal columns are returned as strings by node-postgres/TypeORM by default, but every @column({ type: 'decimal' }) field across Payment, Settlement, and Merchant entities was typed as `number` with no transformer, so the TS type didn't match the runtime value. Adds src/database/numeric-column.transformer.ts and applies it to amountUsd/amountXlm/amountUsdc/feeUsd/settlementAmountFiat/refundAmountUsd (payment), totalAmountUsd/feeAmountUsd/netAmountUsd/fiatAmount (settlement), and totalVolumeUsd/feeRate (merchant) so these fields are actual numbers at runtime, matching their declared type.
register/login were the only two controllers in the codebase (besides now logout) without a spec file, leaving HTTP status codes, DTO pass-through, and 409/401 error propagation for the auth entrypoints untested. Adds src/auth/auth.controller.spec.ts with a mocked AuthService covering register/login/logout pass-through and error propagation.
…ey lookup AuthService implements password hashing, JWT issuance, session blacklisting, and the bcrypt-scan findMerchantByApiKey() lookup with zero direct unit coverage. Adds src/auth/auth.service.spec.ts covering register happy path + duplicate-email conflict, login happy path + missing-merchant + wrong-password rejection, logout/isBlacklisted cache behavior, and findMerchantByApiKey matching/non-matching cases.
|
@levi0005 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Closes #171
Closes #170
Closes #144
Closes #165