Skip to content

Commit

Permalink
[VA-14948] Add VBA Facility GraphQL Query (#1715)
Browse files Browse the repository at this point in the history
* VA-14948: Add VBA Facility Query

* VA-14948: Add VBA Query to page build

* VA-14948: Add empty Facility layout for build

* Add comment to placeholder VBA Facility layout
  • Loading branch information
maxx1128 authored Sep 28, 2023
1 parent ae9236c commit 6bd4f5c
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/site/layouts/vba_facility.drupal.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% comment %}
This is a placeholder layout for now, since not including it breaks the main build.
{% endcomment %}
10 changes: 10 additions & 0 deletions src/site/stages/build/drupal/graphql/CountEntityTypes.graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ const CountEntityTypes = `
count
}
vbaFacilities: nodeQuery(
filter: {
conditions: [
{field: "status", value: ["1"]},
{field: "type", value: ["vba_facility"]}
]}
) {
count
}
newsStories: nodeQuery(
filter: {
conditions: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ const vamcPolicyPages = require('./vamcPoliciesPage.graphql');
const vamcRegisterForCarePages = require('./vamcRegisterForCarePage.graphql');
const vetCenterLocations = require('./vetCenterLocations.graphql');
const vetCenters = require('./vetCenter.graphql');
const vbaFacilities = require('./vbaFacility.graphql');
const { ALL_FRAGMENTS } = require('./fragments.graphql');

// String Helpers
const {
updateQueryString,
queryParamToBeChanged,
} = require('./../../../../utilities/stringHelpers');
} = require('../../../../utilities/stringHelpers');

/**
* Queries for a page by the node id, getting the latest revision
Expand Down Expand Up @@ -72,6 +73,7 @@ module.exports = `
${nodeBasicLandingPage.fragment}
${nodeCampaignLandingPage.fragment}
${vetCenters.fragment}
${vbaFacilities.fragment}
${vetCenterLocations.fragment}
${vamcPolicyPages.fragment}
${vamcRegisterForCarePages.fragment}
Expand Down Expand Up @@ -112,6 +114,7 @@ module.exports = `
... nodeBasicLandingPage
... nodeCampaignLandingPage
... vetCenterFragment
... vbaFacilityFragment
... vetCenterLocationsFragment
... policiesPageFragment
... registerForCareFragment
Expand Down
88 changes: 88 additions & 0 deletions src/site/stages/build/drupal/graphql/vbaFacility.graphql.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
const { generatePaginatedQueries } = require('../individual-queries-helpers');

const draftContentOverride = process.env.UNPUBLISHED_CONTENT === 'true';

const vbaFacilityFragment = `
fragment vbaFacilityFragment on NodeVbaFacility {
entityId
entityUrl {
path
routed
}
entityMetatags {
__typename
key
value
}
entityBundle
entityLabel
... on NodeVbaFacility {
title
changed
fieldIntroText
fieldFacilityLocatorApiId
fieldOperatingStatusFacility
fieldOperatingStatusMoreInfo
fieldPhoneNumber
fieldAddress {
addressLine1
addressLine2
countryCode
locality
postalCode
administrativeArea
}
fieldGeolocation {
lat
lon
}
fieldOfficeHours {
day
starthours
endhours
comment
}
}
}`;

const getVbaFacilitySlice = (operationName, offset, limit) => {
return `
${vbaFacilityFragment}
query GetVbaFacilitys${
!draftContentOverride ? '($onlyPublishedContent: Boolean!)' : ''
} {
nodeQuery(
limit: ${limit}
offset: ${offset}
filter: {
conditions: [
${
!draftContentOverride
? '{ field: "status", value: ["1"], enabled: $onlyPublishedContent },'
: ''
}
{ field: "type", value: ["vba_facility"] }
]
}) {
entities {
... vbaFacilityFragment
}
}
}
`;
};

const getVbaFacilityQueries = entityCounts => {
return generatePaginatedQueries({
operationNamePrefix: 'GetVbaFacility',
entitiesPerSlice: 25,
totalEntities: entityCounts.data.vbaFacilities.count,
getSlice: getVbaFacilitySlice,
});
};

module.exports = {
fragment: vbaFacilityFragment,
getVbaFacilityQueries,
};
2 changes: 2 additions & 0 deletions src/site/stages/build/drupal/individual-queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const {
} = require('./graphql/vamcBillingAndInsurancePage.graphql');

const { getVetCenterQueries } = require('./graphql/vetCenter.graphql');
const { getVbaFacilityQueries } = require('./graphql/vbaFacility.graphql');

const {
GetVetCenterLocations,
Expand Down Expand Up @@ -137,6 +138,7 @@ function getNodeQueries(entityCounts) {
GetNodeBasicLandingPage,
GetCampaignLandingPages,
...getVetCenterQueries(entityCounts),
...getVbaFacilityQueries(entityCounts),
GetVetCenterLocations,
GetPolicyPages,
GetBillingAndInsurancePages,
Expand Down

0 comments on commit 6bd4f5c

Please sign in to comment.