From 97ca2c3d3e8fbb44d5e406b56f2b6223ad59e443 Mon Sep 17 00:00:00 2001 From: DrMint <29893320+DrMint@users.noreply.github.com> Date: Sat, 13 Jul 2024 23:56:50 +0200 Subject: [PATCH] Added slug to certain types of collection in webhook message --- payload/webhooks.ts | 53 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/payload/webhooks.ts b/payload/webhooks.ts index fc24bc8..1633ab0 100644 --- a/payload/webhooks.ts +++ b/payload/webhooks.ts @@ -1,8 +1,51 @@ import type { Collections } from "./constants"; export type AfterOperationWebHookMessage = { - collection: Collections; - id?: string; - addedDependantIds: string[]; - urls: string[]; - }; \ No newline at end of file + operation: "update" | "create" | "delete"; + addedDependantIds: string[]; + urls: string[]; +} & ( + | { + collection: Collections.WebsiteConfig; + } + | { + collection: Collections.Pages; + id: string; + slug: string; + } + | { + collection: Collections.Collectibles; + id: string; + slug: string; + } + | { + collection: Collections.Folders; + id: string; + slug: string; + } + | { + collection: + | Collections.Attributes + | Collections.Audios + | Collections.ChronologyEvents + // | Collections.Collectibles + | Collections.CreditsRole + | Collections.Currencies + | Collections.Files + // | Collections.Folders + | Collections.GenericContents + | Collections.Images + | Collections.Languages + | Collections.MediaThumbnails + // | Collections.Pages + | Collections.Recorders + | Collections.Scans + | Collections.Tags + | Collections.Videos + | Collections.VideosChannels + | Collections.VideosSubtitles + | Collections.Wordings + // | Collections.WebsiteConfig; + id: string; + } +);