ingredient.js 596 B

12345678910111213141516171819202122232425262728293031
  1. const helper = require("../controllers/helper.js");
  2. const mongoose = require("mongoose");
  3. let sanitary = (value)=>{
  4. return helper.isSanitary(value);
  5. }
  6. const IngredientSchema = new mongoose.Schema({
  7. name: {
  8. type: String,
  9. minlength: 2,
  10. required: true,
  11. validate: {
  12. }
  13. },
  14. category: {
  15. type: String,
  16. minlength: 2,
  17. required: true
  18. },
  19. unitType: {
  20. type: String,
  21. required: true
  22. },
  23. specialUnit: String,
  24. unitSize: String
  25. });
  26. module.exports = mongoose.model("Ingredient", IngredientSchema);