ingredient.js 607 B

12345678910111213141516171819
  1. const mongoose = require("mongoose");
  2. const IngredientSchema = new mongoose.Schema({
  3. name: {
  4. type: String,
  5. minlength: [2, "Name of ingredient is too short. Please have at least two characters"],
  6. required: [true, "Must provide a name for the ingredient"]
  7. },
  8. category: {
  9. type: String,
  10. minlength: [3, "Category name must contain at least three characters"]
  11. },
  12. unitType: {
  13. type: String,
  14. required: [true, "You must provide the measurement unit for this item"]
  15. }
  16. })
  17. module.exports = mongoose.model("Ingredient", IngredientSchema);