fix readwise syncing error

This commit is contained in:
Hongbo Wu
2024-03-22 16:28:14 +08:00
parent ff78a4b266
commit 6954fffd24
3 changed files with 23 additions and 16 deletions

View File

@ -13,7 +13,7 @@ import { enqueueUpdateHighlight } from '../utils/createTask'
import { deepDelete } from '../utils/helpers'
import { ItemEvent } from './library_item'
const columnToDelete = ['user', 'sharedAt'] as const
const columnToDelete = ['user', 'sharedAt', 'libraryItem'] as const
type ColumnToDeleteType = typeof columnToDelete[number]
export type HighlightEvent = Merge<
Omit<DeepPartial<Highlight>, ColumnToDeleteType>,

View File

@ -184,6 +184,11 @@ export class NotionClient implements IntegrationClient {
settings: Settings,
lastSync?: Date | null
): NotionPage => {
// logger.info('itemToNotionPage', {
// highlights: item.highlights,
// settings,
// lastSync,
// })
return {
parent: {
database_id: settings.parentDatabaseId,

View File

@ -96,21 +96,23 @@ export class ReadwiseClient implements IntegrationClient {
? item.highlights
// filter out highlights that are not of type highlight or have no quote
.filter(isHighlight)
.map((highlight) => ({
text: highlight.quote,
title: item.title,
author: item.author || undefined,
highlight_url: item.slug
? getHighlightUrl(item.slug, highlight.id)
: undefined,
highlighted_at: (highlight.createdAt as Date).toISOString(),
category,
image_url: item.thumbnail || undefined,
location_type: 'order',
note: highlight.annotation || undefined,
source_type: 'omnivore',
source_url: item.originalUrl,
}))
.map((highlight) => {
return {
text: highlight.quote,
title: item.title,
author: item.author || undefined,
highlight_url: item.slug
? getHighlightUrl(item.slug, highlight.id)
: undefined,
highlighted_at: highlight.createdAt as string | undefined,
category,
image_url: item.thumbnail || undefined,
location_type: 'order',
note: highlight.annotation || undefined,
source_type: 'omnivore',
source_url: item.originalUrl,
}
})
: []
}