diff --git a/components/transaction/transactionController.js b/components/transaction/transactionController.js index 3220e91..afc9278 100644 --- a/components/transaction/transactionController.js +++ b/components/transaction/transactionController.js @@ -4,7 +4,7 @@ const transactionService = require('./transactionService') exports.createTransaction = catchAsync(async (req, res, next) => { const transactions = await transactionService.createTransaction(req.body) - res.status(200).json({ + res.status(201).json({ status: 'success', results: transactions.length, data: transactions, @@ -29,3 +29,12 @@ exports.getBelongingInventory = catchAsync(async (req, res, next) => { data: result, }) }) + +exports.updateTransaction = catchAsync(async (req, res, next) => { + const transaction = await transactionService.updateTransaction(req.params.transactionId, req.body) + + res.status(200).json({ + status: 'success', + data: transaction, + }) +})