From e695ef9c18fa3141b5f873016d3d503798e4b460 Mon Sep 17 00:00:00 2001 From: am9zZWY <46693545+am9zZWY@users.noreply.github.com> Date: Fri, 28 Jun 2024 16:58:53 +0200 Subject: [PATCH] Remove dietary restriction --- src/app/api/manage/db/prepare/route.ts | 20 ++++++++++---------- src/model/food.ts | 6 ++---- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/app/api/manage/db/prepare/route.ts b/src/app/api/manage/db/prepare/route.ts index 8996d8f..3cd32b3 100644 --- a/src/app/api/manage/db/prepare/route.ts +++ b/src/app/api/manage/db/prepare/route.ts @@ -42,16 +42,16 @@ export async function POST() { // Add pizzas const pizzas = [ - { name: 'Salami half', price: 4, type: 'pizza', ingredients: pizza_by_name('Salami'), size: 0.5 }, - { name: 'Salami full', price: 8, type: 'pizza', ingredients: pizza_by_name('Salami'), size: 1 }, - { name: 'Ham and mushrooms half', price: 4, type: 'pizza', ingredients: pizza_by_name('Ham and mushrooms'), size: 0.5 }, - { name: 'Ham and mushrooms full', price: 8, type: 'pizza', ingredients: pizza_by_name('Ham and mushrooms'), size: 1 }, - { name: 'Capriccosa half', price: 4, type: 'pizza', ingredients: pizza_by_name('Capriccosa'), size: 0.5 }, - { name: 'Capriccosa full', price: 8, type: 'pizza', ingredients: pizza_by_name('Capriccosa'), size: 1 }, - { name: 'Margherita half', price: 3, dietary: 'vegetarian', type: 'pizza', ingredients: pizza_by_name('Margherita'), size: 0.5 }, - { name: 'Margherita full', price: 6, dietary: 'vegetarian', type: 'pizza', ingredients: pizza_by_name('Margherita'), size: 1 }, - { name: 'Veggies half', price: 3, dietary: 'vegetarian', type: 'pizza', ingredients: pizza_by_name('Veggies'), size: 0.5 }, - { name: 'Veggies full', price: 6, dietary: 'vegetarian', type: 'pizza', ingredients: pizza_by_name('Veggies'), size: 1 }, + { name: 'Salami half', price: 4, dietary: 'meat', type: 'pizza', ingredients: pizza_by_name('Salami'), size: 0.5 }, + { name: 'Salami full', price: 8, dietary: 'meat', type: 'pizza', ingredients: pizza_by_name('Salami'), size: 1 }, + { name: 'Ham and mushrooms half', price: 4, dietary: 'meat', type: 'pizza', ingredients: pizza_by_name('Ham and mushrooms'), size: 0.5 }, + { name: 'Ham and mushrooms full', price: 8, dietary: 'meat', type: 'pizza', ingredients: pizza_by_name('Ham and mushrooms'), size: 1 }, + { name: 'Capriccosa half', price: 4, type: 'pizza', dietary: 'meat', ingredients: pizza_by_name('Capriccosa'), size: 0.5 }, + { name: 'Capriccosa full', price: 8, type: 'pizza', dietary: 'meat', ingredients: pizza_by_name('Capriccosa'), size: 1 }, + { name: 'Margherita half', price: 3, type: 'pizza', ingredients: pizza_by_name('Margherita'), size: 0.5 }, + { name: 'Margherita full', price: 6, type: 'pizza', ingredients: pizza_by_name('Margherita'), size: 1 }, + { name: 'Veggies half', price: 3, type: 'pizza', ingredients: pizza_by_name('Veggies'), size: 0.5 }, + { name: 'Veggies full', price: 6, type: 'pizza', ingredients: pizza_by_name('Veggies'), size: 1 }, { name: 'Margherita vegan half', price: 3, dietary: 'vegan', type: 'pizza', ingredients: pizza_by_name('Margherita vegan'), size: 0.5 }, { name: 'Margherita vegan full', price: 6, dietary: 'vegan', type: 'pizza', ingredients: pizza_by_name('Margherita vegan'), size: 1 }, { name: 'Capriccosa vegan half', price: 3, dietary: 'vegan', type: 'pizza', ingredients: pizza_by_name('Capriccosa vegan'), size: 0.5 }, diff --git a/src/model/food.ts b/src/model/food.ts index 79d018f..7bf25ab 100644 --- a/src/model/food.ts +++ b/src/model/food.ts @@ -7,9 +7,9 @@ export interface FoodDocument extends Document { name: string; price: number; // Type of food - type: 'pizza' | 'drink' | 'dessert'; + type: string; // Dietary requirements - dietary?: 'vegan' | 'vegetarian' | 'gluten-free' | 'lactose-free' | 'halal' | 'kosher' | 'organic'; + dietary?: string; // Size, e.g., 0.5 for half a pizza size: number ingredients: string[]; @@ -30,12 +30,10 @@ const foodSchema = new Schema({ }, type: { type: String, - enum: ['pizza', 'grill'], required: true }, dietary: { type: String, - enum: ['vegan', 'vegetarian', 'gluten-free', 'lactose-free', 'halal', 'kosher', 'organic'], required: false }, size: {