const router = require("express").Router();
const Compra = require("../models/compras");
const { checkAuth } = require("../middlewares/authentication");


router.get("/compras", checkAuth, async (req, res) => {
    var compras;
  
    compras = await Compra.find({ user: req.userData._id }).sort({
      fecha: "desc",
    });
  
   return res.send(
        {
            status:"ok",
            data:compras

        }
    )
  });

  module.exports = router;