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 }, price: { type: Number, required: true}, currency: {type: String, required: true}, total: { type: Number}, totalZec: {type: Number}, 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);