feat(blog): add articles collection (simplified — no cross-feature refs)
This commit is contained in:
72
packages/blog/src/integrations/cms/collections/articles.ts
Normal file
72
packages/blog/src/integrations/cms/collections/articles.ts
Normal 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",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
1
packages/blog/src/integrations/cms/index.ts
Normal file
1
packages/blog/src/integrations/cms/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { articles } from "./collections/articles";
|
||||||
Reference in New Issue
Block a user