Showing 7 of 21 total issues
Function createLoan
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async createLoan(req, res) {
const { email } = req.user;
const { amount, tenor } = req.body;
const loan = {
email,
Function getAllLoans
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async getAllLoans(req, res) {
const { status, repaid } = req.query;
let query;
if (status && repaid) {
Function authenticateUser
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function authenticateUser(userObj, endpoint) {
const url = `http://localhost:4500/api/v1/auth/${endpoint}`;
const element = document.querySelector('button[type="submit"]');
const defaultText = element.textContent;
let defaultRole = 'user';
Function createUser
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async createUser(req, res) {
const {
firstname, lastname, address, email, password,
} = req.body;
const hashedPassword = HelperUtils.hashPassword(password);
Function postRepayment
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async postRepayment(req, res) {
const { id } = req.params;
const paidAmount = parseInt(req.body.paidAmount, 10);
const query = `SELECT * FROM loans WHERE id='${id}'`;
let repaid = false;
Function updateLoan
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async updateLoan(req, res) {
const { id } = req.params;
const { status } = req.body;
const query = `SELECT * FROM loans WHERE id='${id}'`;
const update = `UPDATE loans
Function renderLoanRecords
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function renderLoanRecords(recordObj) {
const list = document.getElementById('record-list');
const row = document.createElement('tr');
const {
id,