merchant.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. const mongoose = require("mongoose");
  2. const MerchantSchema = new mongoose.Schema({
  3. name: {
  4. type: String,
  5. required: true
  6. },
  7. email: String,
  8. password: {
  9. type: String,
  10. minlength: 15
  11. },
  12. pos: {
  13. type: String,
  14. required: true
  15. },
  16. posId: String,
  17. posAccessToken: String,
  18. lastUpdatedTime: {
  19. type: String,
  20. default: Date.now()
  21. },
  22. createdAt: {
  23. type: Date,
  24. default: Date.now
  25. },
  26. status: [],
  27. squareLocation: String,
  28. inventory: [{
  29. ingredient: {
  30. type: mongoose.Schema.Types.ObjectId,
  31. ref: "Ingredient",
  32. required: true
  33. },
  34. quantity: {
  35. type: Number,
  36. required: true,
  37. min: 0
  38. },
  39. defaultUnit: {
  40. type: String,
  41. required: true
  42. }
  43. }],
  44. recipes: [{
  45. type: mongoose.Schema.Types.ObjectId,
  46. ref: "Recipe"
  47. }],
  48. verifyId: String
  49. });
  50. module.exports = mongoose.model("Merchant", MerchantSchema);