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

[POST] A New Activity #94

Closed
Tracked by #14
arafaysaleem opened this issue Sep 13, 2021 · 0 comments · Fixed by #101
Closed
Tracked by #14

[POST] A New Activity #94

arafaysaleem opened this issue Sep 13, 2021 · 0 comments · Fixed by #101
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 Sep 13, 2021

Summary

As a student, I should be able to create activities, so that I can invite other students to attend.

Acceptance Criteria

GIVEN an student is creating an activity in the app
WHEN the app hits the /activities endpoint with a valid POST request, containing:

  • location enum('on_campus','external')
  • privacy enum('public','private','limited')
  • frequency enum('daily','weekly','one_time','combo')
  • monday tinyint(1)
  • tuesday tinyint(1)
  • wednesday tinyint(1)
  • thursday tinyint(1)
  • friday tinyint(1)
  • saturday tinyint(1)
  • sunday tinyint(1)
  • month_number tinyint(2)
  • group_size smallint(5)
  • happens_at time
  • additional_directions varchar(100)
  • activity_type_id int(10),
  • activity_status_id int(10),
  • campus_spot_id int(10) (NULLABLE),
  • organizer_erp varchar(5),
  • created_at datetime

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

  • headers
  • activity id

Sample Request/Sample Response

headers: {
    error: 0,
    message: "..."
}
body: {
    "activity_id": "0",
    "affected_rows": 1
}

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

{Some complementary notes if necessary}

Testing Notes

Scenario 1: POST request is successful (Owner)

  1. Create a new activity entry with a POST request to /activities endpoint with organizer_erp == erp in student account token and ensure a 201 status code is returned.
  2. Use the id returned by the response in a subsequent GET request to /activities/:id endpoint and ensure a 200 status code is returned.
  3. Ensure the response contains an activity with the correct information i.e. matching the initially sent body.
  4. Clean up the database by sending a DELETE request to /activities/:id endpoint and ensure a 200 status code is returned.

Scenario 2: POST request is successful (Admin)

  1. Create a new activity entry with a POST request to /activities endpoint using an admin account token and ensure a 201 status code is returned.
  2. Use the id returned by the response in a subsequent GET request to /activities/:id endpoint and ensure a 200 status code is returned.
  3. Ensure the response contains an activity with the correct information i.e. matching the initially sent body.
  4. Clean up the database by sending a DELETE request to /activities/:id endpoint and ensure a 200 status code is returned.

Scenario 3: POST request is unsuccessful due to unknown activity_type_id

  1. Make a POST request to /activities endpoint containing a non-existent activity_type_id.
  2. Ensure a 512 status code is returned.
  3. And the response headers' code parameter should contain "ForeignKeyViolationException"
  4. And the response headers' message parameter should contain "activity_type_id"

Scenario 4: POST request is unsuccessful due to unknown activity_status_id

  1. Make a POST request to /activities endpoint containing a non-existent activity_status_id.
  2. Ensure a 512 status code is returned.
  3. And the response headers' code parameter should contain "ForeignKeyViolationException"
  4. And the response headers' message parameter should contain "activity_status_id"

Scenario 5: POST request is unsuccessful due to unknown campus_spot_id

  1. Make a POST request to /activities endpoint containing a non-existent campus_spot_id.
  2. Ensure a 512 status code is returned.
  3. And the response headers' code parameter should contain "ForeignKeyViolationException"
  4. And the response headers' message parameter should contain "campus_spot_id"

Scenario 6: POST request is unsuccessful due to unknown organizer_erp

  1. Make a POST request to /activities endpoint containing a non-existent organizer_erp.
  2. Ensure a 512 status code is returned.
  3. And the response headers' code parameter should contain "ForeignKeyViolationException"
  4. And the response headers' message parameter should contain "organizer_erp"

Scenario 7: POST request is incorrect

  1. Send a POST request to /activities endpoint with an incorrect key name in the body
  2. Ensure a 422 status code is returned
  3. And the response headers' code parameter should contain "InvalidPropertiesException"
  4. And the response headers' data parameter should contain the name of the invalid parameter

Scenario 8: POST request is forbidden

  1. Send a POST request to /activities endpoint with organizer_erp != erp in student account token.
  2. Ensure the response returns a 403 forbidden status code.
  3. And the response headers' code parameter should contain "ForbiddenException"

Scenario 9: POST request is unauthorized

  1. Send a POST request to /activities endpoint without an authorization token
  2. Ensure a 401 unauthorized status code is returned.
  3. And the response headers' code parameter should contain "TokenMissingException"
@arafaysaleem arafaysaleem added Priority: Critical Status: Pending Type: Feature user story A brief explanation of a functionality or an interaction with the system, from a user's perspective labels Sep 13, 2021
@arafaysaleem arafaysaleem mentioned this issue Sep 13, 2021
16 tasks
@arafaysaleem arafaysaleem mentioned this issue Sep 19, 2021
15 tasks
@arafaysaleem arafaysaleem linked a pull request Sep 19, 2021 that will close this issue
15 tasks
@arafaysaleem arafaysaleem self-assigned this Sep 30, 2021
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