Wolkendama-API / Model / customerModel.js
customerModel.js
Raw
const mongoose = require("mongoose");

const customerSchema = new mongoose.Schema({
  checkoutId: {
    type: String,
    required: [true, "Customer must have a checkout Id"],
  },
  reserveItem: Array,
  emailParams: Object,
  status: {
    type: String,
    required: [true, "Customer must have a status"],
    enum: ["pending_payment", "payment_success", "shipped"],
  },
  amountTotal: Number,
  billingName: String,
  email: String,
  phone: String,
  billingAddress: Object,
  purchasedItem: Array,
  shippingAddress: Object,
  shippingName: String,
  createdDate: {
    type: Date,
    default: Date.now(),
  },
  shippingProvider: String,
  trackingNo: String,
  paymentIntentId: String,
  invoiceUrl: String,
  paymentIntentDescription: String,
});

const Customer = mongoose.model("Customer", customerSchema);
module.exports = Customer;