To record the details of the customer who the order is meant for, we will add customer_name and customer_email fields to the Order schema.
mern-marketplace/server/models/order.model.js:
customer_name: { type: String, trim: true, required: 'Name is required' },customer_email: { type: String, trim: true, match: [/.+\@.+\..+/, 'Please fill a valid email address'], required: 'Email is required' }
To reference the signed-in user who placed the order, we will add an ordered_by field.
mern-marketplace/server/models/order.model.js:
ordered_by: {type: mongoose.Schema.ObjectId, ref: 'User'}