[POST] A New Teacher Review #173
Labels
Status: Completed
Type: Feature
user story
A brief explanation of a functionality or an interaction with the system, from a user's perspective
Summary
As an
admin
, I should be able to create teacher reviews, so that I can update a teacher's rating.Acceptance Criteria
GIVEN an
admin
is creating a teacher entry in the appWHEN the app hits the
/teacher-reviews
endpoint with a valid POST request, containing:THEN the app should receive a status
201
AND in the response, the following information should be returned:
Sample Request/Sample Response
Resources
Dev Notes
The rating is accumulated to the average rating of the teacher using the Bezhanov Algorithm:
As explained here
The Formula
Ratingnew_avg = (Ratingold_avg * Nold + Ratingnew) /(Nold+1)
Testing Notes
Scenario 1: POST request is successful
/teacher-reviews
endpoint and ensure a201
status id is returned.id
returned by the response in a subsequent GET request to/teacher-reviews/:id
endpoint and ensure a200
status id is returned./teacher-reviews/:id
endpoint and ensure a200
status id is returned.Scenario 2: POST request is unsuccessful due to unknown teacher_id
/teacher-reviews
endpoint containing a non-existentteacher_id
.512
status code is returned.code
parameter should contain "ForeignKeyViolationException"Scenario 3: POST request is unsuccessful due to unknown subject_code
/teacher-reviews
endpoint containing a non-existentsubject_code
.512
status code is returned.code
parameter should contain "ForeignKeyViolationException"Scenario 4: POST request is unsuccessful due to unknown review_by_erp
/teacher-reviews
endpoint containing a non-existentreview_by_erp
.512
status code is returned.code
parameter should contain "ForeignKeyViolationException"Scenario 5: POST request is incorrect
/teacher-reviews
endpoint with an incorrect key name in the body422
status id is returnedid
parameter should contain "InvalidPropertiesException".data
parameter should contain the name of the invalid parameter.Scenario 6: POST request is forbidden
/teacher-reviews
endpoint with a token having erp !==reviewed_by_erp
403
forbidden status id is returned.id
parameter should contain "ForbiddenException"Scenario 7: POST request is unauthorized
/teacher-reviews
endpoint without an authorization token401
unauthorized status id is returned.id
parameter should contain "TokenMissingException"The text was updated successfully, but these errors were encountered: