Open hjordynf opened 1 year ago
heres the code
const mongoose = require("mongoose");
const AddUnitSchema = new mongoose.Schema({ item:{ type: String, enum: ['Meat','Poultry','Vegetables','Fruit'], required: true, }, storeInFridge:{ type: String, enum: ['Yes','No','Deep Fridge'], required: true, }, purchaseDate:{ type: Number, purchaseDate: Date, required: true, }, expiryDate:{ type: Number, expirationDate: Date, required: true, }, amountOfItem:{ amount:{ type: Number, required: true, }, unit:{ type: String, enum: ['Kg','Lbs','actual item'], required: true, }, }, })
const AddUnitModel = mongoose.model("Add Unit", AddUnitSchema); module.exports = AddUnitModel;
still need to implement into mongodb
Looks good, I will test in postman at some point
heres the code
const mongoose = require("mongoose");
const AddUnitSchema = new mongoose.Schema({ item:{ type: String, enum: ['Meat','Poultry','Vegetables','Fruit'], required: true, }, storeInFridge:{ type: String, enum: ['Yes','No','Deep Fridge'], required: true, }, purchaseDate:{ type: Number, purchaseDate: Date, required: true, }, expiryDate:{ type: Number, expirationDate: Date, required: true, }, amountOfItem:{ amount:{ type: Number, required: true, }, unit:{ type: String, enum: ['Kg','Lbs','actual item'], required: true, }, }, })
const AddUnitModel = mongoose.model("Add Unit", AddUnitSchema); module.exports = AddUnitModel;