diff options
| author | Mohamed Bassem <me@mbassem.com> | 2025-06-21 14:34:09 +0000 |
|---|---|---|
| committer | Mohamed Bassem <me@mbassem.com> | 2025-06-21 14:34:48 +0000 |
| commit | 04f93941ca4d10f09befb4d1b219899ecbe792b1 (patch) | |
| tree | 652aeb2e0fa92674d77e104147195664f0e027c0 /packages | |
| parent | 0f4c616230f570b2323fbc473e6f857b36abd5ba (diff) | |
| download | karakeep-04f93941ca4d10f09befb4d1b219899ecbe792b1.tar.zst | |
fix: Fix webhook not firing on deletion. Fixes #1613
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/shared/queues.ts | 3 | ||||
| -rw-r--r-- | packages/trpc/routers/bookmarks.ts | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/packages/shared/queues.ts b/packages/shared/queues.ts index a434414c..a2fdc6b4 100644 --- a/packages/shared/queues.ts +++ b/packages/shared/queues.ts @@ -173,6 +173,7 @@ export const AssetPreprocessingQueue = export const zWebhookRequestSchema = z.object({ bookmarkId: z.string(), operation: z.enum(["crawled", "created", "edited", "ai tagged", "deleted"]), + userId: z.string().optional(), }); export type ZWebhookRequest = z.infer<typeof zWebhookRequestSchema>; export const WebhookQueue = new SqliteQueue<ZWebhookRequest>( @@ -189,9 +190,11 @@ export const WebhookQueue = new SqliteQueue<ZWebhookRequest>( export async function triggerWebhook( bookmarkId: string, operation: ZWebhookRequest["operation"], + userId?: string, ) { await WebhookQueue.enqueue({ bookmarkId, + userId, operation, }); } diff --git a/packages/trpc/routers/bookmarks.ts b/packages/trpc/routers/bookmarks.ts index 04d15d1f..815cf90d 100644 --- a/packages/trpc/routers/bookmarks.ts +++ b/packages/trpc/routers/bookmarks.ts @@ -646,7 +646,7 @@ export const bookmarksAppRouter = router({ ), ); await triggerSearchDeletion(input.bookmarkId); - await triggerWebhook(input.bookmarkId, "deleted"); + await triggerWebhook(input.bookmarkId, "deleted", ctx.user.id); if (deleted.changes > 0 && bookmark) { await cleanupAssetForBookmark({ asset: bookmark.asset, |
