ADD: indexAllTransactions and searchTransactions handlers
This commit is contained in:
@@ -1,6 +1,27 @@
|
|||||||
const catchAsync = require('../../globalErrorHandler/catchAsync')
|
const catchAsync = require('../../globalErrorHandler/catchAsync')
|
||||||
const transactionService = require('./transactionService')
|
const transactionService = require('./transactionService')
|
||||||
|
|
||||||
|
exports.searchTransactions = catchAsync(async (req, res, next) => {
|
||||||
|
const { facets, transactions, totalCount, pagesCount } = await transactionService.searchTransactions(req.query)
|
||||||
|
|
||||||
|
res.status(200).json({
|
||||||
|
status: 'success',
|
||||||
|
facets,
|
||||||
|
transactions,
|
||||||
|
totalCount,
|
||||||
|
pagesCount,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
exports.indexAllTransactions = catchAsync(async (req, res, next) => {
|
||||||
|
const { indexedCount } = await transactionService.indexAllTransactions()
|
||||||
|
|
||||||
|
res.status(200).json({
|
||||||
|
status: 'success',
|
||||||
|
indexedCount,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
exports.createTransaction = catchAsync(async (req, res, next) => {
|
exports.createTransaction = catchAsync(async (req, res, next) => {
|
||||||
const transactions = await transactionService.createTransaction(req.body)
|
const transactions = await transactionService.createTransaction(req.body)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user