23 lines
685 B
JavaScript
23 lines
685 B
JavaScript
const catchAsync = require('../../globalErrorHandler/catchAsync')
|
|
const transactionService = require('./transactionService')
|
|
|
|
exports.createTransaction = catchAsync(async (req, res, next) => {
|
|
const transactions = await transactionService.createTransaction(req.body)
|
|
|
|
res.status(200).json({
|
|
status: 'success',
|
|
results: transactions.length,
|
|
data: transactions,
|
|
})
|
|
})
|
|
|
|
exports.getUserTransaction = catchAsync(async (req, res, next) => {
|
|
const transactions = await transactionService.getUserTransaction(req.user._id)
|
|
|
|
res.status(200).json({
|
|
status: 'success',
|
|
results: transactions.length,
|
|
data: transactions,
|
|
})
|
|
})
|