const { success } = require("../../handlers");
const { Feedback } = require("../../models");

const addFeedback = async (req, res) => {
  try {
    let payload = req.body;
    payload["userId"] = req.session?.user?.id;

    await Feedback.create(payload);

    return success(res, {
      status: true,
      msg: "Feedback added successfully!!",
    });
  } catch (err) {
    return success(res, {
      status: false,
      msg: "Something went wrong!!",
    });
  }
};

module.exports = {
  addFeedback,
};
