front-end almost done | started back-end
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
const mongoose = require('mongoose')
|
||||
|
||||
const StatusSchema = mongoose.Schema({
|
||||
status: {
|
||||
type: String,
|
||||
enum: ['incomplete','processing', 'packing', 'sent','delivered'],
|
||||
default: 'processing'
|
||||
},
|
||||
created_at: String
|
||||
})
|
||||
|
||||
const Order_itemsSchema = mongoose.Schema({
|
||||
product_id: String,
|
||||
quantity: Number,
|
||||
price: Number,
|
||||
price_unit: String,
|
||||
created_at: String
|
||||
})
|
||||
|
||||
const OrderSchema = mongoose.Schema({
|
||||
user_id: String,
|
||||
number: Number,
|
||||
address: Object,
|
||||
statuses: [StatusSchema],
|
||||
order_items: [Order_itemsSchema],
|
||||
created_at: String,
|
||||
updated_at: String
|
||||
})
|
||||
|
||||
module.exports = mongoose.model('Order', OrderSchema)
|
||||
Reference in New Issue
Block a user