mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Delete labels for highlights when label is deleted
This commit is contained in:
parent
22c604c15b
commit
0d67d0fb90
1 changed files with 7 additions and 3 deletions
|
|
@ -31,6 +31,7 @@ import { createPubSubClient } from '../../datalayer/pubsub'
|
|||
import { AppDataSource } from '../../server'
|
||||
import { getPageById } from '../../elastic/pages'
|
||||
import {
|
||||
deleteLabelForHighlights,
|
||||
deleteLabelInPages,
|
||||
setLabelsForHighlight,
|
||||
updateLabelInPage,
|
||||
|
|
@ -38,6 +39,7 @@ import {
|
|||
} from '../../elastic/labels'
|
||||
import { getHighlightById } from '../../elastic/highlights'
|
||||
import { getLabelsByIds } from '../../services/labels'
|
||||
import { PageContext } from '../../elastic/types'
|
||||
|
||||
export const labelsResolver = authorized<LabelsSuccess, LabelsError>(
|
||||
async (_obj, _params, { claims: { uid }, log }) => {
|
||||
|
|
@ -178,11 +180,13 @@ export const deleteLabelResolver = authorized<
|
|||
}
|
||||
}
|
||||
|
||||
// delete label in elastic pages
|
||||
await deleteLabelInPages(uid, label.name, {
|
||||
const ctx: PageContext = {
|
||||
pubsub: createPubSubClient(),
|
||||
uid,
|
||||
})
|
||||
}
|
||||
// delete label in elastic pages and highlights
|
||||
await deleteLabelInPages(uid, label.name, ctx)
|
||||
await deleteLabelForHighlights(uid, label.name, ctx)
|
||||
|
||||
analytics.track({
|
||||
userId: uid,
|
||||
|
|
|
|||
Loading…
Reference in a new issue