server/controllers/BookController.js
Function borrowBook
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
borrowBook(req, res, next) {
const userId = req.params.id;
const bookId = req.body.id;
Book.findById(bookId)
.then((book) => {
Function returnBook
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
returnBook(req, res, next) {
const bookId = req.body.id;
const userId = req.params.id;
BorrowedBook.findOne({ where: { userId, bookId, returned: false } })
.then((borrowedBook) => {