Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/mocha-11.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrosx authored Jan 10, 2025
2 parents fe1b38c + 34786d1 commit c88496a
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 25 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/upload-sdk-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches:
- master
pull_request:
branches:
- master

env:
NODE_VERSION: 20.x
Expand Down Expand Up @@ -75,6 +78,17 @@ jobs:
)
- uses: actions/upload-artifact@v4
if: github.event_name == 'push'
with:
name: sdk-${{ matrix.generator }}-${{ github.sha }}
path: ./sdk

cleanup-artifacts:
runs-on: ubuntu-latest
needs:
- generate-and-upload-sdk
if: github.event_name != 'push'
steps:
- uses: geekyeggo/delete-artifact@v5
with:
name: swagger-*
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ Valid environment variables for the .env file. See [.env.example](/.env.example)
| `ES_REFRESH` | string | | If set to `wait_for`, Elasticsearch will wait till data is inserted into the specified index before returning a response. | false |
| `LOGGERS_CONFIG_FILE` | string | | The file name for loggers configuration, located in the project root directory. | "loggers.json" |
| `PROPOSAL_TYPES_FILE` | string | | The file name for proposal types configuration, located in the project root directory. | "proposalTypes.json" |
| `SWAGGER_PATH` | string | Yes | swaggerPath is the path where the swagger UI will be available| "explorer"|
| `MAX_FILE_UPLOAD_SIZE` | string | Yes | Maximum allowed file upload size | "16mb"|
| `SWAGGER_PATH` | string | Yes | swaggerPath is the path where the swagger UI will be available. | "explorer"|
| `MAX_FILE_UPLOAD_SIZE` | string | Yes | Maximum allowed file upload size. | "16mb"|

## Migrating from the old SciCat Backend

Expand Down
2 changes: 1 addition & 1 deletion src/datasets/datasets.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export class DatasetsService {
const datasets = this.datasetModel.find({}, { _id: 0 }).lean().exec();
return datasets;
} catch (error) {
throw new NotFoundException();
throw new NotFoundException(error);
}
}
// Get metadata keys
Expand Down
9 changes: 9 additions & 0 deletions src/datasets/dto/create-derived-dataset-obsolete.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,13 @@ export class CreateDerivedDatasetObsoleteDto extends UpdateDerivedDatasetObsolet
@IsOptional()
@IsString()
readonly version?: string;

@ApiProperty({
type: String,
required: true,
description:
"A name for the dataset, given by the creator to carry some semantic meaning. Useful for display purposes e.g. instead of displaying the pid.",
})
@IsString()
declare readonly datasetName: string;
}
9 changes: 9 additions & 0 deletions src/datasets/dto/create-raw-dataset-obsolete.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,13 @@ export class CreateRawDatasetObsoleteDto extends UpdateRawDatasetObsoleteDto {
@IsOptional()
@IsString()
readonly version?: string;

@ApiProperty({
type: String,
required: true,
description:
"A name for the dataset, given by the creator to carry some semantic meaning. Useful for display purposes e.g. instead of displaying the pid.",
})
@IsString()
declare readonly datasetName: string;
}
22 changes: 16 additions & 6 deletions src/datasets/dto/output-dataset-obsolete.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Datablock } from "src/datablocks/schemas/datablock.schema";
export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto {
@ApiProperty({
type: String,
required: false,
required: true,
description: "Persistent identifier of the dataset.",
})
@IsString()
Expand All @@ -44,7 +44,7 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto {

@ApiProperty({
type: String,
required: true,
required: false,
description:
"First name and last name of principal investigator(s). If multiple PIs are present, use a semicolon separated list. This field is required if the dataset is a Raw dataset.",
})
Expand Down Expand Up @@ -74,7 +74,7 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto {

@ApiProperty({
type: String,
required: true,
required: false,
description:
"Unique location identifier where data was taken, usually in the form /Site-name/facility-name/instrumentOrBeamline-name. This field is required if the dataset is a Raw dataset.",
})
Expand Down Expand Up @@ -112,7 +112,7 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto {

@ApiProperty({
type: String,
required: true,
required: false,
description:
"First name and last name of the person or people pursuing the data analysis. The string may contain a list of names, which should then be separated by semicolons.",
})
Expand All @@ -122,7 +122,7 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto {

@ApiProperty({
type: [String],
required: true,
required: false,
description:
"Array of input dataset identifiers used in producing the derived dataset. Ideally these are the global identifier to existing datasets inside this or federated data catalogs.",
})
Expand All @@ -134,7 +134,7 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto {

@ApiProperty({
type: [String],
required: true,
required: false,
description:
"A list of links to software repositories which uniquely identifies the pieces of software, including versions, used for yielding the derived data.",
})
Expand Down Expand Up @@ -183,6 +183,9 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto {
description:
"Containers that list all files and their attributes which make up a dataset. Usually filled at the time the dataset's metadata is created in the data catalog. Can be used by subsequent archiving processes to create the archived datasets.",
})
@IsOptional()
@IsArray()
@Type(() => OrigDatablock)
origdatablocks?: OrigDatablock[];

@ApiProperty({
Expand All @@ -192,6 +195,9 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto {
description:
"When archiving a dataset, all files contained in the dataset are listed here together with their checksum information. Several datablocks can be created if the file listing is too long for a single datablock. This partitioning decision is done by the archiving system to allow for chunks of datablocks with manageable sizes. E.g a datasets consisting of 10 TB of data could be split into 10 datablocks of about 1 TB each. The upper limit set by the data catalog system itself is given by the fact that documents must be smaller than 16 MB, which typically allows for datasets of about 100000 files.",
})
@IsOptional()
@IsArray()
@Type(() => Datablock)
datablocks?: Datablock[];

@ApiProperty({
Expand All @@ -200,6 +206,7 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto {
description:
"Indicate the user who created this record. This property is added and maintained by the system.",
})
@IsString()
createdBy: string;

@ApiProperty({
Expand All @@ -208,6 +215,7 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto {
description:
"Indicate the user who updated this record last. This property is added and maintained by the system.",
})
@IsString()
updatedBy: string;

@ApiProperty({
Expand All @@ -216,6 +224,7 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto {
description:
"Date and time when this record was created. This field is managed by mongoose with through the timestamp settings. The field should be a string containing a date in ISO 8601 format (2024-02-27T12:26:57.313Z)",
})
@IsDateString()
createdAt: Date;

@ApiProperty({
Expand All @@ -224,5 +233,6 @@ export class OutputDatasetObsoleteDto extends UpdateDatasetObsoleteDto {
description:
"Date and time when this record was updated last. This field is managed by mongoose with through the timestamp settings. The field should be a string containing a date in ISO 8601 format (2024-02-27T12:26:57.313Z)",
})
@IsDateString()
updatedAt: Date;
}
4 changes: 2 additions & 2 deletions src/datasets/dto/update-dataset-obsolete.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ export class UpdateDatasetObsoleteDto extends OwnableDto {
@ApiProperty({
type: Number,
default: 0,
required: true,
required: false,
description: "Total number of files in all Datablocks for this dataset.",
})
@IsOptional()
@IsInt()
readonly numberOfFilesArchived?: number;
readonly numberOfFilesArchived?: number = 0;

@ApiProperty({
type: Date,
Expand Down
25 changes: 16 additions & 9 deletions src/datasets/dto/update-dataset.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { HistoryClass } from "../schemas/history.schema";
export class UpdateDatasetDto extends OwnableDto {
@ApiProperty({
type: String,
required: true,
required: false,
description:
"Owner or custodian of the dataset, usually first name + last name. The string may contain a list of persons, which should then be separated by semicolons.",
})
Expand Down Expand Up @@ -125,7 +125,7 @@ export class UpdateDatasetDto extends OwnableDto {
@ApiProperty({
type: Number,
default: 0,
required: true,
required: false,
description: "Total number of files in all Datablocks for this dataset.",
})
@IsOptional()
Expand All @@ -152,7 +152,8 @@ export class UpdateDatasetDto extends OwnableDto {
readonly validationStatus?: string;

@ApiProperty({
type: [String],
type: String,
isArray: true,
required: false,
description:
"Array of tags associated with the meaning or contents of this dataset. Values should ideally come from defined vocabularies, taxonomies, ontologies or knowledge graphs.",
Expand Down Expand Up @@ -226,7 +227,8 @@ export class UpdateDatasetDto extends OwnableDto {

// it needs to be discussed if this fields is managed by the user or by the system
@ApiProperty({
type: [String],
type: String,
isArray: true,
required: false,
default: [],
description: "List of users that the dataset has been shared with.",
Expand Down Expand Up @@ -342,7 +344,8 @@ export class UpdateDatasetDto extends OwnableDto {
readonly dataFormat?: string;

@ApiProperty({
type: [String],
type: String,
isArray: true,
required: false,
description:
"ID of the proposal or proposals which the dataset belongs to.<br>This dataset might have been acquired under the listed proposals or is derived from datasets acquired from datasets belonging to the listed datasets.",
Expand All @@ -354,7 +357,8 @@ export class UpdateDatasetDto extends OwnableDto {
readonly proposalIds?: string[];

@ApiProperty({
type: [String],
type: String,
isArray: true,
required: false,
description:
"ID of the sample or samples used when collecting the data included or used in this dataset.",
Expand All @@ -367,6 +371,7 @@ export class UpdateDatasetDto extends OwnableDto {

@ApiProperty({
type: String,
isArray: true,
required: false,
description:
"ID of the instrument or instruments where the data included or used in this datasets was collected on.",
Expand All @@ -378,8 +383,9 @@ export class UpdateDatasetDto extends OwnableDto {
readonly instrumentIds?: string[];

@ApiProperty({
type: [String],
required: true,
type: String,
isArray: true,
required: false,
description:
"Array of input dataset identifiers used in producing the derived dataset. Ideally these are the global identifier to existing datasets inside this or federated data catalogs.",
})
Expand All @@ -390,7 +396,8 @@ export class UpdateDatasetDto extends OwnableDto {
readonly inputDatasets?: string[];

@ApiProperty({
type: [String],
type: String,
isArray: true,
required: false,
description:
"A list of links to software repositories which uniquely identifies the pieces of software, including versions, used for yielding the derived data.",
Expand Down
1 change: 0 additions & 1 deletion src/datasets/schemas/dataset.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ApiProperty, getSchemaPath } from "@nestjs/swagger";
import { Document } from "mongoose";
import { OwnableClass } from "src/common/schemas/ownable.schema";
import { v4 as uuidv4 } from "uuid";
import { DatasetType } from "../dataset-type.enum";
import { HistoryClass, HistorySchema } from "./history.schema";
import { LifecycleClass, LifecycleSchema } from "./lifecycle.schema";
import { RelationshipClass, RelationshipSchema } from "./relationship.schema";
Expand Down
1 change: 0 additions & 1 deletion src/proposals/dto/update-proposal.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
IsArray,
IsDateString,
IsEmail,
IsEnum,
IsObject,
IsOptional,
IsString,
Expand Down
2 changes: 1 addition & 1 deletion src/proposals/proposals.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export class ProposalsController {
return false;
}
} catch (error) {
throw new InternalServerErrorException();
throw new InternalServerErrorException(error);
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/samples/samples.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class SamplesController {
return false;
}
} catch (error) {
throw new InternalServerErrorException();
throw new InternalServerErrorException(error);
}
}

Expand Down Expand Up @@ -410,7 +410,6 @@ export class SamplesController {
required: false,
type: String,
// NOTE: This is custom example because the service function metadataKeys expects input like the following.
// eslint-disable-next-line @/quotes
example: '{ "fields": { "metadataKey": "chemical_formula" } }',
})
@ApiResponse({
Expand Down

0 comments on commit c88496a

Please sign in to comment.