zgo/backend/models/order.js

15 lines
500 B
JavaScript

const mongoose = require('mongoose');
const orderSchema = mongoose.Schema({
address: {type: String, required: true},
session: {type: String, required: true},
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},
cost: { type: Number, required: true, default: 0}
}]
});
module.exports = mongoose.model('Order', orderSchema);