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

feat: Scheduling API Clients #26

Merged
merged 3 commits into from
Nov 11, 2021
Merged

feat: Scheduling API Clients #26

merged 3 commits into from
Nov 11, 2021

Conversation

linnall
Copy link
Contributor

@linnall linnall commented Nov 6, 2021

Notion ticket link

Scheduling API Client

Implementation description

  • Creating API clients for scheduling endpoints

Steps to test

  1. Create dummy user
  • POST to auth/register
    sample body: { "firstName": "Test", "lastName": "User", "role": "Donor", "email": "test@email.com", "phoneNumber":"8888888888", "password": "123456", "businessName": "Test Business" }
  • login at http://localhost:3000/login
  1. Create dummy button with onClick function that triggers the following api clients:
  • SchedulingAPIClient.createSchedule
  • SchedulingAPIClient.getSchedules
  • SchedulingAPIClient.getScheduleById
  • SchedulingAPIClient.updateSchedule
  • SchedulingAPIClient.deleteSchedule

What should reviewers focus on?

Make sure requests are successful!

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

@linnall linnall self-assigned this Nov 6, 2021
@linnall linnall added the backend Backend change label Nov 6, 2021
@linnall linnall removed their assignment Nov 6, 2021
}
};

const createSchedule = async (schedule: Schedule): Promise<Schedule> => {
Copy link
Contributor Author

@linnall linnall Nov 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Appears that I still need to accommodate for foreign key reference
Screen Shot 2021-11-06 at 4 35 12 PM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine! In fact this is how it should be. To create a donation, you need to to be logged in and that donor should be in the donors table.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a semi-related note, do we still allow the donorId property to be updated when we update a schedule? Or do we keep it so that the donorId stays consistent with whichever donor is logged in so they can only edit their scheduled drop-offs?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

donorId should not be updated and the Frontend will never pass donorId to the updateSchedule function / endpoint.

@hanlinc27 hanlinc27 changed the title WIP: Scheduling API Clients feat: Scheduling API Clients Nov 7, 2021
@linnall linnall added frontend Frontend change and removed backend Backend change labels Nov 10, 2021
@linnall linnall force-pushed the feature/scheduling-api-client branch from 8984793 to 5303d99 Compare November 11, 2021 02:19
@linnall linnall merged commit a5c2ede into main Nov 11, 2021
@hanlinc27 hanlinc27 deleted the feature/scheduling-api-client branch November 11, 2021 04:24
@linnall linnall mentioned this pull request Nov 17, 2021
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants