Skip to content

Commit

Permalink
Update correction structure in docmap parser [elifesciences/enhanced-…
Browse files Browse the repository at this point in the history
…preprints-issues#1120]

Update the correction structure in the docmap-parser and its test cases. Now, instead of an array of dates, the 'corrections' field holds an array of objects with a 'correctedDate' field.
  • Loading branch information
nlisgo committed Jun 20, 2024
1 parent 7330b4a commit a0db307
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/parser/docmap-parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,13 @@ describe('docmap-parser', () => {
'https://doi.org/version-of-record-corrected-again',
],
versionIdentifier: '1',
correctedDate: [
new Date('2024-06-09'),
new Date('2024-06-10'),
corrections: [
{
correctedDate: new Date('2024-06-09'),
},
{
correctedDate: new Date('2024-06-10'),
},
],
});
});
Expand Down
8 changes: 6 additions & 2 deletions src/parser/docmap-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export enum ContentType {
AuthorResponse = 'author-response',
}

type Correction = {
correctedDate: Date,
};

type Preprint = {
id: string,
versionIdentifier?: string,
Expand All @@ -67,7 +71,7 @@ type Preprint = {
url?: string,
content?: string[],
license?: string,
correctedDate?: Date[],
corrections?: Correction[],
};

type ReviewedPreprint = {
Expand All @@ -81,7 +85,7 @@ type ReviewedPreprint = {
reviewedDate?: Date,
authorResponseDate?: Date,
license?: string,
correctedDate?: Date[],
corrections?: Correction[],
};

type RelatedContentItem = {
Expand Down

0 comments on commit a0db307

Please sign in to comment.