104 lines
2.4 KiB
TypeScript

import { CollectionConfig } from "payload";
export const Ingredients: CollectionConfig = {
slug: 'ingredients',
admin: {
useAsTitle: 'name',
},
fields: [
{
name: 'name',
type: 'text',
unique: true,
},
{
name: 'description',
type: 'textarea',
},
{
type: 'row',
fields: [
{
name: 'calories',
type: 'number',
admin: {
description: 'per 100g',
width: '25%',
}
},
{
name: 'protein',
type: 'number',
admin: {
description: 'per 100g',
width: '25%',
}
},
{
name: 'carbohydrates',
type: 'number',
admin: {
description: 'per 100g',
width: '25%',
}
},
{
name: 'fat',
type: 'number',
admin: {
description: 'per 100g',
width: '25%',
}
},
],
},
{
type: 'row',
fields: [
{
name: 'canBeKosher',
type: 'checkbox',
admin: {
description: 'Is capable of being vertified Kosher. Not a declaration that ingredient is Kosher.',
width: '20%',
},
},
{
name: 'canBeHalal',
type: 'checkbox',
admin: {
description: 'Is capable of being vertified Halal. Not a declaration that ingredient is Halal.',
width: '20%',
},
},
{
name: 'canBeVegan',
type: 'checkbox',
admin: {
description: 'Is capable of being vertified Vegan. Not a declaration that ingredient is Vegan.',
width: '20%',
},
},
{
name: 'canBeVegetarian',
type: 'checkbox',
admin: {
description: 'Is capable of being vertified Vegetarian. Not a declaration that ingredient is Vegetarian.',
width: '20%',
},
},
{
name: 'canBeGlutenFree',
type: 'checkbox',
admin: {
description: 'Is capable of being vertified Gluten Free. Not a declaration that ingredient is Gluten Free.',
width: '20%',
},
},
],
},
// TODO: Add Relationship to Common Allergens
],
}