const { Banner } = require("../../models");
const { success, error } = require("../../handlers");

const index = async (req, res) => {
  try {
    let banners = await Banner.findAll({
      order: [["id", "desc"]],
    });
    return success(res, {
      msg: "Banner listed successfully!!",
      data: banners,
    });
  } catch (err) {
    return error(res, {
      msg: "Something went wrong!!",
    });
  }
};

module.exports = {
  index,
};
