Skip to content

Fix/auth tests logout decimal transformer - #281

Merged
martinzhames merged 4 commits into
dupdab:mainfrom
levi0005:fix/auth-tests-logout-decimal-transformer
Sep 1, 2026
Merged

Fix/auth tests logout decimal transformer#281
martinzhames merged 4 commits into
dupdab:mainfrom
levi0005:fix/auth-tests-logout-decimal-transformer

Conversation

@levi0005

Copy link
Copy Markdown

Closes #171
Closes #170
Closes #144
Closes #165

…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.
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@martinzhames
martinzhames merged commit 269023e into dupdab:main Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants