-
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-593 Adding Identifiers to Output Versions (#4349)
* ASAP-593 Adding Identifiers Fields to Output Versions * change validation crn * empty to trigger ci
- Loading branch information
Showing
8 changed files
with
199 additions
and
2 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
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
70 changes: 70 additions & 0 deletions
70
...entful/migrations/crn/researchOutputs/20240808084217-add-identifier-fields-to-versions.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,70 @@ | ||
module.exports.description = 'Add identifier fields to versions'; | ||
|
||
module.exports.up = (migration) => { | ||
const researchOutputVersions = migration.editContentType( | ||
'researchOutputVersions', | ||
); | ||
|
||
researchOutputVersions | ||
.createField('doi') | ||
.name('DOI') | ||
.type('Symbol') | ||
.localized(false) | ||
.required(false) | ||
.validations([ | ||
{ | ||
regexp: { | ||
pattern: '^(doi\\:)?\\d{2}\\.\\d{4}.*$', | ||
flags: null, | ||
}, | ||
message: 'DOIs must start with a number and cannot be a URL', | ||
}, | ||
]) | ||
.disabled(false) | ||
.omitted(false); | ||
|
||
researchOutputVersions | ||
.createField('rrid') | ||
.name('RRID') | ||
.type('Symbol') | ||
.localized(false) | ||
.required(false) | ||
.validations([ | ||
{ | ||
regexp: { | ||
pattern: '^RRID:[a-zA-Z]+.+$', | ||
flags: null, | ||
}, | ||
message: 'This must start with "RRID:"', | ||
}, | ||
]) | ||
.disabled(false) | ||
.omitted(false); | ||
|
||
researchOutputVersions | ||
.createField('accession') | ||
.name('Accession') | ||
.type('Symbol') | ||
.localized(false) | ||
.required(false) | ||
.validations([ | ||
{ | ||
regexp: { | ||
pattern: '^(\\w+\\d+(\\.\\d+)?)|(NP_\\d+)$', | ||
flags: null, | ||
}, | ||
message: 'This must start with a letter', | ||
}, | ||
]) | ||
.disabled(false) | ||
.omitted(false); | ||
}; | ||
|
||
module.exports.down = (migration) => { | ||
const researchOutputVersions = migration.editContentType( | ||
'researchOutputVersions', | ||
); | ||
researchOutputVersions.deleteField('doi'); | ||
researchOutputVersions.deleteField('rrid'); | ||
researchOutputVersions.deleteField('accession'); | ||
}; |
73 changes: 73 additions & 0 deletions
73
...ges/contentful/migrations/gp2/outputs/20240808084847-add-identifier-fields-to-versions.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,73 @@ | ||
module.exports.description = 'Add identifier fields to versions'; | ||
|
||
module.exports.up = (migration) => { | ||
const outputVersion = migration.editContentType('outputVersion'); | ||
|
||
outputVersion | ||
.createField('doi') | ||
.name('DOI') | ||
.type('Symbol') | ||
.localized(false) | ||
.required(false) | ||
.validations([ | ||
{ | ||
regexp: { | ||
pattern: '^10\\.\\d{4}.*$', | ||
flags: null, | ||
}, | ||
|
||
message: | ||
'Please enter a valid DOI which starts with a 10. and it cannot be a URL. (e.g. 10.5555/YFRU1371.121212)', | ||
}, | ||
]) | ||
.disabled(false) | ||
.omitted(false); | ||
|
||
outputVersion | ||
.createField('rrid') | ||
.name('RRID') | ||
.type('Symbol') | ||
.localized(false) | ||
.required(false) | ||
.validations([ | ||
{ | ||
regexp: { | ||
pattern: '^RRID:[a-zA-Z]+.+$', | ||
flags: null, | ||
}, | ||
|
||
message: | ||
'Please enter a valid RRID which starts with `RRID`. (e.g. RRID:AB_007358)', | ||
}, | ||
]) | ||
.disabled(false) | ||
.omitted(false); | ||
|
||
outputVersion | ||
.createField('accessionNumber') | ||
.name('Accession') | ||
.type('Symbol') | ||
.localized(false) | ||
.required(false) | ||
.validations([ | ||
{ | ||
regexp: { | ||
pattern: '^(\\w+\\d+(\\.\\d+)?)|(NP_\\d+)$', | ||
flags: null, | ||
}, | ||
|
||
message: | ||
'Please enter a valid Accession Number which must start with a letter (e.g. NT_123456)', | ||
}, | ||
]) | ||
.disabled(false) | ||
.omitted(false); | ||
}; | ||
|
||
module.exports.down = (migration) => { | ||
const outputVersion = migration.editContentType('outputVersion'); | ||
|
||
outputVersion.deleteField('doi'); | ||
outputVersion.deleteField('rrid'); | ||
outputVersion.deleteField('accessionNumber'); | ||
}; |
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