Migrate session.controller to TypeScript#4105
Open
dvynshuu wants to merge 1 commit intoprocessing:developfrom
Open
Migrate session.controller to TypeScript#4105dvynshuu wants to merge 1 commit intoprocessing:developfrom
dvynshuu wants to merge 1 commit intoprocessing:developfrom
Conversation
|
🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already. |
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.
Issue:
Part of the 2025 pr05 Grant: Incremental Typescript Migration of the p5.js Web Editor
This PR incrementally migrates the backend session.controller.js file to TypeScript (session.controller.ts) and adds full unit test coverage according to the established TS migration guidelines.
Demo:
N/A - Backend / TypeScript migration only.
Changes:
Renamed server/controllers/session.controller.js to server/controllers/session.controller.ts.
Added Types: Typed the Express middleware methods (createSession, getSession, destroySession) using RequestHandler and Express.User.
Added JSDoc Comments: Included comprehensive JSDocs specifying methods, endpoints, and descriptions for all controller methods.
Added Unit Tests: Created server/controllers/tests/session.controller.test.ts with 10 unit tests covering all success/failure paths, utilizing jest-express for mocking the request/response context.
Fixed minor linting (shadowing) warnings that appeared after conversion.
I have verified that this pull request: