Skip to content

fix: resolve multiple bugs in backend NestJS code#198

Open
Godzilaa wants to merge 1 commit into
hyperledger-labs:mainfrom
Godzilaa:fix/backend-bugs
Open

fix: resolve multiple bugs in backend NestJS code#198
Godzilaa wants to merge 1 commit into
hyperledger-labs:mainfrom
Godzilaa:fix/backend-bugs

Conversation

@Godzilaa

@Godzilaa Godzilaa commented May 21, 2026

Copy link
Copy Markdown

Summary

Fixes #199

Fixed 5 bugs found in the src/learning-token-backend/ NestJS backend:

  1. TypeORM charset mismatch (typeorm.config.ts) — Removed charset: 'utf8mb4_unicode_ci' which is MySQL-specific but the database is PostgreSQL.

  2. Login endpoints return 201 instead of 200 (auth.controller.ts) — All 5 login/refresh-token endpoints returned HttpStatus.CREATED (201), which is incorrect for a login operation. Changed to HttpStatus.OK (200). The TODO comment on line 72 confirmed this was known but unfixed.

  3. JWT verify silently swallows errors (jwt.service.ts) — Empty catch (err) {} block on JWT verification suppressed all errors (expired tokens, invalid signatures, etc.). Now returns null on failure so callers can handle auth failures properly.

  4. insturctorRepository typo (auth.service.ts) — Variable name misspelled as insturctorRepository (missing 'c' after 'stru'). Fixed all 3 occurrences.

  5. Missing slash in Kaleido wallet URL (kaledio.ts) — URL concatenation missing a leading / before api/v1/..., which would produce a malformed URL like https://hostapi/v1/... if the env var has no trailing slash.

- 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
@Godzilaa
Godzilaa requested a review from a team as a code owner May 21, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: multiple bugs in backend NestJS code

1 participant