You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.0 KiB
TypeScript

import type { CollectionConfig } from "payload";
import { Menu } from "../groups/Menu";
export const MenuItem: CollectionConfig = {
slug: "menu-item",
access: {
read: () => true,
},
admin: {
useAsTitle: "name",
group: Menu,
},
fields: [
{
name: "name",
type: "text",
required: true,
localized: true,
},
{
name: "description",
type: "richText",
localized: true,
},
{
name: "image",
type: "relationship",
relationTo: "media",
},
{
name: "category",
type: "relationship",
relationTo: "menu-category",
},
{
name: "tags",
type: "relationship",
relationTo: "menu-item-tag",
hasMany: true,
},
{
name: "variants",
type: "array",
minRows: 1,
required: true,
fields: [
{
name: "title",
type: "text",
},
{
name: "price",
type: "number",
required: true,
},
],
},
],
};