From 9faaeef9cea5c903208f07cea80ff0d4a991fd48 Mon Sep 17 00:00:00 2001 From: Kaveh Hajinajaf Date: Mon, 21 Apr 2025 23:52:32 +0330 Subject: [PATCH] FIX: Transaction Route names FIX: Bug where belonging transactions wouldnt select properly --- components/transaction/transactionRoutes.js | 4 ++-- components/transaction/transactionService.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/transaction/transactionRoutes.js b/components/transaction/transactionRoutes.js index 5281f83..dc8dd13 100644 --- a/components/transaction/transactionRoutes.js +++ b/components/transaction/transactionRoutes.js @@ -20,13 +20,13 @@ router.post( ) router.get( - '/admin/belonging/:belongingId/inventory', + '/admin/get-stock-by-belonging/:belongingId', // perm.requires('getallbelongings'), transactionController.getBelongingInventory ) router.get( - '/admin/belonging/:belongingId', + '/admin/get-all-by-belonging/:belongingId', // perm.requires('getallbelongings'), transactionController.getTransactionByBelongingId ) diff --git a/components/transaction/transactionService.js b/components/transaction/transactionService.js index 864ba5a..1c53927 100644 --- a/components/transaction/transactionService.js +++ b/components/transaction/transactionService.js @@ -69,7 +69,7 @@ const getBelongingInventory = async (belongingId) => { const result = await Transaction.aggregate([ { $match: { - belongingId: ObjectID, + belongingId: belonging._id, $or: [{ status: 'finished' }, { status: 'pending' }], }, },