Spaces:
Paused
Paused
Download src/models/transactionModel.js from Huzaifa1313/prof1: direct link, hf CLI and curl.
- Browser
- Download file 555 Bytes
-
https://huggingface.co/spaces/Huzaifa1313/prof1/resolve/main/src/models/transactionModel.js
- Command line
-
hf download hf://spaces/Huzaifa1313/prof1/src/models/transactionModel.js
-
curl -L -o transactionModel.js https://huggingface.co/spaces/Huzaifa1313/prof1/resolve/main/src/models/transactionModel.js
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; | |