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

F24/julia/activity management endpoints I #54

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

liya-zhu
Copy link
Contributor

@liya-zhu liya-zhu commented Nov 29, 2024

Notion ticket link

Activity Management Endpoints I

Implementation description

  • Added activity management endpoints
  • Deleted redundant activity_id column from activity model
  • Enabled auto-generated timestamps for created_at and updated_at columns in activity model
  • Added activityUpdateDtoValidator with all fields optional so that any subset of fields can be updated
  • Added date validator in backend/typescript/middlewares/validators/util.ts

Steps to test

  1. GET /activities - Retrieves all activities.
    a. Accessible by Volunteer/Staff/Admin/Behaviourist
    image

  2. GET /activities/<id>- Retrieves a specific activity by its ID.
    a. Accessible by Volunteer/Staff/Admin/Behaviourist
    image

    b. Invalid id
    image

    c. id not in database
    image

  3. POST /activities - Creates a new activity. It can be created without a user and scheduled times.
    a. Not accessible by Volunteer/Staff roles
    image

    b. Accessible by Admins and Behaviourists
    image

    c. Creating without user, scheduledSartTime, startTme, endTime, notes
    image

    d. Creating with required field missing (idk if this error message is misleading)
    image

    e. Creating with invalid date
    image

    f. Creating with invalid other fields
    image

    g. Creating with non-existent petId, activityTypeId, or userId
    image
    image
    image

  4. PATCH /activities/<id> - Updates other details of an activity (generic endpoint).
    a. Not accessible by Volunteer/Staff roles
    image

    b. Accessible by Admins and Behaviourists. Able to update any subset of fields
    image

    c. Trying to set a required field to null
    image

    d. Invalid id
    image

    e. id not in database
    image

  5. DELETE /activities/<id> - Deletes an activity.
    a. Not accessible by Volunteer/Staff roles
    image

    b. Accessible by Admins and Behaviourists
    image

    c. Invalid id, id not in database tests are similar

What should reviewers focus on?

  • The ticket asks for a patch endpoint but existing endpoints use put for updating entities. Not completely sure what the difference is but I used patch
  • Should I merge/rebase on main

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant