Added background images collection

This commit is contained in:
DrMint 2024-03-10 21:59:12 +01:00
parent f007560f4d
commit 7b97bd77c1
5 changed files with 28 additions and 2 deletions

View File

@ -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<string, string>;
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: [],
});

View File

@ -201,7 +201,7 @@ export const Collectibles = buildVersionedCollectionConfig({
fields: [ fields: [
imageField({ imageField({
name: fields.backgroundImage, name: fields.backgroundImage,
relationTo: Collections.Images, relationTo: Collections.BackgroundImages,
admin: { admin: {
description: description:
"The image used as background from the webpage.\ "The image used as background from the webpage.\

View File

@ -92,7 +92,7 @@ export const Pages = buildVersionedCollectionConfig({
}), }),
imageField({ imageField({
name: fields.backgroundImage, name: fields.backgroundImage,
relationTo: Collections.Images, relationTo: Collections.BackgroundImages,
admin: { admin: {
description: description:
"The image used as background from the webpage.\ "The image used as background from the webpage.\

View File

@ -32,6 +32,7 @@ export enum Collections {
Wordings = "wordings", Wordings = "wordings",
Collectibles = "collectibles", Collectibles = "collectibles",
GenericContents = "generic-contents", GenericContents = "generic-contents",
BackgroundImages = "background-images",
} }
export enum CollectionGroups { export enum CollectionGroups {

View File

@ -2,6 +2,7 @@ import { webpackBundler } from "@payloadcms/bundler-webpack";
import { mongooseAdapter } from "@payloadcms/db-mongodb"; import { mongooseAdapter } from "@payloadcms/db-mongodb";
import path from "path"; import path from "path";
import { buildConfig } from "payload/config"; import { buildConfig } from "payload/config";
import { BackgroundImages } from "./collections/BackgroundImages/BackgroundImages";
import { ChronologyEras } from "./collections/ChronologyEras/ChronologyEras"; import { ChronologyEras } from "./collections/ChronologyEras/ChronologyEras";
import { ChronologyItems } from "./collections/ChronologyItems/ChronologyItems"; import { ChronologyItems } from "./collections/ChronologyItems/ChronologyItems";
import { Collectibles } from "./collections/Collectibles/Collectibles"; import { Collectibles } from "./collections/Collectibles/Collectibles";
@ -64,6 +65,7 @@ export default buildConfig({
Wordings, Wordings,
Collectibles, Collectibles,
GenericContents, GenericContents,
BackgroundImages,
], ],
db: mongooseAdapter({ db: mongooseAdapter({
url: process.env.MONGODB_URI ?? "mongodb://mongo:27017/payload", url: process.env.MONGODB_URI ?? "mongodb://mongo:27017/payload",