From 3e91f3836b40f2a0f3769b951571fc22a2fdd94b Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Mon, 9 Oct 2023 12:25:37 +0800 Subject: [PATCH] fix tests --- packages/api/src/services/integrations/readwise.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/api/src/services/integrations/readwise.ts b/packages/api/src/services/integrations/readwise.ts index f111599a8..0c6676ebd 100644 --- a/packages/api/src/services/integrations/readwise.ts +++ b/packages/api/src/services/integrations/readwise.ts @@ -65,7 +65,9 @@ export class ReadwiseIntegration extends IntegrationService { let result = true const highlights = await Promise.all( - items.map((item) => this.libraryItemToReadwiseHighlight(item)) + items.map((item) => + this.libraryItemToReadwiseHighlight(item, integration.user.id) + ) ) // If there are no highlights, we will skip the sync if (highlights.length > 0) { @@ -87,11 +89,12 @@ export class ReadwiseIntegration extends IntegrationService { } libraryItemToReadwiseHighlight = async ( - item: LibraryItem + item: LibraryItem, + userId: string ): Promise => { let highlights = item.highlights if (!highlights) { - highlights = await findHighlightsByLibraryItemId(item.id, item.user.id) + highlights = await findHighlightsByLibraryItemId(item.id, userId) } const category = item.siteName === 'Twitter' ? 'tweets' : 'articles'