From c89da28bd9bd6272dbd0074a6d72b4206b089eb5 Mon Sep 17 00:00:00 2001 From: MohammadHMazarei Date: Sun, 20 Apr 2025 23:57:46 +0330 Subject: [PATCH] ADD: get transactions by Belonging Id --- components/transaction/transactionService.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/components/transaction/transactionService.js b/components/transaction/transactionService.js index 5cad88b..864ba5a 100644 --- a/components/transaction/transactionService.js +++ b/components/transaction/transactionService.js @@ -54,6 +54,10 @@ const getUserTransaction = async (userId) => { return Transaction.find({ userId }, null, null) } +const getTransactionByBelongingId = async (belongingId) => { + return Transaction.find({ belongingId }, null, null) +} + const getBelongingInventory = async (belongingId) => { const belonging = await Belonging.findById(belongingId, null, null) @@ -147,4 +151,11 @@ const deleteTransaction = async (transactionId) => { return null } -module.exports = { createTransaction, getUserTransaction, getBelongingInventory, updateTransaction, deleteTransaction } +module.exports = { + createTransaction, + getUserTransaction, + getBelongingInventory, + updateTransaction, + deleteTransaction, + getTransactionByBelongingId, +}