From c07a9e08d02ac0dce34ab66547933bf336a201a8 Mon Sep 17 00:00:00 2001 From: Max Novelli Date: Fri, 9 Aug 2024 13:39:19 +0200 Subject: [PATCH 1/5] Added start time to dataset dto and fixed description of timestamps --- src/datasets/dto/update-dataset.dto.ts | 2 +- src/datasets/dto/update-raw-dataset.dto.ts | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/datasets/dto/update-dataset.dto.ts b/src/datasets/dto/update-dataset.dto.ts index aa681784b..aab14a7e5 100644 --- a/src/datasets/dto/update-dataset.dto.ts +++ b/src/datasets/dto/update-dataset.dto.ts @@ -137,7 +137,7 @@ export class UpdateDatasetDto extends OwnableDto { type: Date, required: true, description: - "Time when dataset became fully available on disk, i.e. all containing files have been written. Format according to chapter 5.6 internet date/time format in RFC 3339. Local times without timezone/offset info are automatically transformed to UTC using the timezone of the API server.", + "Time when dataset became fully available on disk, i.e. all containing files have been written, or the dataset was created in SciCat.
It is expected to be in ISO8601 format according to specifications for internet date/time format in RFC 3339, chapter 5.6 (https://www.rfc-editor.org/rfc/rfc3339#section-5).
Local times without timezone/offset info are automatically transformed to UTC using the timezone of the API server.", }) @IsDateString() readonly creationTime: Date; diff --git a/src/datasets/dto/update-raw-dataset.dto.ts b/src/datasets/dto/update-raw-dataset.dto.ts index 241e124b8..a03fa14ad 100644 --- a/src/datasets/dto/update-raw-dataset.dto.ts +++ b/src/datasets/dto/update-raw-dataset.dto.ts @@ -17,7 +17,17 @@ export class UpdateRawDatasetDto extends UpdateDatasetDto { type: Date, required: false, description: - "End time of data acquisition for this dataset, format according to chapter 5.6 internet date/time format in RFC 3339. Local times without timezone/offset info are automatically transformed to UTC using the timezone of the API server.", + "Start time of data acquisition for the current dataset.
It is expected to be in ISO8601 format according to specifications for internet date/time format in RFC 3339, chapter 5.6 (https://www.rfc-editor.org/rfc/rfc3339#section-5).
Local times without timezone/offset info are automatically transformed to UTC using the timezone of the API server.", + }) + @IsOptional() + @IsDateString() + readonly startTime?: Date; + + @ApiProperty({ + type: Date, + required: false, + description: + "End time of data acquisition for the current dataset.
It is expected to be in ISO8601 format according to specifications for internet date/time format in RFC 3339, chapter 5.6 (https://www.rfc-editor.org/rfc/rfc3339#section-5).
Local times without timezone/offset info are automatically transformed to UTC using the timezone of the API server.", }) @IsOptional() @IsDateString() From e643e3d97e55320ec17b3d3ef1382aa05687ea27 Mon Sep 17 00:00:00 2001 From: Max Novelli Date: Fri, 9 Aug 2024 13:43:32 +0200 Subject: [PATCH 2/5] added startTime to dataset schema --- src/datasets/schemas/dataset.schema.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/datasets/schemas/dataset.schema.ts b/src/datasets/schemas/dataset.schema.ts index 239987347..d1d613d3e 100644 --- a/src/datasets/schemas/dataset.schema.ts +++ b/src/datasets/schemas/dataset.schema.ts @@ -418,7 +418,16 @@ export class DatasetClass extends OwnableClass { type: Date, required: false, description: - "End time of data acquisition for this dataset, format according to chapter 5.6 internet date/time format in RFC 3339. Local times without timezone/offset info are automatically transformed to UTC using the timezone of the API server.", + "Start time of data acquisition for the current dataset.
It is expected to be in ISO8601 format according to specifications for internet date/time format in RFC 3339, chapter 5.6 (https://www.rfc-editor.org/rfc/rfc3339#section-5).
Local times without timezone/offset info are automatically transformed to UTC using the timezone of the API server.", + }) + @Prop({ type: Date, required: false }) + startTime?: Date; + + @ApiProperty({ + type: Date, + required: false, + description: + "End time of data acquisition for the current dataset.
It is expected to be in ISO8601 format according to specifications for internet date/time format in RFC 3339, chapter 5.6 (https://www.rfc-editor.org/rfc/rfc3339#section-5).
Local times without timezone/offset info are automatically transformed to UTC using the timezone of the API server.", }) @Prop({ type: Date, required: false }) endTime?: Date; From 159b8542de8eeea9207a2315160fa053aaf99b88 Mon Sep 17 00:00:00 2001 From: Max Novelli Date: Fri, 9 Aug 2024 13:44:35 +0200 Subject: [PATCH 3/5] fixed description of timestamp fields --- src/datasets/schemas/dataset.schema.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datasets/schemas/dataset.schema.ts b/src/datasets/schemas/dataset.schema.ts index d1d613d3e..74c29aaa7 100644 --- a/src/datasets/schemas/dataset.schema.ts +++ b/src/datasets/schemas/dataset.schema.ts @@ -196,7 +196,7 @@ export class DatasetClass extends OwnableClass { type: Date, required: true, description: - "Time when dataset became fully available on disk, i.e. all containing files have been written. Format according to chapter 5.6 internet date/time format in RFC 3339. Local times without timezone/offset info are automatically transformed to UTC using the timezone of the API server.", + "Time when dataset became fully available on disk, i.e. all containing files have been written, or the dataset was created in SciCat.
It is expected to be in ISO8601 format according to specifications for internet date/time format in RFC 3339, chapter 5.6 (https://www.rfc-editor.org/rfc/rfc3339#section-5).
Local times without timezone/offset info are automatically transformed to UTC using the timezone of the API server.", }) @Prop({ type: Date, required: true, index: true }) creationTime: Date; From f0cb8e5c7ca606989067ba0700baab4f0de7fc65 Mon Sep 17 00:00:00 2001 From: Max Novelli Date: Fri, 9 Aug 2024 14:14:24 +0200 Subject: [PATCH 4/5] Added startTime to test data --- test/TestData.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/TestData.js b/test/TestData.js index 91fd1bb28..9b8e0f5fb 100644 --- a/test/TestData.js +++ b/test/TestData.js @@ -6,6 +6,12 @@ const TestAccounts = Object.fromEntries( RawTestAccounts.map((account) => [account.username, account]), ); +const DatasetDates = faker.date.betweens({ + from: faker.date.recent({ days: 15 }).toISOString(), + to: faker.date.recent({ days: 10 }).toISOString(), + count: 2, +}); + const TestData = { EntryCreatedStatusCode: 201, EntryValidStatusCode: 200, @@ -117,6 +123,7 @@ const TestData = { RawCorrect: { principalInvestigator: "scicatingestor@your.site", + startTime: "2011-09-14T05:29:11.000Z", endTime: "2011-09-14T06:31:25.000Z", creationLocation: "/SU/XQX/RAMJET", dataFormat: "Upchuck pre 2017", @@ -199,7 +206,8 @@ const TestData = { RawCorrectRandom: { principalInvestigator: faker.internet.email(), - endTime: faker.date.past().toISOString(), + startTime: DatasetDates[0], + endTime: DatasetDates[1], creationLocation: faker.system.directoryPath(), dataFormat: faker.lorem.words(3), scientificMetadata: { @@ -299,6 +307,7 @@ const TestData = { RawWrong_2: { principalInvestigator: "bertram.astor@grumble.com", + startTime: "2011-09-15T02:13:52.000Z", endTime: "2011-09-14T06:31:25.000Z", creationLocation: "/SU/XQX/RAMJET", dataFormat: "Upchuck pre 2017", From 8ca1eae3f9b5ce116a01dee412b59a092152e2fb Mon Sep 17 00:00:00 2001 From: junjiequan Date: Thu, 22 Aug 2024 13:06:37 +0200 Subject: [PATCH 5/5] fix fluffy fake data for testing --- test/TestData.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/TestData.js b/test/TestData.js index 9b8e0f5fb..538f657bf 100644 --- a/test/TestData.js +++ b/test/TestData.js @@ -8,7 +8,7 @@ const TestAccounts = Object.fromEntries( const DatasetDates = faker.date.betweens({ from: faker.date.recent({ days: 15 }).toISOString(), - to: faker.date.recent({ days: 10 }).toISOString(), + to: faker.date.soon({ days: 10 }).toISOString(), count: 2, });