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

[10-10CG] Use CG facilities endpoint instead of hca endpoint #32038

Merged
merged 5 commits into from
Sep 25, 2024

Conversation

coope93
Copy link
Contributor

@coope93 coope93 commented Sep 20, 2024

Summary

  • Use new caregiver endpoint to query facilities. This endpoint returns pagination metadata allowing for determining if Load more facilities button should be loaded. The data object response is a little different format, so that is the bulk of changes in this PR.
  • 1010 Team
  • Behind flipper toggle caregiver_use_facilities_API.
  • Don't merge until corresponding vets-api PR is merged. (although it's behind a toggle so it won't break for anyone)

Related issue(s)

Testing done

  • Unit tests updated

Screenshots

No visual changes other than Load more facilities button is not rendered if there are no more facilities to load

What areas of the site does it impact?

10-10CG

Acceptance criteria

Quality Assurance & Testing

  • I fixed|updated|added unit tests and integration tests for each feature (if applicable).
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs
  • Linting warnings have been addressed
  • Documentation has been updated (link to documentation *if necessary)
  • Screenshot of the developed feature is added
  • Accessibility testing has been performed

Error Handling

  • Browser console contains no warnings or errors.
  • Events are being sent to the appropriate logging solution
  • Feature/bug has a monitor built into Datadog or Grafana (if applicable)

Authentication

  • Did you login to a local build and verify all authenticated routes work as expected with a test user

…e. Hide Load more facilities button when no more exist
@@ -51,7 +51,7 @@ export const fetchFacilities = async ({
}) => {
const baseUrl = `${
environment.API_URL
}/v0/health_care_applications/facilities?type=health`;
}/v0/caregivers_assistance_claims/facilities?type=health`;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

New vets-api endpoint for facilities

>
Load more facilities
</button>
{hasMoreFacilities() && (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only render Load more facilities button if there are more facilities to load

@va-vfs-bot va-vfs-bot temporarily deployed to master/70846-handle-paginated-facilities-response/main September 23, 2024 13:20 Inactive
@@ -67,8 +67,15 @@ export const fetchFacilities = async ({

return fetchRequest
.then(response => {
return response.map(facility => {
const { physical } = facility?.address;
if (!response?.data?.length) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should not really happen now, but I added logic to handle if the data object is not returned (this can happen on the backend if the pagination values are passed in out of range). If you try to send the searchbox garbage (ie search for 'my city` or something it will generally return this same response but from the mapbox api call).

@@ -83,12 +90,18 @@ export const fetchFacilities = async ({

// Return a new facility object with the updated address
return {
...facility,
...attributes,
id: facility.id,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The id is not passed in the response object attributes, so I am adding it to the response here.

@@ -16,7 +16,7 @@ export const setupPerTest = () => {
cy.intercept('POST', 'v0/form1010cg/attachments', mockUpload);
cy.intercept(
'GET',
'/v0/health_care_applications/facilities?*',
'/v0/caregivers_assistance_claims/facilities?*',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

New api endpoint

@coope93 coope93 marked this pull request as ready for review September 23, 2024 13:39
@coope93 coope93 requested review from a team as code owners September 23, 2024 13:39
@va-vfs-bot va-vfs-bot temporarily deployed to master/70846-handle-paginated-facilities-response/main September 23, 2024 13:40 Inactive
mkerns1
mkerns1 previously approved these changes Sep 23, 2024
Copy link
Contributor

@mkerns1 mkerns1 left a comment

Choose a reason for hiding this comment

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

Looks good Brandon. Nice work!

powellkerry
powellkerry previously approved these changes Sep 23, 2024
longmd
longmd previously approved these changes Sep 23, 2024
@coope93 coope93 dismissed stale reviews from longmd, powellkerry, and mkerns1 via 45c31a4 September 24, 2024 16:43
@va-vfs-bot va-vfs-bot temporarily deployed to master/70846-handle-paginated-facilities-response/main September 24, 2024 16:44 Inactive
@coope93 coope93 force-pushed the 70846-handle-paginated-facilities-response branch from 45c31a4 to 616d30b Compare September 24, 2024 16:45
@coope93 coope93 merged commit 511cddc into main Sep 25, 2024
70 checks passed
@coope93 coope93 deleted the 70846-handle-paginated-facilities-response branch September 25, 2024 17:48
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.

5 participants