const Payments = require('../models/customerPaymentsModel');

exports.getAll = async (req, res) => {
  try {
    const [rows] = await Payments.getAllPayments();
    res.json(rows);
  } catch (err) {
    res.status(500).json({ error: err.message });
  }
};

exports.create = async (req, res) => {
  try {
    await Payments.addPayment(req.body);
    res.json({ success: true, message: 'Payment recorded' });
  } catch (err) {
    res.status(500).json({ error: err.message });
  }
};
