Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding dataset start time #1366

Merged
merged 5 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/datasets/dto/update-dataset.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br>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).<br>Local times without timezone/offset info are automatically transformed to UTC using the timezone of the API server.",
})
@IsDateString()
readonly creationTime: Date;
Expand Down
12 changes: 11 additions & 1 deletion src/datasets/dto/update-raw-dataset.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br>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).<br>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.<br>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).<br>Local times without timezone/offset info are automatically transformed to UTC using the timezone of the API server.",
})
@IsOptional()
@IsDateString()
Expand Down
13 changes: 11 additions & 2 deletions src/datasets/schemas/dataset.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br>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).<br>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;
Expand Down Expand Up @@ -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.<br>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).<br>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.<br>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).<br>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;
Expand Down
11 changes: 10 additions & 1 deletion test/TestData.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.soon({ days: 10 }).toISOString(),
count: 2,
});

const TestData = {
EntryCreatedStatusCode: 201,
EntryValidStatusCode: 200,
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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",
Expand Down
Loading