Skip to content

Commit

Permalink
* fix(dependency maintenance): update mongoose and typegoose deps (#686)
Browse files Browse the repository at this point in the history
* fix(dependency maintenance): update dependency mongoose to v6

* fix(dependency maintenance): update mongoose deps

* fix: mongoose deleted count

* fix: tag partials

* test: fix early close of db connection

Co-authored-by: Renovate Bot <[email protected]> and James <MeStrak>
  • Loading branch information
MeStrak and Renovate Bot committed Dec 8, 2021
1 parent c3973cd commit b7ab276
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 353 deletions.
461 changes: 123 additions & 338 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
"@nestjs/config": "1.1.5",
"@nestjs/core": "8.2.3",
"@nestjs/graphql": "9.1.2",
"@nestjs/mongoose": "8.0.1",
"@nestjs/mongoose": "9.0.1",
"@nestjs/passport": "8.0.1",
"@nestjs/platform-fastify": "8.2.3",
"@nestjs/platform-socket.io": "8.2.3",
"@nestjs/terminus": "8.0.3",
"@nestjs/websockets": "8.2.3",
"@typegoose/typegoose": "8.3.0",
"@typegoose/typegoose": "9.3.1",
"@types/graphql": "14.5.0",
"amazon-cognito-identity-js": "5.2.3",
"apollo-server-core": "3.5.0",
Expand All @@ -65,7 +65,7 @@
"ioredis": "4.28.2",
"joi": "17.5.0",
"lodash": "4.17.21",
"mongoose": "5.13.13",
"mongoose": "6.0.15",
"mongoose-cast-aggregation": "0.2.1",
"reflect-metadata": "0.1.13",
"request": "2.88.2",
Expand Down
2 changes: 1 addition & 1 deletion src/tag/tag.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class TagController {
@Patch(':id')
@HttpCode(204)
@UsePipes(new ValidationPipe({ whitelist: true }))
async updateTag(@Param('id') id: string, @Body() tag: TagInputType): Promise<ITag> {
async updateTag(@Param('id') id: string, @Body() tag: Partial<ITag>): Promise<ITag> {
return this.tagService.update(id, tag);
}

Expand Down
4 changes: 2 additions & 2 deletions src/tag/tag.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class TagService {
return this.tagModel.findById(id).exec();
}

async update(id: string, tagIn: TagInputType): Promise<ITag> {
async update(id: string, tagIn: Partial<ITag>): Promise<ITag> {
const updatedTag = await this.tagModel.findOneAndUpdate({ _id: id }, tagIn, { new: true }).exec();
this.logger.log(updatedTag, 'Updated Tag');
return updatedTag;
Expand All @@ -44,7 +44,7 @@ export class TagService {
}

async delete(id: string): Promise<boolean> {
const { n: countOfDeletedTagGroups } = await this.tagModel.deleteOne({ _id: id }).exec();
const { deletedCount: countOfDeletedTagGroups } = await this.tagModel.deleteOne({ _id: id }).exec();

return countOfDeletedTagGroups === 1;
}
Expand Down
4 changes: 2 additions & 2 deletions src/tagGroup/tagGroup.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class TagGroupService {
return this.tagGroupModel.findById(id).exec();
}

async update(id: string, tagGroupIn: TagGroupInputType): Promise<ITagGroup> {
async update(id: string, tagGroupIn: Partial<ITagGroup>): Promise<ITagGroup> {
const updatedTagGroup = await this.tagGroupModel.findOneAndUpdate({ _id: id }, tagGroupIn, { new: true }).exec();
this.logger.log(updatedTagGroup, 'Updated TagGroup');
return updatedTagGroup;
Expand All @@ -44,7 +44,7 @@ export class TagGroupService {
}

async delete(id: string): Promise<boolean> {
const { n: countOfDeletedTagGroups } = await this.tagGroupModel.deleteOne({ _id: id }).exec();
const { deletedCount: countOfDeletedTagGroups } = await this.tagGroupModel.deleteOne({ _id: id }).exec();

return countOfDeletedTagGroups === 1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/webhook/webhook.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class WebhookService {
}

async delete(@Param('id') id: string): Promise<boolean> {
const { n: countOfDeletedWebhooks } = await this.webhookModel.deleteOne({ _id: id }).exec();
const { deletedCount: countOfDeletedWebhooks } = await this.webhookModel.deleteOne({ _id: id }).exec();

return countOfDeletedWebhooks === 1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/whisp/whisp.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class WhispService {
}

async delete(id: string): Promise<boolean> {
const { n: countOfDeletedWhisp } = await this.whispModel.deleteOne({ _id: id }).exec();
const { deletedCount: countOfDeletedWhisp } = await this.whispModel.deleteOne({ _id: id }).exec();
if (countOfDeletedWhisp <= 0) {
return false;
}
Expand Down
5 changes: 0 additions & 5 deletions tests/e2e/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,3 @@ beforeAll(async () => {
}
}, 60 * 60 * 1000); // disable timeout so it doesn't start tests if NestJS doesn't start

afterAll(async () => {
if (global.app) {
await Promise.all([global.app.close()]);
}
});

0 comments on commit b7ab276

Please sign in to comment.