zgo/backend/models/order.js

16 lines
500 B
JavaScript
Raw Normal View History

2021-10-25 17:49:50 +00:00
const mongoose = require('mongoose');
const orderSchema = mongoose.Schema({
address: {type: String, required: true},
session: {type: String, required: true},
2021-10-25 17:49:50 +00:00
timestamp: {type: Date, required: true, default: Date.now},
closed: { type: Boolean, required: true, default:false },
lines: [{
qty: {type: Number, required: true, default: 1},
name: { type: String, required: true},
2021-10-25 17:49:50 +00:00
cost: { type: Number, required: true, default: 0}
}]
});
module.exports = mongoose.model('Order', orderSchema);