This pull request introduces a validation step in the "get books by author" endpoint to ensure that the author name provided in the request is valid before querying the database. This change aims to improve the robustness of the endpoint by preventing invalid queries and ensuring that the input adheres to the expected format.
Summary
Added input validation for the authorName parameter in the get books by author endpoint within the routes/book.routes.js file.
Implemented a new validation case for authorName in the utils/validateInput.js utility file to check that the author name contains only letters and spaces.
Modified the response status code for invalid author names from 404 to 400 to more accurately reflect the nature of the error (bad request due to invalid input).
Refactored the endpoint to validate the authorName before attempting to query the database, improving efficiency and error handling.
Fixes #144.
🎉 Latest improvements to Sweep:
New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
PR Feedback (click)
Description
This pull request introduces a validation step in the "get books by author" endpoint to ensure that the author name provided in the request is valid before querying the database. This change aims to improve the robustness of the endpoint by preventing invalid queries and ensuring that the input adheres to the expected format.
Summary
authorName
parameter in theget books by author
endpoint within theroutes/book.routes.js
file.authorName
in theutils/validateInput.js
utility file to check that the author name contains only letters and spaces.404
to400
to more accurately reflect the nature of the error (bad request due to invalid input).authorName
before attempting to query the database, improving efficiency and error handling.Fixes #144.
🎉 Latest improvements to Sweep:
💡 To get Sweep to edit this pull request, you can:
This is an automated message generated by Sweep AI.