Add a reviews field to User model. A list of PerformanceReview
PerformanceReview model should contain the following fields:
author (required) - The user who asks for a performance review
admins (required) - A list of ADMIN users that can reply to the review
description (required) - The user's explanation regarding why their performance should be reviewed
PerformanceReview controller should include the following methods:
create (Regular users only)
update (Only the user that created the review)
delete (Only the user that created the review)
list (ADMIN can only list reviews which he belongs to the admins list. Regular users can only list reviews created by themselves)
show (ADMIN can only view reviews which he belongs to the admins list. Regular users can only view reviews created by themselves)
reply (ADMIN can only reply to reviews which he belongs to the admins list. Regular users can only reply to reviews created by themselves)
Suggested tests:
- Create review using an
ADMIN user (should return 401 - Unauthorized)
- Create review using a user from any other level (should return 201 - Created)
- Update review using the user that created it (should return 200 - OK)
- Update review using a user that hasn't created it (should return 401 - Unauthorized)
- Delete review using the user that created it (should return 200 - OK)
- Delete review using a user that hasn't created it (should return 401 - Unauthorized)
- List all reviews using an
ADMIN user (should return 200 - OK, displaying only the reviews that has this ADMIN on the admins list)
- List all reviews using a user from any other level (should return 200 - OK, displaying only the reviews created by them)
- View a review using the user that created it (should return 200 - OK)
- View a review using a regular user that hasn't created it (should return 401 - Unauthorized)
- View a review using an
ADMIN user that is not on the admins list of the review (should return 401 - Unauthorized)
- View a review using an
ADMIN user that is on the admins list of the review (should return 200 - OK)
- Create/Update review without required fields
Add a
reviewsfield toUsermodel. A list ofPerformanceReviewPerformanceReviewmodel should contain the following fields:author(required) - The user who asks for a performance reviewadmins(required) - A list ofADMINusers that can reply to the reviewdescription(required) - The user's explanation regarding why their performance should be reviewedPerformanceReviewcontroller should include the following methods:create(Regular users only)update(Only the user that created the review)delete(Only the user that created the review)list(ADMINcan only list reviews which he belongs to the admins list. Regular users can only list reviews created by themselves)show(ADMINcan only view reviews which he belongs to the admins list. Regular users can only view reviews created by themselves)reply(ADMINcan only reply to reviews which he belongs to the admins list. Regular users can only reply to reviews created by themselves)Suggested tests:
ADMINuser (should return 401 - Unauthorized)ADMINuser (should return 200 - OK, displaying only the reviews that has thisADMINon theadminslist)ADMINuser that is not on theadminslist of the review (should return 401 - Unauthorized)ADMINuser that is on theadminslist of the review (should return 200 - OK)