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

const index = async (req, res) => {
  try {
    let faqs = await FAQ.findAll({
      order: [["id", "desc"]],
    });

    return success(res, {
      msg: "FAQ listed successfully!!",
      data: faqs,
    });
  } catch (err) {
    return error(res, {
      msg: "Something went wrong!!",
    });
  }
};

module.exports = {
  index,
};
