benfluleck/HelloBooks

View on GitHub
server/src/controllers/userBooks.js

Summary

Maintainability
B
5 hrs
Test Coverage

File userBooks.js has 346 lines of code (exceeds 250 allowed). Consider refactoring.
Invalid

import { toDate } from 'validator';
import models from '../models';
import pagination from '../controllers/helpers/pagination';

const {
Severity: Minor
Found in server/src/controllers/userBooks.js - About 4 hrs to fix

    Function loanBook has 130 lines of code (exceeds 60 allowed). Consider refactoring.
    Open

      loanBook(req, res) {
        const userId = req.user.id.id || req.user.id;
        const { bookId } = req.body;
        if (!req.body.returnDate) {
          return res
    Severity: Major
    Found in server/src/controllers/userBooks.js - About 3 hrs to fix

      Function returnBook has 86 lines of code (exceeds 60 allowed). Consider refactoring.
      Open

        returnBook(req, res) {
          const userId = req.user.id.id || req.user.id;
          const bookId = req.body.bookId;
          UserBooks.findOne({
            where: {
      Severity: Major
      Found in server/src/controllers/userBooks.js - About 2 hrs to fix

        There are no issues that match your filters.

        Category
        Status