generated from DFE-Digital/govuk-dotnet-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: create agency resources as feature flag, page categopry, and nav…
…igation
- Loading branch information
1 parent
42308a6
commit fb918d1
Showing
6 changed files
with
46 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
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
28 changes: 28 additions & 0 deletions
28
Contentful-Schema/migrations/0011-create-agency-standards-page-category.cjs
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,28 @@ | ||
module.exports = async function (migration, { makeRequest }) { | ||
|
||
const contentTypeId = 'content', | ||
categoryFieldId = 'category', | ||
agencyResourcesString = 'Agency resources'; | ||
|
||
const response = await makeRequest({ | ||
method: 'GET', | ||
url: `/content_types?sys.id[in]=${contentTypeId}` | ||
}); | ||
|
||
var update = false; | ||
const validations = response.items[0].fields | ||
.filter(field => field.id == categoryFieldId)[0] | ||
.validations.map(rule => { | ||
if (rule.in && !rule.in.includes(agencyResourcesString)) { | ||
rule.in.push(agencyResourcesString); | ||
update = true; | ||
} | ||
return rule; | ||
}); | ||
|
||
if (update) { | ||
migration | ||
.editContentType(contentTypeId) | ||
.editField(categoryFieldId).validations(validations); | ||
} | ||
}; |
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
Binary file not shown.