segunolalive/helloBooks

View on GitHub
server/controllers/BookController.js

Summary

Maintainability
A
3 hrs
Test Coverage

Function borrowBook has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  borrowBook(req, res, next) {
    const userId = req.params.id;
    const bookId = req.body.id;
    Book.findById(bookId)
      .then((book) => {
Severity: Major
Found in server/controllers/BookController.js - About 2 hrs to fix

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

      returnBook(req, res, next) {
        const bookId = req.body.id;
        const userId = req.params.id;
        BorrowedBook.findOne({ where: { userId, bookId, returned: false } })
          .then((borrowedBook) => {
    Severity: Minor
    Found in server/controllers/BookController.js - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status