Skip to content

Commit

Permalink
Merge pull request #1222 from SciCatProject/build(deps)--bump-mongoos…
Browse files Browse the repository at this point in the history
…e-from-8.3.1-to-8.4.0

build(deps): bump mongoose from 8.3.1 to 8.4.0
  • Loading branch information
nitrosx authored May 27, 2024
2 parents 5f237c2 + 8e67903 commit 42f4608
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 31 deletions.
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"luxon": "^3.2.1",
"mathjs": "^12.0.0",
"migrate-mongo": "^11.0.0",
"mongoose": "^8.3.1",
"mongoose": "^8.4.0",
"node-fetch": "^3.3.0",
"nodemailer": "^6.7.8",
"openid-client": "^5.1.8",
Expand Down
18 changes: 6 additions & 12 deletions src/datasets/datasets.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,8 @@ export class DatasetsService {
// insert created and updated fields
addCreatedByFields(createDatasetDto, username),
);
if (this.ESClient) {
await this.ESClient.updateInsertDocument(
createdDataset.toObject() as DatasetDocument,
);
if (this.ESClient && createdDataset) {
await this.ESClient.updateInsertDocument(createdDataset.toObject());
}
return createdDataset.save();
}
Expand Down Expand Up @@ -242,10 +240,8 @@ export class DatasetsService {
throw new NotFoundException(`Dataset #${id} not found`);
}

if (this.ESClient) {
await this.ESClient.updateInsertDocument(
updatedDataset.toObject() as DatasetDocument,
);
if (this.ESClient && updatedDataset) {
await this.ESClient.updateInsertDocument(updatedDataset.toObject());
}
// we were able to find the dataset and update it
return updatedDataset;
Expand Down Expand Up @@ -283,10 +279,8 @@ export class DatasetsService {
)
.exec();

if (this.ESClient) {
await this.ESClient.updateInsertDocument(
patchedDataset?.toObject() as DatasetDocument,
);
if (this.ESClient && patchedDataset) {
await this.ESClient.updateInsertDocument(patchedDataset.toObject());
}

// we were able to find the dataset and update it
Expand Down
2 changes: 1 addition & 1 deletion src/elastic-search/elastic-search.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export class ElasticSearchService implements OnModuleInit {
);
}
}
async updateInsertDocument(data: DatasetDocument) {
async updateInsertDocument(data: Partial<DatasetDocument>) {
//NOTE: Replace all keys with lower case, also replace spaces and dot with underscore
delete data._id;
const transformedScientificMetadata = transformKeysInObject(
Expand Down

0 comments on commit 42f4608

Please sign in to comment.