From 11558e481f023f5123431dc337d3099a2cb39d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Garapich?= Date: Thu, 5 Aug 2021 11:32:56 +0200 Subject: [PATCH] fix(twitch.tv): fix disconnecting the profile --- src/plugins/twitch/services/twitch.service.spec.ts | 4 ++-- src/plugins/twitch/services/twitch.service.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/twitch/services/twitch.service.spec.ts b/src/plugins/twitch/services/twitch.service.spec.ts index e05726e2d..dafeab1f2 100644 --- a/src/plugins/twitch/services/twitch.service.spec.ts +++ b/src/plugins/twitch/services/twitch.service.spec.ts @@ -244,7 +244,7 @@ describe('TwitchService', () => { // @ts-expect-error player = await playersService._createOne(); await twitchTvProfileModel.create({ - player: player.id, + player: player._id, userId: '44322889', login: 'dallas', displayName: 'dallas', @@ -254,7 +254,7 @@ describe('TwitchService', () => { }); it('should return the deleted twitch.tv profile', async () => { - const profile = await service.deleteUserProfile(player.id); + const profile = await service.deleteUserProfile(`${player.id}`); expect(profile.player).toEqual(player.id); }); diff --git a/src/plugins/twitch/services/twitch.service.ts b/src/plugins/twitch/services/twitch.service.ts index 03d40a906..5e07c497a 100644 --- a/src/plugins/twitch/services/twitch.service.ts +++ b/src/plugins/twitch/services/twitch.service.ts @@ -130,7 +130,7 @@ export class TwitchService implements OnModuleInit { const ret = plainToClass( TwitchTvProfile, await this.twitchTvProfileModel - .findOneAndDelete({ player: playerId }) + .findOneAndDelete({ player: new ObjectId(playerId) }) .orFail() .lean() .exec(),