text: const mongoose = require('mongoose');
  const changeToSlug = require('../utils/changeSlug');
  const { toJSON, paginate } = require('./plugins');
  
  const cartSchema = mongoose.Schema(
    {
      userId: {
        type: String,
        required: true,
        trim: true,
      },
      productName: {
        type: String,
        required: true,
        trim: true,
      },
      productId: {
        type: String,
        required: true,
      },
      quantity: {
          type: Number,
          required: true,
      },
      image: {
        type: String,
        required: true,
      },
      price: {
        type: Number,
        required: true,
      },
      priceTotal: {
        type: Number,
        required: true,
      },
      inventoryQty: {
        type: Number,
        required: true,
      },
    },
    {
      timestamps: true,
      versionKey: false,
    }
  );
  
  // add plugin that converts mongoose to json
  cartSchema.plugin(toJSON);
  cartSchema.plugin(paginate);
  
  /**
   * @typedef cart
   */
  const cart = mongoose.model('Cart', cartSchema);
  
  module.exports = cart;
  