fix: resolve multiple bugs in backend NestJS code#198
Open
Godzilaa wants to merge 1 commit into
Open
Conversation
- Fix TypeORM config: remove MySQL-specific charset on PostgreSQL connection - Fix auth controller: login endpoints now return HTTP 200 instead of 201 - Fix JWT service: return null on verify failure instead of silent catch - Fix auth service: correct instructorRepository variable name typo - Fix Kaleido wallet URL: add missing slash between base URL and path
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
Fixes #199
Fixed 5 bugs found in the
src/learning-token-backend/NestJS backend:TypeORM charset mismatch (
typeorm.config.ts) — Removedcharset: 'utf8mb4_unicode_ci'which is MySQL-specific but the database is PostgreSQL.Login endpoints return 201 instead of 200 (
auth.controller.ts) — All 5 login/refresh-token endpoints returnedHttpStatus.CREATED(201), which is incorrect for a login operation. Changed toHttpStatus.OK(200). The TODO comment on line 72 confirmed this was known but unfixed.JWT verify silently swallows errors (
jwt.service.ts) — Emptycatch (err) {}block on JWT verification suppressed all errors (expired tokens, invalid signatures, etc.). Now returnsnullon failure so callers can handle auth failures properly.insturctorRepositorytypo (auth.service.ts) — Variable name misspelled asinsturctorRepository(missing 'c' after 'stru'). Fixed all 3 occurrences.Missing slash in Kaleido wallet URL (
kaledio.ts) — URL concatenation missing a leading/beforeapi/v1/..., which would produce a malformed URL likehttps://hostapi/v1/...if the env var has no trailing slash.