-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[VA-14948] Add VBA Facility GraphQL Query (#1715)
* 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
Showing
5 changed files
with
107 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
src/site/stages/build/drupal/graphql/vbaFacility.graphql.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters