cyntaria/UniPal-Backend

[GET] All Teacher Reviews

arafaysaleem opened this issue · 0 comments

Summary

As a student, I should be able to get all possible teacher reviews, so that I can understand a teacher's abilities.

Acceptance Criteria

GIVEN an student is requesting all possible teacher reviews in the app
WHEN the app hits the /teacher-reviews endpoint with a valid GET request
THEN the app should receive a status 200
AND in the response, the following information should be returned:

  • headers
  • list of teacher reviews

Sample Request/Sample Response

headers: {
    error: 0,
    message: "..."
}
body: [
    {
        review_id: 1,
  	learning: 3,
  	grading: 3,
  	attendance: 3,
  	difficulty: 1,
  	overall_rating: 3.5,
  	comment: "Won't recommend taking this course from this teacher",
  	reviewed_at: "2021-11-04 02:18:00",
  	subject_code: "MKT151",
  	teacher_id: 1,
  	reviewed_by_erp: 17855
    },
    {
        review_id: 2,
  	learning: 4,
  	grading: 4,
  	attendance: 5,
  	difficulty: 1,
  	overall_rating: 3.5,
  	comment: "Highly recommend taking this course from this teacher",
  	reviewed_at: "2021-11-04 02:18:00",
  	subject_code: "MKT151",
  	teacher_id: 2,
  	reviewed_by_erp: 17918
    },
    ....
]

Resources

  • Development URL: {Here goes a URL to the feature on development API}
  • Production URL: {Here goes a URL to the feature on production API}

Dev Notes

None.

Testing Notes

Scenario 1: GET request is successful

GIVEN an student is requesting all possible teacher reviews in the app
WHEN the app hits the /teacher-reviews endpoint with a valid GET request
THEN the app should receive a status 200
AND the body should be an array
AND the first item of the array should be an object containing the following fields:

  • review_id
  • learning
  • grading
  • attendance etc.
Scenario 2: GET request is unsuccessful due to no teacher reviews

GIVEN an student is requesting all possible teacher reviews in the app
WHEN the app hits the /teacher-reviews endpoint with a valid GET request
THEN the app should receive a status 404
AND the response headers' code parameter should contain "NotFoundException"

Scenario 3: GET request is incorrect due to no query parameters

GIVEN a student is requesting all possible reviews of a teacher in the app
WHEN the app hits the /teacher-reviews endpoint with a valid GET request
AND contains missing query parameters
THEN the app should receive a status 422
AND the response headers' code parameter should contain "InvalidPropertiesException"
AND the response headers' data parameter should contain the name of the invalid parameters

Scenario 4: GET request is incorrect due to unknown query parameters

GIVEN a student is requesting all possible reviews of a teacher in the app
WHEN the app hits the /teacher-reviews endpoint with a valid GET request
AND contains unknown query parameters
THEN the app should receive a status 422
AND the response headers' code parameter should contain "InvalidPropertiesException"
AND the response headers' data parameter should contain the name of the invalid parameters

Scenario 5: GET request is unauthorized

GIVEN an student is requesting all possible teacher reviews in the app
WHEN the app hits the /teacher-reviews endpoint with a valid GET request
AND the request contains no authorization token
THEN the app should receive a status 401
AND the response headers' code parameter should contain "TokenMissingException"