merchant.js 698 B

1234567891011121314151617181920212223242526272829303132
  1. const mongoose = require("mongoose");
  2. const MerchantSchema = new mongoose.Schema({
  3. name: {
  4. type: String,
  5. required: true
  6. },
  7. cloverId: {
  8. type: String,
  9. required: true
  10. },
  11. lastUpdatedTime: {
  12. type: Date,
  13. default: Date.now
  14. },
  15. inventory: [{
  16. ingredient: {
  17. type: mongoose.Schema.Types.ObjectId,
  18. ref: "Ingredient"
  19. },
  20. quantity: {
  21. type: Number,
  22. min: [0, "Quantity cannot be less than 0"]
  23. }
  24. }],
  25. recipes: [{
  26. type: mongoose.Schema.Types.ObjectId,
  27. ref: "Recipe"
  28. }]
  29. });
  30. module.exports = mongoose.model("Merchant", MerchantSchema);