merchant.js 628 B

12345678910111213141516171819202122232425262728
  1. const mongoose = require("mongoose");
  2. const MerchantSchema = new mongoose.Schema({
  3. cloverId: {
  4. type: String,
  5. required: true
  6. },
  7. lastUpdatedTime: {
  8. type: Date,
  9. default: Date.now
  10. },
  11. recipes: [{
  12. type: mongoose.Schema.Types.ObjectId,
  13. ref: "Recipe"
  14. }],
  15. ingredients: [{
  16. id: {
  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. });
  26. module.exports = mongoose.model("Merchant", MerchantSchema);