2021-10-25 17:49:50 +00:00
|
|
|
const mongoose = require('mongoose');
|
|
|
|
|
|
|
|
const orderSchema = mongoose.Schema({
|
|
|
|
address: {type: String, required: true},
|
2021-10-25 20:01:06 +00:00
|
|
|
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},
|
2021-10-27 20:21:55 +00:00
|
|
|
name: { type: String, required: true},
|
2021-10-25 17:49:50 +00:00
|
|
|
cost: { type: Number, required: true, default: 0}
|
|
|
|
}]
|
|
|
|
});
|
2021-10-25 20:01:06 +00:00
|
|
|
|
|
|
|
module.exports = mongoose.model('Order', orderSchema);
|