Although the access code functionality is implemented, it is not yet fully complete. Some issues include:
The access code functionality is currently split across two separate routes: api/change-access-code/route.ts and api/validate-access-code/route.ts. We should refactor this into a single route, api/access-code/route.ts, where a POST request will handle access code validation, and a PATCH request will handle access code changes.
Currently, it’s possible to change the access code using an old code (not the current one). This behavior should be corrected to prevent that.
While the functionality is stable, no tests are in place yet.
Instructions
Pull the latest changes from the develop branch.
Start the server by running npm run dev (if necessary, navigate to the src/ folder and run npm ci first).
Refactor the access code routes by consolidating them into api/access-code/route.ts. Make sure to update the corresponding front-end code to reflect these changes.
Write comprehensive tests for api/access-code/route.ts. Ensure all possible cases from the original routes are covered and include detailed comments for clarity. Your code formatting will serve as a reference for other test suites.
Submit a pull request and tag @dangminhduc1101 for review.
Problem
Although the access code functionality is implemented, it is not yet fully complete. Some issues include:
api/access-code/route.ts
, where aPOST
request will handle access code validation, and aPATCH
request will handle access code changes.Instructions
develop
branch.npm run dev
(if necessary, navigate to thesrc/
folder and runnpm ci
first).