server/controllers/TransactionController.js
Function creditAccount
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async creditAccount(req, res) {
const { accountNumber } = req.params;
const { creditAmount } = req.body;
if (req.decoded.type !== 'staff') {
return res.status(401).json({
Function debitAccount
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async debitAccount(req, res) {
const { accountNumber } = req.params;
const { debitAmount } = req.body;
if (req.decoded.type !== 'staff') {
return res.status(401).json({
Function getSpecificTransaction
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async getSpecificTransaction(req, res) {
const { transactionId } = req.params;
const { id, type } = req.decoded;
if (type === 'client') {
const userAccountTransaction = await transactions.select(
Avoid too many return
statements within this function. Open
Open
return res.status(200).json({
status: 200,
data: [data],
message: 'Account credited successfully'
});
Avoid too many return
statements within this function. Open
Open
return res.status(400).json({
status: 400,
error: `Insufficient funds, your account balance is ${balance}`
});
Avoid too many return
statements within this function. Open
Open
return res.status(200).json({
status: 200,
data: [data],
message: 'Account debited successfully'
});