You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
925 B
JavaScript

var mongoose = require('mongoose');
var Schema = mongoose.Schema;
module.exports.schema = new Schema({
user: {type: Schema.Types.ObjectId, ref: 'User'},
items: [{type: Schema.Types.ObjectId, required: true, ref: 'Sock'}],
purchased: {type: Schema.Types.Mixed, enum: [true, false, 'refunded'], default: false, required: true},
purchaseTime: {type: Number},
shipped: {type: Boolean, required: true, default: false},
shippedOn: {type: Number},
address: {type: String}, // Easypost id
shipment: {type: String}, // Easypost id
shipmentMeasured: {type: Boolean, default: false},
sockPrice: {type: Number},
totalPrice: {type: Number},
shippingEstimate: {type: Number},
coupon: {type: Schema.Types.ObjectId, required: false, ref: 'Coupon'},
trackingCode: {type: String},
needsCustoms: {type: Boolean, default: false}
}, {
usePushEach: true
});
module.exports.model = mongoose.model('Cart', module.exports.schema);