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

fix(createDatasetDto): datasetName field in the CreateDatasetDto(obsoletes) should be required #1574

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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/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-dataset.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,13 @@ export class CreateDatasetDto extends UpdateDatasetDto {
})
@IsString()
readonly type: string;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Junjiequan I think that the UpdateDatasetDto includes this already and the CreateDatasetDto is just an extension of the Update one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I have mistyped. It should be update-dataset-obsolete.dto.ts

@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
5 changes: 4 additions & 1 deletion src/instruments/instruments.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,13 @@ export class InstrumentsController {
updateInstrumentDto,
);
return instrument;
} catch (e) {
} catch (error) {
throw new HttpException(
"Instrument with the same unique name already exists",
HttpStatus.BAD_REQUEST,
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reverted it, let's use what you have done there, I can leave a comment there.
The rest should be fine

cause: error,
},
);
}
}
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
Loading