diff --git a/apps/crn-server/test/integration/fixtures/team.ts b/apps/crn-server/test/integration/fixtures/team.ts index de2623b420..55ea9798a2 100644 --- a/apps/crn-server/test/integration/fixtures/team.ts +++ b/apps/crn-server/test/integration/fixtures/team.ts @@ -10,6 +10,8 @@ export const getTeamFixture = ( displayName: chance.animal(), applicationNumber: chance.guid(), projectTitle: 'Project title', + teamId: 'team-id', + grantId: 'grant-id', ...props, }; }; diff --git a/packages/contentful/migrations/crn/manuscripts/20241009181503-update-lifecycle-validations.js b/packages/contentful/migrations/crn/manuscripts/20241009181503-update-lifecycle-validations.js new file mode 100644 index 0000000000..39a39608cf --- /dev/null +++ b/packages/contentful/migrations/crn/manuscripts/20241009181503-update-lifecycle-validations.js @@ -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', + ], + }, + ]); +}; diff --git a/packages/contentful/migrations/crn/researchOutputs/20241009181828-remove-research-theme-field.js b/packages/contentful/migrations/crn/researchOutputs/20241009181828-remove-research-theme-field.js new file mode 100644 index 0000000000..6f663e2a95 --- /dev/null +++ b/packages/contentful/migrations/crn/researchOutputs/20241009181828-remove-research-theme-field.js @@ -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'); +}; diff --git a/packages/contentful/migrations/crn/teams/20241009180935-add-team-id-and-grant-id.js b/packages/contentful/migrations/crn/teams/20241009180935-add-team-id-and-grant-id.js new file mode 100644 index 0000000000..143958a5f8 --- /dev/null +++ b/packages/contentful/migrations/crn/teams/20241009180935-add-team-id-and-grant-id.js @@ -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'); +}; diff --git a/packages/contentful/migrations/crn/users/20241009180559-add-open-science-team-field.js b/packages/contentful/migrations/crn/users/20241009180559-add-open-science-team-field.js new file mode 100644 index 0000000000..608540551c --- /dev/null +++ b/packages/contentful/migrations/crn/users/20241009180559-add-open-science-team-field.js @@ -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'); +}; diff --git a/packages/model/src/team.ts b/packages/model/src/team.ts index 5d5d41c261..9ae368a3ab 100644 --- a/packages/model/src/team.ts +++ b/packages/model/src/team.ts @@ -80,6 +80,8 @@ export type TeamCreateDataObject = { projectSummary?: string; projectTitle: string; tools?: TeamTool[]; + teamId: string; + grantId: string; }; export type TeamResponse = TeamDataObject;