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] A Student's Organized Activities #105

Closed
Tracked by #9
arafaysaleem opened this issue Sep 24, 2021 · 0 comments · Fixed by #110
Closed
Tracked by #9

[GET] A Student's Organized Activities #105

arafaysaleem opened this issue Sep 24, 2021 · 0 comments · Fixed by #110
Assignees
Labels
Status: Completed Type: Enhancement 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 24, 2021

Summary

As a student, I should be able to get a student's activities, so that I can view the their or my organized activities.

Acceptance Criteria

Scenario 1: Get All Organized Activities

GIVEN a student is requesting a student's organized activities in the app
WHEN the app hits the /students/:erp/organized-activities endpoint with a valid GET request, containing the path parameter:

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

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

  • headers
  • list of the student's organized activities

Sample Request/Sample Response
For e.g. we are requesting activities organized by a student with erp=17855

headers: {
    error: 0,
    message: "..."
}
body: [
    {
        activity_id: 0,
        location: "on_campus",
        privacy: "public"
        frequency: "daily"
        monday: 1
        tuesday: 1,
        wednesday: 1,
        thursday: 1,
        friday: 1,
        saturday: 1,
        sunday: 1,
        month_number: 9,
        group_size: 1,
        happens_at: 04:30
        additional_directions: "Near the stairs",
        activity_type_id: 1,
        activity_status_id: 2,
        campus_spot_id: 1,
        organizer_erp: 17855,
        created_at: 09-09-2021 11:33:21
    },
    {
        activity_id: 4,
        location: "external",
        privacy: "private"
        frequency: "combo"
        monday: 1
        tuesday: 0,
        wednesday: 1,
        thursday: 0,
        friday: 0,
        saturday: 0,
        sunday: 0,
        month_number: 9,
        group_size: 5,
        happens_at: 04:30
        additional_directions: "google maps link here",
        activity_type_id: 3,
        activity_status_id: 1,
        campus_spot_id: null,
        organizer_erp: 17855,
        created_at: 09-09-2021 11:33:21
    },
    ....
]

Scenario 2: Get All Filtered Activities

GIVEN a student is requesting a student's organized activities in the app
WHEN the app hits the /students/:erp/organized-activities endpoint with a valid GET request containing:

  • path parameter:

    • :erp, the unique id of the entity for which the details are needed
  • query parameters, either:

    • activity_status_id
    • activity_type_id
    • campus_spot_id
    • monday / tuesday / wednesday / thursday / friday / saturday / sunday
    • location
    • frequency
    • month_number
    • group_size
    • happens_at

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

  • headers
  • list of the student's organized activities

Sample Request/Sample Response
For e.g. we want a student's all private activities organized by me and happening on friday i.e.

  • erp=17855 (in path parameter)
  • friday=1
  • privacy=private
headers: {
    error: 0,
    message: "..."
}
body: [
    {
        activity_id: 0,
        location: "on_campus",
        privacy: "private", //<-- private activity
        frequency: "daily",
        monday: 1,
        tuesday: 1,
        wednesday: 1,
        thursday: 1,
        friday: 1, //<-- Happens on friday as well
        saturday: 1,
        sunday: 1,
        month_number: 9,
        group_size: 1,
        happens_at: 04:30
        additional_directions: "Near the stairs",
        activity_type_id: 1,
        activity_status_id: 2,
        campus_spot_id: 1,
        organizer_erp: 17855, //<-- my erp
        created_at: 09-09-2021 11:33:21
    },
    {
        activity_id: 1,
        location: "external",
        privacy: "private", //<-- private activity
        frequency: "combo",
        monday: 1,
        tuesday: 0,
        wednesday: 0,
        thursday: 0,
        friday: 1, //<-- Happens on friday as well
        saturday: 0,
        sunday: 0,
        month_number: 9,
        group_size: 5,
        happens_at: 04:30
        additional_directions: "google maps link here",
        activity_type_id: 3,
        activity_status_id: 1,
        campus_spot_id: null,
        organizer_erp: 17855, //<-- my erp
        created_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 going to be accessible and work the same way for the admin as well.

Testing Notes

Scenario 1: GET request is successful

GIVEN a student is requesting a student's organized activities in the app
WHEN the app hits the /students/:erp/organized-activities endpoint with a valid GET request
THEN the app should receive a status 200
AND the body should be an array
AND the organizer_erp of each item should be equal to path :erp
AND the first item of the array should be an object containing the following fields:

  • activity_id
  • activity_type_id etc.
Scenario 2: GET request with query parameters is successful

GIVEN a student is requesting all public activities organized by a student in the app
WHEN the app hits the /students/:erp/organized-activities endpoint with a valid GET request
AND the query parameter contains privacy=public
THEN the app should receive a status 200
AND the body should be an array
AND the organizer_erp of each item should be equal to the path :erp
AND the privacy of each item should be equal to my "public"
AND the first item of the array should be an object containing the following activity fields

  • activity_id
  • organizer_erp etc.
Scenario 3: GET request is unsuccessful due to unknown erp

GIVEN a student is requesting a student's organized activities in the app, containing the path parameter:

  • :erp, a non-existent id

WHEN the app hits the /students/:erp/organized-activities endpoint with a valid GET request
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 "Student not found"

Scenario 4: GET request is unsuccessful due to no organized activities

GIVEN a student is requesting a student's organized activities in the app, containing the path parameter:

  • :erp, an erp with no organized activities

WHEN the app hits the /students/:erp/organized-activities endpoint with a valid GET request
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 "No organized activities found"

Scenario 5: GET request is incorrect

GIVEN a student is requesting a student's organized activities in the app
WHEN the app hits the /students/:erp/organized-activities endpoint with a valid GET request
AND contains invalid/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 parameter

Scenario 6: GET request is unauthorized

GIVEN a student is requesting a student's organized activities in the app
WHEN the app hits the /students/:erp/organized-activities endpoint with a valid GET request
AND the request contains no authorization token
THEN the app should receive a status 401 Unauthorized
AND the response headers' code parameter should contain "TokenMissingException"

@arafaysaleem arafaysaleem added Priority: High Status: Pending Type: Enhancement user story A brief explanation of a functionality or an interaction with the system, from a user's perspective labels Sep 24, 2021
This was referenced Sep 24, 2021
@arafaysaleem arafaysaleem self-assigned this Sep 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Completed Type: Enhancement 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