const Ledger = require('../models/accountsLedgerModel');

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

exports.create = async (req, res) => {
    try {
        await Ledger.addLedgerEntry(req.body);
        res.json({ success: true, message: 'Ledger entry added' });
    } catch (err) {
        res.status(500).json({ error: err.message });
    }
};
