Skip to content

Commit

Permalink
fix(createDatasetDto): datasetName field in the CreateDatasetDto(obso…
Browse files Browse the repository at this point in the history
…letes) should be required (#1574)

* fix(createDatasetDto): datasetName field in the CreateDatasetDto should be required

* added readonly keyword

* remove unused import

* fix lint warnings

* revert error handling

* declare datasetName field in the raw and derived  obsolete createdataset dto
  • Loading branch information
Junjiequan authored Jan 8, 2025
1 parent ed69e40 commit e4ff469
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 6 deletions.
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;
}
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 e4ff469

Please sign in to comment.