zgo/backend/models/order.js

20 lines
636 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 },
2021-11-05 13:21:19 +00:00
price: { type: Number, required: true},
2021-11-22 20:37:45 +00:00
currency: {type: String, required: true},
2021-11-05 14:30:35 +00:00
total: { type: Number},
totalZec: {type: Number},
2021-10-25 17:49:50 +00:00
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);