Skip to content
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

Refactor reviews endpoints for correct data flow #1021

Merged
merged 25 commits into from
Dec 4, 2024

Conversation

luiqor
Copy link
Contributor

@luiqor luiqor commented Dec 1, 2024

Fix GET /reviews/ to support fetching reviews by targetUserId.

  • Remove nesting gloabal '/reviews' route to '/user' route
  • Add user parameter to query as one of filtering query parameters ( query example: ../reviews?role=tutor&user=673615d36b214652201af558 )

Correct the logic to ensure only a single proficiencyLevel value is returned from cooperation instead of array from offer.

The review design incorporates a profiency level from cooperation, rather than including an array of all levels from the offer. However, review should have reference to Offer to be able to redirect interested person to offer instead of certain cooperation.

image

Before:

image

After:

findByUser

Correct recalculation of user review stats to be automatic on POST /reviews/, PATCH, DELETE.

  • Add automatic recalculation of stats on POST /reviews/, PATCH, DELETE.
  • Remove the unnecessary /reviews/stats endpoint (as stats will be recalculated automatically on POST /reviews/, PATCH, DELETE)
stat-recalculation-on-edit.mp4

Add validation schemas

  • POST
  • PATCH

Update review docs

  • Update responses examples
  • Update error responses
  • Update examples

@luiqor luiqor self-assigned this Dec 1, 2024
@luiqor luiqor linked an issue Dec 1, 2024 that may be closed by this pull request
4 tasks
@luiqor luiqor added the Backend label Dec 1, 2024
@luiqor luiqor marked this pull request as ready for review December 1, 2024 11:05
src/services/cooperation.js Outdated Show resolved Hide resolved
@luiqor luiqor force-pushed the bugfix/1020/refactor-reviews-endpoint-data-flow branch from e845177 to ce99c4b Compare December 4, 2024 14:20
@luiqor luiqor merged commit c5c9b97 into develop Dec 4, 2024
4 checks passed
@luiqor luiqor deleted the bugfix/1020/refactor-reviews-endpoint-data-flow branch December 4, 2024 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(SP: 3) Refactor reviews endpoints for correct data handling and flow
4 participants