import {GoodsAttributes, Goods} from "../../models/index";
import InternalServerError from '../../utils/customErrors/internalServerError';



module.exports = (req, res, next) => {
   try {
      Goods.destroy({
         where: {
            id: req.params.id
         }
      }).then(() => {

         GoodsAttributes.findAll({
            where: {
               goodsId: req.params.id
            }
         }).then(goodsAttributes => {

            next();
         })

      })
   }catch (e) {
      next(new InternalServerError());
   }
};