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.

20 lines
651 B
JavaScript

var mongoose = require('mongoose');
var Schema = mongoose.Schema;
module.exports.schema = new Schema({
email: {type: String},
emailConfirmed: {type: Boolean, default: false},
emailPin: {type: String},
password: {type: String},
isAdmin: {type: Boolean, default: false},
cart: {type: Schema.Types.ObjectId, ref: 'Cart'},
purchases: [{type: Schema.Types.ObjectId, ref: 'Cart'}],
credit: {type: Number, default: 0},//Credit in cents because non-integers are confusing?
savedAddress: {type: String},
lastLogin: {type: Number, required: true}
}, {
usePushEach: true
});
module.exports.model = mongoose.model('User', module.exports.schema);