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

feature: New rating framework #42

Merged
merged 7 commits into from
Jun 11, 2024

Conversation

TresorRw
Copy link
Collaborator

@TresorRw TresorRw commented May 3, 2024

What does this PR do?

This PR includes the implementation of the new rating framework which gives the admin abilities to manage rating categories and their fields.
This new rating framework gives more detailed reviews across the team.
Short demo at loom

Description of Task to be completed?

Allow the admin to set rating categories and their fields which helps in making reviews for the team
This added new controllers, and services for each of the modules (Rating category, Rating Field) and refined the Overall Review to help in implementing this new rating framework.

Requirements

  • Require dependencies installation
  • Require .env update
  • Require Database schema modification
  • Documentation updated

How should this be manually tested?

To test this new you need to log in as admin if you want to manage category and their fields because he is the one to manage them.

To manage rating categories

POST /api/v1/ratingCategories send this request with a name in the request body (It is required, it will return an error if it's not provided)

GET /api/v1/ratingCategories returns all registered categories with their corresponding fields it exists

GET /api/v1/ratingCategories/<category_id> returns rating category if it exists otherwise its error

PATCH /api/v1/ratingCategories/<category_id> updates a rating category name

DELETE /api/v1/ratingCategories/<category_id> deletes a rating category

To manage rating fields

POST /api/v1/ratingFields send this request with a name and categoryId in the request body (It is required, it will return an error if it's not provided)

GET /api/v1/ratingFields returns all registered rating fields

GET /api/v1/ratingFields/<rating_id> returns rating fields if it exists otherwise its error

DELETE /api/v1/ratingFields/<rating_id> deletes a rating field

Creating A Review

This is where the change comes in, a user must provide this request body but with the correct data

{
    "comment": "This is so good",
    "revieweeId": "7f622ae6-af96-43a4-a3b1-cde78ecd5723",
    "reviewCycleId": "5b773104-9b85-4898-a169-d5b15b805bf5",
    "fieldReviews": [
        {
            "ratingFieldId": "6b4fc76e-8c02-4571-8358-042a311015f9",
            "ratings": 2
        },
        {
            "ratingFieldId": "13c58daa-4908-45e9-b334-6f6314ffcd81",
            "ratings": 1
        }
    ]
}

Note: fieldReviews key must be an array, if you provide wrong data you will get validation messages to tell you what is going on

Any background context you want to provide?

None

What are the relevant pivotal tracker stories?

Story ID: 187364953

Screenshots (if appropriate)

Questions:

  • N/A

@TresorRw TresorRw added the WIP This feature is still in progress label May 3, 2024
@TresorRw TresorRw self-assigned this May 3, 2024
@TresorRw TresorRw force-pushed the ft-new-rating-framework-#187364953 branch 6 times, most recently from f9d9ea0 to 7037f44 Compare May 8, 2024 22:36
@TresorRw TresorRw force-pushed the ft-new-rating-framework-#187364953 branch from 7037f44 to 1b899f7 Compare May 28, 2024 18:23
@TresorRw TresorRw added documentation Improvements or additions to documentation and removed WIP This feature is still in progress labels May 29, 2024
@TresorRw TresorRw force-pushed the ft-new-rating-framework-#187364953 branch from 1b899f7 to c98bee9 Compare May 29, 2024 20:57
@TresorRw TresorRw added Ready to merge This PR have been approved and it is ready to be merged and removed documentation Improvements or additions to documentation labels May 29, 2024
@TresorRw TresorRw added the Awaits review Await review before merge label May 29, 2024
export default class RatingCategoryController {
static async createRatingCategory(req, res) {
try {
const results = v.safeParse(ratingCategorySchema, req.body);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TresorRw it could be better if we have some validation middleware which accept the schema and return the result instead of importing this "valibot" in every files.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @leandreAlly, Let me look into that

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @leandreAlly, Kindly review again and let me know

@TresorRw TresorRw added Requested changes Reviewers have requested changes in the code and removed Ready to merge This PR have been approved and it is ready to be merged labels Jun 5, 2024
@TresorRw TresorRw force-pushed the ft-new-rating-framework-#187364953 branch from c98bee9 to 9182f64 Compare June 5, 2024 22:09
@TresorRw TresorRw requested a review from leandreAlly June 5, 2024 22:11
@TresorRw TresorRw removed the Requested changes Reviewers have requested changes in the code label Jun 5, 2024
@TresorRw TresorRw added the Ready to merge This PR have been approved and it is ready to be merged label Jun 5, 2024
@dniwemugisha dniwemugisha merged commit 083bf4f into develop Jun 11, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaits review Await review before merge Ready to merge This PR have been approved and it is ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants