import mongoose from "mongoose";
const Category = mongoose.model("Category",mongoose.Schema({
name:{
type:String,
required:true
},
top:Boolean,
childs:[
{type:mongoose.Schema.Types.ObjectId,ref:"Category"}
]
},{versionKey: false}))
export default Category;
import mongoose from "mongoose";
const MenuItem = mongoose.model("MenuItem",mongoose.Schema({
name:{
type:String,
required:true
},
category:{
type:mongoose.Schema.Types.ObjectId,
ref:"Category",
required:true
},
image:{
type:String,
default: 'https://image.freepik.com/free-vector/hand-drawn-food-elements_1411-48.jpg'
},
description:{
type:String,
required:true
},
variants:[
{
price:Number,
size:String,
_id: false
}
]
},{versionKey: false}))
export default MenuItem;