-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/inject tokenStore, get payload and put payload back to store #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements the validation workflow for knock requests by integrating the token store service. The implementation retrieves stored knock payloads, marks them as validated, and persists the updated state back to the token store.
- Injected
TokenStoreServicedependency into the route handler - Implemented token retrieval, validation marking, and persistence logic
- Updated response to return the validated payload instead of an empty object
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/routes/putKnockValidation.ts
Outdated
| const payload = await tokenStore.get(knockId); | ||
|
|
||
| if (!payload) { | ||
| throw new YHTTPError; |
Copilot
AI
Nov 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The YHTTPError constructor is called without any arguments. According to the pattern used in other routes (e.g., postCronRun.ts, putEcho.ts), YHTTPError should be instantiated with at least a status code and error code. For a missing token/payload, this should likely be a 404 error.
Example:
throw new YHTTPError(404, 'E_KNOCK_NOT_FOUND', knockId);| throw new YHTTPError; | |
| throw new YHTTPError(404, 'E_KNOCK_NOT_FOUND', knockId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a5e1b7a to
0de6bf2
Compare
0de6bf2 to
83bb980
Compare
83bb980 to
7209bec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request updates the
putKnockValidationroute to improve its logic and error handling by integrating theTokenStoreServiceand returning more informative responses. The main changes focus on fetching, updating, and persisting validation payloads, as well as handling missing tokens more gracefully.Enhancements to validation logic and error handling:
TokenStoreServiceinto the route handler and used it to fetch and update the token payload for a givenknockId. [1] [2]YHTTPErrorto throw an error if the token payload for the specifiedknockIdis not found. [1] [2]