diff --git a/src/site/layouts/vba_facility.drupal.liquid b/src/site/layouts/vba_facility.drupal.liquid new file mode 100644 index 0000000000..4177b574ce --- /dev/null +++ b/src/site/layouts/vba_facility.drupal.liquid @@ -0,0 +1,3 @@ +{% comment %} + This is a placeholder layout for now, since not including it breaks the main build. +{% endcomment %} diff --git a/src/site/stages/build/drupal/graphql/CountEntityTypes.graphql.js b/src/site/stages/build/drupal/graphql/CountEntityTypes.graphql.js index f366eaa3f5..21151c87cb 100644 --- a/src/site/stages/build/drupal/graphql/CountEntityTypes.graphql.js +++ b/src/site/stages/build/drupal/graphql/CountEntityTypes.graphql.js @@ -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: [ diff --git a/src/site/stages/build/drupal/graphql/GetLatestPageById.graphql.js b/src/site/stages/build/drupal/graphql/GetLatestPageById.graphql.js index 3156eb9495..ff1706696c 100644 --- a/src/site/stages/build/drupal/graphql/GetLatestPageById.graphql.js +++ b/src/site/stages/build/drupal/graphql/GetLatestPageById.graphql.js @@ -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 @@ -72,6 +73,7 @@ module.exports = ` ${nodeBasicLandingPage.fragment} ${nodeCampaignLandingPage.fragment} ${vetCenters.fragment} + ${vbaFacilities.fragment} ${vetCenterLocations.fragment} ${vamcPolicyPages.fragment} ${vamcRegisterForCarePages.fragment} @@ -112,6 +114,7 @@ module.exports = ` ... nodeBasicLandingPage ... nodeCampaignLandingPage ... vetCenterFragment + ... vbaFacilityFragment ... vetCenterLocationsFragment ... policiesPageFragment ... registerForCareFragment diff --git a/src/site/stages/build/drupal/graphql/vbaFacility.graphql.js b/src/site/stages/build/drupal/graphql/vbaFacility.graphql.js new file mode 100644 index 0000000000..ad999811db --- /dev/null +++ b/src/site/stages/build/drupal/graphql/vbaFacility.graphql.js @@ -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, +}; diff --git a/src/site/stages/build/drupal/individual-queries.js b/src/site/stages/build/drupal/individual-queries.js index 88ab7caa13..c059c5e557 100644 --- a/src/site/stages/build/drupal/individual-queries.js +++ b/src/site/stages/build/drupal/individual-queries.js @@ -97,6 +97,7 @@ const { } = require('./graphql/vamcBillingAndInsurancePage.graphql'); const { getVetCenterQueries } = require('./graphql/vetCenter.graphql'); +const { getVbaFacilityQueries } = require('./graphql/vbaFacility.graphql'); const { GetVetCenterLocations, @@ -137,6 +138,7 @@ function getNodeQueries(entityCounts) { GetNodeBasicLandingPage, GetCampaignLandingPages, ...getVetCenterQueries(entityCounts), + ...getVbaFacilityQueries(entityCounts), GetVetCenterLocations, GetPolicyPages, GetBillingAndInsurancePages,