Dynamic host rating bars API, sanitiseData, adjusted error responses and bug fixes#75
Merged
Prakhar896 merged 19 commits intomainfrom Jul 28, 2024
Merged
Dynamic host rating bars API, sanitiseData, adjusted error responses and bug fixes#75Prakhar896 merged 19 commits intomainfrom
Prakhar896 merged 19 commits intomainfrom
Conversation
Sync-up PR (Joshua)
… to checking for existence of date field instead
Prakhar896
requested changes
Jul 26, 2024
Prakhar896
requested changes
Jul 27, 2024
Prakhar896
reviewed
Jul 28, 2024
| return res.status(400).send("ERROR: One or more required payloads were not provided"); | ||
| } | ||
| try { | ||
| const user = await Guest.findByPk(userID) || await Host.findByPk(userID); |
Contributor
There was a problem hiding this comment.
Do take note that, in the future, you have to just do Guest.findByPk as we discussed that Hosts will just be solely hosts and unable to make reservations. @Sadliquid
Prakhar896
approved these changes
Jul 28, 2024
Contributor
Prakhar896
left a comment
There was a problem hiding this comment.
LGTM. Do note my comment about the reservations and also do note that you can avoid reduce indentation levels by omitting else for a if chain which has a return in it. @Sadliquid
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.
What was done in this PR
1.) Replaced
authmiddleware's code with the updated one which @Prakhar896 provided2.) Fixed bug where yup's date validation caused an invalid date
3.) Added API for caluclating the progress percentage which is used by the host's rating bars
4.) Shifted all aggregation and calculation logic to the backend to ease the load on frontend
5.) Added a little extra validation for adding a listing on backend
6.) Implemented sanitiseData
7.) Adjusted error responses, and standardised error types
8.) Added slight changes to accept
publishInstantly