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

[GET] All Reactions Of A Post #144

Closed
Tracked by #18
arafaysaleem opened this issue Oct 16, 2021 · 0 comments · Fixed by #145
Closed
Tracked by #18

[GET] All Reactions Of A Post #144

arafaysaleem opened this issue Oct 16, 2021 · 0 comments · Fixed by #145
Assignees
Labels
Status: Completed Type: Feature user story A brief explanation of a functionality or an interaction with the system, from a user's perspective

Comments

@arafaysaleem
Copy link
Collaborator

arafaysaleem commented Oct 16, 2021

Summary

As a student, I should be able to get reactions of a post, so that I can see who feels what.

Acceptance Criteria

Scenario 1: Get All Reactions Of A Post

GIVEN an student is requesting reactions of a post in the app
WHEN the app hits the /posts/:id/reactions endpoint with a valid GET request, containing the path parameter:

  • :id, the unique id of the entity for which the reactions are needed.

THEN the app should receive a status 200
AND in the response, the following information should be returned:

  • headers
  • list of post reactions

Sample Request/Sample Response
For e.g. we are requesting all reactions of a post with post_id=1

headers: {
    error: 0,
    message: "..."
}
body: [
    {
      reaction_type_id: 1,
      post_id: 1
      student_erp: 17855,
      reacted_at: 09-09-2021 11:33:21,
    },
    {
      reaction_type_id: 2,
      post_id: 1
      student_erp: 17918,
      reacted_at: 09-09-2021 11:33:21,
    },
]

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

This endpoint is accessible by and serves the admin in the same way.

Testing Notes

Scenario 1: GET request is successful

GIVEN a student is requesting reactions of a post in the app
WHEN the app hits the /posts/:id/reactions endpoint with a valid GET request, containing the path parameter:

  • :id

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:

  • student_erp
  • post_id
  • reaction_type_id
  • reacted_at

AND the post_id of each item should be equal to the path parameter :id

Scenario 2: GET request is unsuccessful due to unknown post_id

GIVEN a student is requesting reactions of a post in the app
WHEN the app hits the /posts/:id/reactions endpoint with a valid GET request, containing the path parameter:

  • :id, a non-existent id

THEN the app should receive a status 404
AND the response headers' code parameter should contain "NotFoundException"
AND the response headers' message parameter should contain "Post not found"

Scenario 3: GET request is unsuccessful due to zero reactions

GIVEN a student is requesting reactions of a post in the app
AND no reactions of that post exist yet
WHEN the app hits the /posts/:id/reactions endpoint with a valid GET request, containing the path parameter:

  • :id

THEN the app should receive a status 404
AND the response headers' code parameter should contain "NotFoundException"
AND the response headers' message parameter should contain "Post reactions not found"

Scenario 4: GET request is unauthorized

GIVEN a student is requesting reactions of a post in the app
WHEN the app hits the /posts/:id/reactions 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"

@arafaysaleem arafaysaleem added Priority: High Status: Pending Type: Feature user story A brief explanation of a functionality or an interaction with the system, from a user's perspective labels Oct 16, 2021
@arafaysaleem arafaysaleem mentioned this issue Oct 16, 2021
13 tasks
@arafaysaleem arafaysaleem self-assigned this Oct 19, 2021
@arafaysaleem arafaysaleem mentioned this issue Oct 20, 2021
27 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Completed Type: Feature user story A brief explanation of a functionality or an interaction with the system, from a user's perspective
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant