created a proper get request and added queries #31
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.
What was the ticket?
Link to Ticket:
in issue 10 i was told to retrieve quiz details for a specific submodule, so i had to create
GET endpoint that accepts a submodule ID in the request parameters and responds with submodule quiz details if the ID exists.
What did I do?
I created an exam.ts file which creates a GET endpoint that hs handler function in this file checks if the request is the proper endpoint. If it is not, it responds with an error showing wrong request method. otherwise the getSubModuleQuiz function is run this function extracts the ID from the query parameters and queries the database for the exam based on the ID.If the provided ID is not an integer, a 403 Response will be sent to the client with a message requesting them to provide an integer value.If the query is empty, a 404 Response will be sent, accompanied by a message indicating that the Module Exam was not found.In the event of a successful query that returns information, the retrieved information will be included in the HTTP Response.
How did I test it? Document test cases here.
I self tested with the images shown below :
What could go wrong in the future? What parts of your code should the reviewer pay the most attention to?
The main issue that could go wrong is if there is a decimal it will jsut be brought to the number before the decimal... and the id is not a string return it is a number return
Additional comments for the reviewers
Screenshots