From ab2032ff0cbac8331b7af3e81e3d0cd541facfb4 Mon Sep 17 00:00:00 2001 From: DrMint <29893320+DrMint@users.noreply.github.com> Date: Thu, 16 May 2024 20:35:26 +0200 Subject: [PATCH] Removed tags --- src/collections/Audios/Audios.ts | 3 -- src/collections/Collectibles/Collectibles.ts | 3 -- src/collections/Images/Images.ts | 3 -- src/collections/Pages/Pages.ts | 4 --- src/collections/Videos/Videos.ts | 3 -- src/fields/tagsField/tagsField.ts | 17 --------- src/types/collections.ts | 37 +++++++++----------- 7 files changed, 16 insertions(+), 54 deletions(-) delete mode 100644 src/fields/tagsField/tagsField.ts diff --git a/src/collections/Audios/Audios.ts b/src/collections/Audios/Audios.ts index f746d24..22ff29a 100644 --- a/src/collections/Audios/Audios.ts +++ b/src/collections/Audios/Audios.ts @@ -3,7 +3,6 @@ import { attributesField } from "../../fields/attributesField/attributesField"; import { creditsField } from "../../fields/creditsField/creditsField"; import { imageField } from "../../fields/imageField/imageField"; import { rowField } from "../../fields/rowField/rowField"; -import { tagsField } from "../../fields/tagsField/tagsField"; import { translatedFields } from "../../fields/translatedFields/translatedFields"; import { buildCollectionConfig } from "../../utils/collectionConfig"; import { createEditor } from "../../utils/editor"; @@ -21,7 +20,6 @@ const fields = { translationsDescription: "description", thumbnail: "thumbnail", duration: "duration", - tags: "tags", attributes: "attributes", credits: "credits", }; @@ -73,7 +71,6 @@ export const Audios = buildCollectionConfig({ }, ], }), - tagsField({ name: fields.tags }), attributesField({ name: fields.attributes }), creditsField({ name: fields.credits }), ], diff --git a/src/collections/Collectibles/Collectibles.ts b/src/collections/Collectibles/Collectibles.ts index b387c93..e3c5fc4 100644 --- a/src/collections/Collectibles/Collectibles.ts +++ b/src/collections/Collectibles/Collectibles.ts @@ -14,7 +14,6 @@ import { creditsField } from "../../fields/creditsField/creditsField"; import { imageField } from "../../fields/imageField/imageField"; import { rowField } from "../../fields/rowField/rowField"; import { slugField } from "../../fields/slugField/slugField"; -import { tagsField } from "../../fields/tagsField/tagsField"; import { translatedFields } from "../../fields/translatedFields/translatedFields"; import { beforeDuplicateAddCopyTo } from "../../hooks/beforeDuplicateAddCopyTo"; import { beforeDuplicatePiping } from "../../hooks/beforeDuplicatePiping"; @@ -34,7 +33,6 @@ const fields = { thumbnail: "thumbnail", backgroundImage: "backgroundImage", nature: "nature", - tags: "tags", attributes: "attributes", languages: "languages", @@ -190,7 +188,6 @@ export const Collectibles = buildVersionedCollectionConfig({ }, ]), - tagsField({ name: fields.tags }), attributesField({ name: fields.attributes }), translatedFields({ diff --git a/src/collections/Images/Images.ts b/src/collections/Images/Images.ts index f87991b..bc9307b 100644 --- a/src/collections/Images/Images.ts +++ b/src/collections/Images/Images.ts @@ -2,7 +2,6 @@ import { Collections } from "../../constants"; import { attributesField } from "../../fields/attributesField/attributesField"; import { creditsField } from "../../fields/creditsField/creditsField"; import { rowField } from "../../fields/rowField/rowField"; -import { tagsField } from "../../fields/tagsField/tagsField"; import { translatedFields } from "../../fields/translatedFields/translatedFields"; import { createEditor } from "../../utils/editor"; import { buildImageCollectionConfig } from "../../utils/imageCollectionConfig"; @@ -19,7 +18,6 @@ const fields = { translationsTitle: "title", translationsSubtitle: "subtitle", translationsDescription: "description", - tags: "tags", attributes: "attributes", credits: "credits", } as const satisfies Record; @@ -65,7 +63,6 @@ export const Images = buildImageCollectionConfig({ }, ], }), - tagsField({ name: fields.tags }), attributesField({ name: fields.attributes }), creditsField({ name: fields.credits }), ], diff --git a/src/collections/Pages/Pages.ts b/src/collections/Pages/Pages.ts index 394eda4..d091a41 100644 --- a/src/collections/Pages/Pages.ts +++ b/src/collections/Pages/Pages.ts @@ -10,7 +10,6 @@ import { creditsField } from "../../fields/creditsField/creditsField"; import { imageField } from "../../fields/imageField/imageField"; import { rowField } from "../../fields/rowField/rowField"; import { slugField } from "../../fields/slugField/slugField"; -import { tagsField } from "../../fields/tagsField/tagsField"; import { translatedFields } from "../../fields/translatedFields/translatedFields"; import { beforeDuplicateAddCopyTo } from "../../hooks/beforeDuplicateAddCopyTo"; import { beforeDuplicatePiping } from "../../hooks/beforeDuplicatePiping"; @@ -24,7 +23,6 @@ const fields = { thumbnail: "thumbnail", backgroundImage: "backgroundImage", translations: "translations", - tags: "tags", attributes: "attributes", sourceLanguage: "sourceLanguage", pretitle: "pretitle", @@ -50,7 +48,6 @@ export const Pages = buildVersionedCollectionConfig({ fields.slug, fields.thumbnail, fields.backgroundImage, - fields.tags, fields.translations, fields.folders, ], @@ -90,7 +87,6 @@ export const Pages = buildVersionedCollectionConfig({ }, }), ]), - tagsField({ name: fields.tags }), attributesField({ name: fields.attributes }), translatedFields({ name: fields.translations, diff --git a/src/collections/Videos/Videos.ts b/src/collections/Videos/Videos.ts index ff47178..5ca502a 100644 --- a/src/collections/Videos/Videos.ts +++ b/src/collections/Videos/Videos.ts @@ -4,7 +4,6 @@ import { componentField } from "../../fields/componentField/componentField"; import { creditsField } from "../../fields/creditsField/creditsField"; import { imageField } from "../../fields/imageField/imageField"; import { rowField } from "../../fields/rowField/rowField"; -import { tagsField } from "../../fields/tagsField/tagsField"; import { translatedFields } from "../../fields/translatedFields/translatedFields"; import { buildCollectionConfig } from "../../utils/collectionConfig"; import { createEditor } from "../../utils/editor"; @@ -23,7 +22,6 @@ const fields = { translationsSubfile: "subfile", thumbnail: "thumbnail", duration: "duration", - tags: "tags", attributes: "attributes", platform: "platform", platformChannel: "channel", @@ -88,7 +86,6 @@ export const Videos = buildCollectionConfig({ }, ], }), - tagsField({ name: fields.tags }), attributesField({ name: fields.attributes }), creditsField({ name: fields.credits }), componentField({ diff --git a/src/fields/tagsField/tagsField.ts b/src/fields/tagsField/tagsField.ts deleted file mode 100644 index 2fe52f6..0000000 --- a/src/fields/tagsField/tagsField.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { FieldBase, SingleRelationshipField } from "payload/dist/fields/config/types"; -import { Collections } from "../../constants"; - -type KeysField = FieldBase & { - admin?: SingleRelationshipField["admin"]; -}; - -export const tagsField = ({ admin, ...props }: KeysField): SingleRelationshipField => ({ - ...props, - admin: { - allowCreate: false, - ...admin, - }, - type: "relationship", - hasMany: true, - relationTo: Collections.Tags, -}); diff --git a/src/types/collections.ts b/src/types/collections.ts index 61a0d75..9c5df6d 100644 --- a/src/types/collections.ts +++ b/src/types/collections.ts @@ -55,7 +55,6 @@ export interface Page { slug: string; thumbnail?: string | Image | null; backgroundImage?: string | Image | null; - tags?: (string | Tag)[] | null; attributes?: (TagsBlock | NumberBlock | TextBlock)[] | null; translations: { language: string | Language; @@ -133,7 +132,6 @@ export interface Image { id?: string | null; }[] | null; - tags?: (string | Tag)[] | null; attributes?: (TagsBlock | NumberBlock | TextBlock)[] | null; credits?: Credits; updatedAt: string; @@ -171,22 +169,6 @@ export interface Language { id: string; name: string; } -/** - * This interface was referenced by `Config`'s JSON-Schema - * via the `definition` "tags". - */ -export interface Tag { - id: string; - slug: string; - page?: (string | null) | Page; - translations: { - language: string | Language; - name: string; - id?: string | null; - }[]; - updatedAt: string; - createdAt: string; -} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "TagsBlock". @@ -215,6 +197,22 @@ export interface Attribute { updatedAt: string; createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "tags". + */ +export interface Tag { + id: string; + slug: string; + page?: (string | null) | Page; + translations: { + language: string | Language; + name: string; + id?: string | null; + }[]; + updatedAt: string; + createdAt: string; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "NumberBlock". @@ -373,7 +371,6 @@ export interface Collectible { thumbnail?: string | Image | null; nature: "Physical" | "Digital"; languages?: (string | Language)[] | null; - tags?: (string | Tag)[] | null; attributes?: (TagsBlock | NumberBlock | TextBlock)[] | null; translations: { language: string | Language; @@ -638,7 +635,6 @@ export interface Audio { } | null; id?: string | null; }[]; - tags?: (string | Tag)[] | null; attributes?: (TagsBlock | NumberBlock | TextBlock)[] | null; credits?: Credits; updatedAt: string; @@ -714,7 +710,6 @@ export interface Video { subfile?: string | VideoSubtitle | null; id?: string | null; }[]; - tags?: (string | Tag)[] | null; attributes?: (TagsBlock | NumberBlock | TextBlock)[] | null; credits?: Credits; platformEnabled?: boolean | null;