UNPKG

nammaniru_common_service

Version:

The service will contain all the functionality which is common for both shop and customer

37 lines (35 loc) 1.11 kB
import mongoose, { Schema } from "mongoose"; import OrderBillSchema from './OrderBillSchema/OrderBillSchema'; import OrderDeliveryAddressSchema from './OrderDeliveryAddressSchema/OrderDeliveryAddressSchema'; const OrdersSchema = new Schema( { //Unique value to track respective orders OrderID: { type: String, unique: true, required: true, }, //This will be the ID of the customer who placed the order CustomerID: { required: true, type: String, }, //ID of shop who accepts the order OrderPlacedTimeStamp: { type: String, required: true }, OrderBill: { type: OrderBillSchema, // Embedding OrderBillSchema required: true, }, OrderDeliveryAddress: { type: OrderDeliveryAddressSchema, // Embedding OrderDeliveryAddressSchema required: true, }, } ); module.exports = mongoose.model("Orders", OrdersSchema)