feat(core): delete all readwise highlights when disconnect (#10975)

close AF-2306
This commit is contained in:
CatsJuice
2025-03-20 23:20:58 +00:00
parent e37328c83b
commit fbcb313de8
3 changed files with 30 additions and 5 deletions
@@ -224,6 +224,23 @@ export class ReadwiseIntegration extends Entity<{ writer: IntegrationWriter }> {
token: undefined,
updateStrategy: undefined,
syncNewHighlights: undefined,
lastImportedAt: undefined,
});
}
/**
* Delete all highlights of current user in current workspace
*/
async deleteAll() {
const refs = await this.getRefs();
await Promise.all(
refs.map(ref => {
const doc = this.docsService.list.doc$(ref.id).value;
if (doc) {
doc.moveToTrash();
}
return this.integrationRefStore.deleteRef(ref.id);
})
);
}
}