Untitled

 avatar
unknown
plain_text
a year ago
668 B
6
Indexable
// src/mongoose/models/commande.model.js
import { Schema, model } from 'mongoose';

const CommandeDetailSchema = new Schema({
  _id: String,
  price: Number,
  quantity: Number,
  imageName: String,
  promotionName: String,
  promotionValue: Number,
  createdAt: Date,
  updatedAt: Date
});

const CommandeSchema = new Schema({
  _id: String,
  userId: String,
  isPaid: Boolean,
  paymentFailedMessage: String,
  deliveryStatus: String,
  price: Number,
  commandeDetails: [CommandeDetailSchema],
  createdAt: Date,
  updatedAt: Date
}, { versionKey: false });

const Commande = model('Commande', CommandeSchema);

export default Commande;
Editor is loading...
Leave a Comment