@ -1,20 +0,0 @@
|
||||
import { CollectionConfig } from 'payload/types';
|
||||
|
||||
const Categories: CollectionConfig = {
|
||||
slug: 'categories',
|
||||
admin: {
|
||||
useAsTitle: 'name',
|
||||
},
|
||||
access: {
|
||||
read: () => true,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'name',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
timestamps: false,
|
||||
}
|
||||
|
||||
export default Categories;
|
22
payload/src/collections/Media.ts
Normal file
22
payload/src/collections/Media.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { CollectionConfig } from "payload/types";
|
||||
|
||||
export const Media: CollectionConfig = {
|
||||
slug: "media",
|
||||
labels: {
|
||||
singular: "Bild",
|
||||
plural: "Bilder",
|
||||
},
|
||||
admin: {},
|
||||
access: {
|
||||
read: (): boolean => true,
|
||||
},
|
||||
upload: {
|
||||
staticURL: "/media",
|
||||
staticDir: "media",
|
||||
|
||||
mimeTypes: ["image/*"],
|
||||
},
|
||||
fields: [],
|
||||
};
|
||||
|
||||
export default Media;
|
@ -3,7 +3,7 @@ import { CollectionConfig } from "payload/types";
|
||||
const Posts: CollectionConfig = {
|
||||
slug: "posts",
|
||||
admin: {
|
||||
defaultColumns: ["title", "author", "category", "tags", "status"],
|
||||
defaultColumns: ["title", "author", "status"],
|
||||
useAsTitle: "title",
|
||||
},
|
||||
access: {
|
||||
@ -14,29 +14,32 @@ const Posts: CollectionConfig = {
|
||||
name: "title",
|
||||
type: "text",
|
||||
},
|
||||
{
|
||||
name: "author",
|
||||
type: "relationship",
|
||||
relationTo: "users",
|
||||
},
|
||||
{
|
||||
name: "publishedDate",
|
||||
type: "date",
|
||||
},
|
||||
{
|
||||
name: "category",
|
||||
type: "relationship",
|
||||
relationTo: "categories",
|
||||
},
|
||||
{
|
||||
name: "tags",
|
||||
type: "relationship",
|
||||
relationTo: "tags",
|
||||
hasMany: true,
|
||||
},
|
||||
|
||||
{
|
||||
name: "content",
|
||||
type: "richText",
|
||||
admin: {
|
||||
elements: ["h2", "h3", "h4", "link", "ol", "ul", "upload"],
|
||||
leaves: ["bold", "italic", "underline"],
|
||||
upload: {
|
||||
collections: {
|
||||
media: {
|
||||
fields: [
|
||||
{
|
||||
name: "imagel",
|
||||
type: "upload",
|
||||
relationTo: "media",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "status",
|
||||
|
@ -1,20 +0,0 @@
|
||||
import { CollectionConfig } from 'payload/types';
|
||||
|
||||
const Tags: CollectionConfig = {
|
||||
slug: 'tags',
|
||||
admin: {
|
||||
useAsTitle: 'name',
|
||||
},
|
||||
access: {
|
||||
read: () => true,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'name',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
timestamps: false,
|
||||
}
|
||||
|
||||
export default Tags;
|
Reference in New Issue
Block a user