tolulope-od/banka

View on GitHub
server/controllers/AccountController.js

Summary

Maintainability
B
6 hrs
Test Coverage

Function getSingleAccount has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  static async getSingleAccount(req, res) {
    const { accountNumber } = req.params;
    if (req.decoded.type === 'staff') {
      const accountDetails = await accounts.select(
        ['*'],
Severity: Major
Found in server/controllers/AccountController.js - About 2 hrs to fix

    Function editAccountStatus has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      static async editAccountStatus(req, res) {
        const { accountNumber } = req.params;
        const { status } = req.body;
        if (req.decoded.type !== 'staff') {
          return res.status(401).json({
    Severity: Minor
    Found in server/controllers/AccountController.js - About 1 hr to fix

      Function createAccount has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        static async createAccount(req, res) {
          const { type } = req.body;
          const { id, firstName, lastName, email } = req.decoded;
          if (req.decoded.type === 'client') {
            const accountNumber = Math.floor(Math.random() * 10 ** 10);
      Severity: Minor
      Found in server/controllers/AccountController.js - About 1 hr to fix

        Function getTransactionHistory has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static async getTransactionHistory(req, res) {
            const { accountNumber } = req.params;
            const { id, type } = req.decoded;
            const selectedAccount = await accounts.select(
              ['*'],
        Severity: Minor
        Found in server/controllers/AccountController.js - About 1 hr to fix

          There are no issues that match your filters.

          Category
          Status