feat(blog): add articles collection (simplified — no cross-feature refs)

This commit is contained in:
2026-05-04 22:27:03 +02:00
parent f041ae5473
commit 1d59698ebe
2 changed files with 73 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
import type { CollectionConfig } from "payload";
import { slugifyIfMissing } from "@repo/core-shared/payload";
export const articles: CollectionConfig = {
slug: "articles",
admin: {
useAsTitle: "title",
defaultColumns: ["title", "status", "author", "updatedAt"],
},
hooks: {
beforeChange: [slugifyIfMissing],
},
versions: {
drafts: true,
},
fields: [
{
name: "title",
type: "text",
required: true,
maxLength: 255,
},
{
name: "slug",
type: "text",
unique: true,
admin: {
position: "sidebar",
description: "Auto-generated from title if left empty",
},
},
{
name: "content",
type: "richText",
},
{
name: "status",
type: "select",
options: [
{ label: "Draft", value: "draft" },
{ label: "Published", value: "published" },
],
defaultValue: "draft",
required: true,
admin: {
position: "sidebar",
},
},
// TODO(plan-3): Restore as `relationship → users` once auth feature is migrated.
{
name: "author",
type: "text",
required: true,
admin: {
position: "sidebar",
description:
"Temporary text field; restored to users relationship in Plan 3.",
},
},
// TODO(plan-3): Restore `featuredImage: upload → media` once media feature is migrated.
{
name: "publishedAt",
type: "date",
admin: {
position: "sidebar",
date: {
pickerAppearance: "dayAndTime",
},
},
},
],
};

View File

@@ -0,0 +1 @@
export { articles } from "./collections/articles";