feat(cms): migrate from directus to payloadcms
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 4s
Build & Deploy / 🧪 QA (push) Successful in 2m55s
Build & Deploy / 🏗️ Build (push) Successful in 11m40s
Build & Deploy / 🚀 Deploy (push) Failing after 8s
Build & Deploy / 🩺 Health Check (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 1s

This commit is contained in:
2026-02-27 12:56:35 +01:00
parent fb87fd52f7
commit 55cb073a6d
31 changed files with 8104 additions and 563 deletions

View File

@@ -0,0 +1,44 @@
import type { CollectionConfig } from "payload";
export const FormSubmissions: CollectionConfig = {
slug: "form-submissions",
admin: {
useAsTitle: "name",
defaultColumns: ["name", "email", "company", "createdAt"],
description: "Captured leads from Contact Form.",
},
access: {
read: ({ req: { user } }) =>
Boolean(user) || process.env.NODE_ENV === "development",
update: ({ req: { user } }) =>
Boolean(user) || process.env.NODE_ENV === "development",
delete: ({ req: { user } }) =>
Boolean(user) || process.env.NODE_ENV === "development",
create: () => false, // Only system creates submissions
},
fields: [
{
name: "name",
type: "text",
required: true,
admin: { readOnly: true },
},
{
name: "email",
type: "email",
required: true,
admin: { readOnly: true },
},
{
name: "company",
type: "text",
admin: { readOnly: true },
},
{
name: "message",
type: "textarea",
required: true,
admin: { readOnly: true },
},
],
};

View File

@@ -0,0 +1,42 @@
import type { CollectionConfig } from "payload";
import path from "path";
import { fileURLToPath } from "url";
const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename);
export const Media: CollectionConfig = {
slug: "media",
admin: {
useAsTitle: "filename",
defaultColumns: ["filename", "alt", "updatedAt"],
},
access: {
read: () => true, // Publicly readable
},
upload: {
staticDir: path.resolve(dirname, "../../../public/media"),
adminThumbnail: "thumbnail",
imageSizes: [
{
name: "thumbnail",
width: 400,
height: 300,
position: "centre",
},
{
name: "card",
width: 768,
height: undefined,
position: "centre",
},
],
},
fields: [
{
name: "alt",
type: "text",
required: true,
},
],
};

View File

@@ -0,0 +1,42 @@
import { CollectionConfig } from "payload";
import { lexicalEditor, BlocksFeature } from "@payloadcms/richtext-lexical";
import { payloadBlocks } from "../blocks/allBlocks";
export const Pages: CollectionConfig = {
slug: "pages",
admin: {
useAsTitle: "title",
defaultColumns: ["title", "slug", "updatedAt"],
},
access: {
read: () => true, // Publicly readable
},
fields: [
{
name: "title",
type: "text",
required: true,
},
{
name: "slug",
type: "text",
required: true,
admin: {
position: "sidebar",
},
},
{
name: "content",
type: "richText",
editor: lexicalEditor({
features: ({ defaultFeatures }) => [
...defaultFeatures,
BlocksFeature({
blocks: payloadBlocks,
}),
],
}),
required: true,
},
],
};

View File

@@ -0,0 +1,12 @@
import type { CollectionConfig } from "payload";
export const Users: CollectionConfig = {
slug: "users",
admin: {
useAsTitle: "email",
},
auth: true,
fields: [
// Email added by default
],
};