Signed-off-by: Max Schmidt <max.schmidt@outlook.de>
This commit is contained in:
Max Schmidt
2023-05-15 16:52:29 +02:00
parent a4b119614d
commit 7a57a69259
22 changed files with 1418 additions and 8897 deletions

View File

@ -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;

View 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;

View File

@ -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",

View File

@ -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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 KiB

View File

@ -1,16 +1,15 @@
import { buildConfig } from "payload/config";
import path from "path";
import Categories from "./collections/Categories";
import Posts from "./collections/Posts";
import Tags from "./collections/Tags";
import Users from "./collections/Users";
import Media from "./collections/Media";
export default buildConfig({
serverURL: "http://localhost:3001",
admin: {
user: Users.slug,
},
collections: [Categories, Posts, Tags, Users],
collections: [Posts, Users, Media],
typescript: {
outputFile: path.resolve("/", "types.ts"),
},