-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathorders.js
More file actions
29 lines (26 loc) · 645 Bytes
/
Copy pathorders.js
File metadata and controls
29 lines (26 loc) · 645 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import express from 'express';
import mongoose from 'mongoose'
const { Schema } = mongoose;;
const orderSchema = new Schema({
items: {
type: Array,
default: [],
},
priceTotal: {
type: Number,
default: 0.00
},
status: {
type: String,
default: 'pending',
enum: {
values: ['pending', 'processing', 'shipping', 'delivered'],
message: [`The product is in process`],
}
},
boughtBy: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User'
}
}, {timestamps: true});
export default mongoose.model('Order', orderSchema)