| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- const mongoose = require("mongoose");
- const MerchantSchema = new mongoose.Schema({
- name: {
- type: String,
- required: true
- },
- email: String,
- password: {
- type: String,
- minlength: 15
- },
- pos: {
- type: String,
- required: true
- },
- posId: String,
- posAccessToken: String,
- lastUpdatedTime: {
- type: String,
- default: Date.now()
- },
- createdAt: {
- type: Date,
- default: Date.now
- },
- status: [],
- squareLocation: String,
- inventory: [{
- ingredient: {
- type: mongoose.Schema.Types.ObjectId,
- ref: "Ingredient",
- required: true
- },
- quantity: {
- type: Number,
- required: true,
- min: 0
- },
- defaultUnit: {
- type: String,
- required: true
- }
- }],
- recipes: [{
- type: mongoose.Schema.Types.ObjectId,
- ref: "Recipe"
- }]
- });
- module.exports = mongoose.model("Merchant", MerchantSchema);
|