| const AllTransaction = require('../models/AllTransaction'); | |
| const logTransaction = async (userId, type, amount, currency, description) => { | |
| try { | |
| const entry = new AllTransaction({ | |
| user_id: userId, | |
| type, | |
| amount, | |
| currency, | |
| description | |
| }); | |
| await entry.save(); | |
| } catch (err) { | |
| console.error("Ledger Logging Failed:", err); | |
| } | |
| }; | |
| module.exports = logTransaction; | |