prof002313 / src /models /transactionModel.js
Huzaifa1435's picture
Initial Commit: Clean backend without large files
e3fefe8
Raw History Blame Contribute Delete
555 Bytes
const { dbGetAll } = require('../config/firebase');
const TRANSACTIONS_PATH = 'transactions';
const TransactionModel = {
async getByProfessionalId(professionalId) {
const all = await dbGetAll(TRANSACTIONS_PATH);
return all
.filter((tx) => tx.professionalId === professionalId)
.sort((a, b) => (b.createdAt || 0) - (a.createdAt || 0));
},
async getByBookingId(bookingId) {
const all = await dbGetAll(TRANSACTIONS_PATH);
return all.filter((tx) => tx.bookingId === bookingId);
},
};
module.exports = TransactionModel;