diff --git a/src/collections/BackgroundImages/BackgroundImages.ts b/src/collections/BackgroundImages/BackgroundImages.ts new file mode 100644 index 0000000..45d6516 --- /dev/null +++ b/src/collections/BackgroundImages/BackgroundImages.ts @@ -0,0 +1,23 @@ +import { Collections } from "../../constants"; +import { buildImageCollectionConfig } from "../../utils/imageCollectionConfig"; + +const fields = { + filename: "filename", + mimeType: "mimeType", + filesize: "filesize", + posts: "posts", + updatedAt: "updatedAt", +} as const satisfies Record; + +export const BackgroundImages = buildImageCollectionConfig({ + slug: Collections.BackgroundImages, + labels: { + singular: "Background Image", + plural: "Background Images", + }, + admin: { defaultColumns: [fields.filename, fields.posts, fields.updatedAt] }, + upload: { + imageSizes: [], + }, + fields: [], +}); diff --git a/src/collections/Collectibles/Collectibles.ts b/src/collections/Collectibles/Collectibles.ts index f0d4ba9..40a8dc2 100644 --- a/src/collections/Collectibles/Collectibles.ts +++ b/src/collections/Collectibles/Collectibles.ts @@ -201,7 +201,7 @@ export const Collectibles = buildVersionedCollectionConfig({ fields: [ imageField({ name: fields.backgroundImage, - relationTo: Collections.Images, + relationTo: Collections.BackgroundImages, admin: { description: "The image used as background from the webpage.\ diff --git a/src/collections/Pages/Pages.ts b/src/collections/Pages/Pages.ts index 0369bd4..b8a8a74 100644 --- a/src/collections/Pages/Pages.ts +++ b/src/collections/Pages/Pages.ts @@ -92,7 +92,7 @@ export const Pages = buildVersionedCollectionConfig({ }), imageField({ name: fields.backgroundImage, - relationTo: Collections.Images, + relationTo: Collections.BackgroundImages, admin: { description: "The image used as background from the webpage.\ diff --git a/src/constants.ts b/src/constants.ts index 6f0d1a8..1e4c11e 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -32,6 +32,7 @@ export enum Collections { Wordings = "wordings", Collectibles = "collectibles", GenericContents = "generic-contents", + BackgroundImages = "background-images", } export enum CollectionGroups { diff --git a/src/payload.config.ts b/src/payload.config.ts index 514c0b0..b17f940 100644 --- a/src/payload.config.ts +++ b/src/payload.config.ts @@ -2,6 +2,7 @@ import { webpackBundler } from "@payloadcms/bundler-webpack"; import { mongooseAdapter } from "@payloadcms/db-mongodb"; import path from "path"; import { buildConfig } from "payload/config"; +import { BackgroundImages } from "./collections/BackgroundImages/BackgroundImages"; import { ChronologyEras } from "./collections/ChronologyEras/ChronologyEras"; import { ChronologyItems } from "./collections/ChronologyItems/ChronologyItems"; import { Collectibles } from "./collections/Collectibles/Collectibles"; @@ -64,6 +65,7 @@ export default buildConfig({ Wordings, Collectibles, GenericContents, + BackgroundImages, ], db: mongooseAdapter({ url: process.env.MONGODB_URI ?? "mongodb://mongo:27017/payload",