-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ASAP-533 CRN Schema changes * fix test * Update packages/contentful/migrations/crn/manuscripts/20241009181503-update-lifecycle-validations.js Co-authored-by: Diana Guimarães <47486047+dianaguimaraes@users.noreply.github.com> --------- Co-authored-by: Diana Guimarães <47486047+dianaguimaraes@users.noreply.github.com>
- Loading branch information
1 parent
12c4f23
commit 51ab580
Showing
6 changed files
with
153 additions
and
0 deletions.
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
38 changes: 38 additions & 0 deletions
38
...ages/contentful/migrations/crn/manuscripts/20241009181503-update-lifecycle-validations.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,38 @@ | ||
module.exports.description = 'Update Lifecycle Validations'; | ||
|
||
module.exports.up = (migration) => { | ||
const manuscriptVersions = migration.editContentType('manuscriptVersions'); | ||
|
||
manuscriptVersions.editField('lifecycle').validations([ | ||
{ | ||
in: [ | ||
'Draft Manuscript (prior to Publication)', | ||
'Preprint', | ||
'Typeset proof', | ||
'Publication', | ||
'Publication with addendum or corrigendum', | ||
'Other', | ||
], | ||
}, | ||
]); | ||
}; | ||
|
||
module.exports.down = (migration) => { | ||
const manuscriptVersions = migration.editContentType('manuscriptVersions'); | ||
|
||
manuscriptVersions.editField('lifecycle').validations([ | ||
{ | ||
in: [ | ||
'Draft manuscript (prior to preprint submission)', | ||
'Revised Draft Manuscript (prior to preprint submission)', | ||
'Preprint, version 1', | ||
'Preprint, version 2', | ||
'Preprint, version 3+', | ||
'Typeset proof', | ||
'Publication', | ||
'Publication with addendum or corrigendum', | ||
'Other', | ||
], | ||
}, | ||
]); | ||
}; |
32 changes: 32 additions & 0 deletions
32
...s/contentful/migrations/crn/researchOutputs/20241009181828-remove-research-theme-field.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,32 @@ | ||
module.exports.description = 'Removes research theme field'; | ||
|
||
module.exports.up = (migration) => { | ||
const researchOutputs = migration.editContentType('researchOutputs'); | ||
researchOutputs.deleteField('researchTheme'); | ||
}; | ||
|
||
module.exports.down = (migration) => { | ||
const researchOutputs = migration.editContentType('researchOutputs'); | ||
|
||
researchOutputs | ||
.createField('researchTheme') | ||
.name('Research Theme') | ||
.type('Array') | ||
.localized(false) | ||
.required(false) | ||
.validations([]) | ||
.disabled(false) | ||
.omitted(false) | ||
.items({ | ||
type: 'Symbol', | ||
validations: [], | ||
}); | ||
|
||
researchOutputs.changeFieldControl( | ||
'researchTheme', | ||
'builtin', | ||
'tagEditor', | ||
{}, | ||
); | ||
researchOutputs.moveField('researchTheme').afterField('tags'); | ||
}; |
34 changes: 34 additions & 0 deletions
34
packages/contentful/migrations/crn/teams/20241009180935-add-team-id-and-grant-id.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,34 @@ | ||
module.exports.description = 'Add team id and grant id fields'; | ||
|
||
module.exports.up = (migration) => { | ||
const teams = migration.editContentType('teams'); | ||
|
||
teams | ||
.createField('teamId') | ||
.name('Team ID') | ||
.type('Symbol') | ||
.localized(false) | ||
.required(true) | ||
.validations([]) | ||
.disabled(false) | ||
.omitted(false); | ||
|
||
teams | ||
.createField('grantId') | ||
.name('Grant ID') | ||
.type('Symbol') | ||
.localized(false) | ||
.required(true) | ||
.validations([]) | ||
.disabled(false) | ||
.omitted(false); | ||
|
||
teams.moveField('teamId').afterField('displayName'); | ||
teams.moveField('grantId').afterField('teamId'); | ||
}; | ||
|
||
module.exports.down = (migration) => { | ||
const teams = migration.editContentType('teams'); | ||
teams.deleteField('teamId'); | ||
teams.deleteField('grantId'); | ||
}; |
45 changes: 45 additions & 0 deletions
45
packages/contentful/migrations/crn/users/20241009180559-add-open-science-team-field.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,45 @@ | ||
module.exports.description = | ||
'Add open science team field and delete research theme'; | ||
|
||
module.exports.up = (migration) => { | ||
const users = migration.editContentType('users'); | ||
users.deleteField('researchTheme'); | ||
|
||
users | ||
.createField('openScienceTeamMember') | ||
.name('Open Science Team Member') | ||
.type('Boolean') | ||
.localized(false) | ||
.required(false) | ||
.validations([]) | ||
.defaultValue({ | ||
'en-US': false, | ||
}) | ||
.disabled(false) | ||
.omitted(false); | ||
|
||
users.changeFieldControl('openScienceTeamMember', 'builtin', 'boolean', {}); | ||
users.moveField('openScienceTeamMember').afterField('role'); | ||
}; | ||
|
||
module.exports.down = (migration) => { | ||
const users = migration.editContentType('users'); | ||
users | ||
.createField('researchTheme') | ||
.name('Research Theme') | ||
.type('Array') | ||
.localized(false) | ||
.required(false) | ||
.validations([]) | ||
.disabled(false) | ||
.omitted(false) | ||
.items({ | ||
type: 'Symbol', | ||
validations: [], | ||
}); | ||
|
||
users.changeFieldControl('researchTheme', 'builtin', 'tagEditor', {}); | ||
users.moveField('researchTheme').afterField('researchTags'); | ||
|
||
users.deleteField('openScienceTeamMember'); | ||
}; |
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