From 8a819de41e925e7d1ab935819855a29b525e92d3 Mon Sep 17 00:00:00 2001 From: DrMint <29893320+DrMint@users.noreply.github.com> Date: Fri, 1 Mar 2024 23:42:03 +0100 Subject: [PATCH] Fixup for bug with generated type --- src/collections/Pages/Pages.ts | 3 ++- src/collections/Posts/Posts.ts | 3 ++- src/constants.ts | 15 ++++++++++++++- src/payload.config.ts | 2 +- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/collections/Pages/Pages.ts b/src/collections/Pages/Pages.ts index fd8dd64..8afced5 100644 --- a/src/collections/Pages/Pages.ts +++ b/src/collections/Pages/Pages.ts @@ -1,5 +1,6 @@ import { Where } from "payload/types"; import { sectionBlock } from "../../blocks/sectionBlock"; +import { transcriptBlock } from "../../blocks/transcriptBlock"; import { QuickFilters, publishStatusFilters } from "../../components/QuickFilters"; import { CollectionGroups, Collections, PageType } from "../../constants"; import { backPropagationField } from "../../fields/backPropagationField/backPropagationField"; @@ -121,7 +122,7 @@ export const Pages = buildVersionedCollectionConfig({ images: true, inlines: true, alignment: true, - blocks: [sectionBlock], + blocks: [sectionBlock, transcriptBlock], links: true, lists: true, }), diff --git a/src/collections/Posts/Posts.ts b/src/collections/Posts/Posts.ts index b3c9533..14bff1e 100644 --- a/src/collections/Posts/Posts.ts +++ b/src/collections/Posts/Posts.ts @@ -1,4 +1,5 @@ import { sectionBlock } from "../../blocks/sectionBlock"; +import { transcriptBlock } from "../../blocks/transcriptBlock"; import { QuickFilters, publishStatusFilters } from "../../components/QuickFilters"; import { CollectionGroups, Collections, KeysTypes } from "../../constants"; import { imageField } from "../../fields/imageField/imageField"; @@ -100,7 +101,7 @@ export const Posts = buildVersionedCollectionConfig({ images: true, inlines: true, alignment: true, - blocks: [sectionBlock], + blocks: [sectionBlock, transcriptBlock], links: true, lists: true, }), diff --git a/src/constants.ts b/src/constants.ts index 5736418..0451548 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,4 +1,4 @@ -import { CueBlock, LineBlock, SectionBlock, TranscriptBlock } from "./types/collections"; +import type { CueBlock, LineBlock, SectionBlock, TranscriptBlock } from "./types/collections"; // END MOCKING SECTION @@ -243,7 +243,20 @@ export const isBlockNodeTranscriptBlock = ( /* BLOCKS */ +/* TODO: TO BE REMOVED WHEN https://github.com/payloadcms/payload/issues/5216 is closed */ +export interface CueBlock { + id?: string | null; + blockName?: string | null; +} + +export interface LineBlock { + id?: string | null; + blockName?: string | null; +} + export interface GenericBlock { + id?: string | null; + blockName?: string | null; content: unknown; blockType: string; } diff --git a/src/payload.config.ts b/src/payload.config.ts index 72be5a2..432e042 100644 --- a/src/payload.config.ts +++ b/src/payload.config.ts @@ -77,7 +77,7 @@ export default buildConfig({ Keys, Tags, TagsGroups, - Images + Images, ], db: mongooseAdapter({ url: process.env.MONGODB_URI ?? "mongodb://mongo:27017/payload",