const db = require('../db/config');

exports.getAllPayments = () => {
  return db.query('SELECT * FROM customer_payments ORDER BY payment_date DESC');
};

exports.addPayment = ({ customer_id, amount, method }) => {
  return db.query(
    'INSERT INTO customer_payments (customer_id, amount, method) VALUES (?, ?, ?)',
    [customer_id, amount, method]
  );
};
