segunolalive/helloBooks

View on GitHub
server/controllers/UserController.js

Summary

Maintainability
B
6 hrs
Test Coverage

Function createUser has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  createUser(req, res, next) {
    delete req.body.isAdmin;
    const username = req.body.username;
    const email = req.body.email;
    return User.find({
Severity: Minor
Found in server/controllers/UserController.js - About 1 hr to fix

    Function passwordResetMail has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      passwordResetMail(req, res) {
        return User.findOne({
          where: { email: req.body.email },
          attributes: ['id', 'email'],
          plain: true,
    Severity: Minor
    Found in server/controllers/UserController.js - About 1 hr to fix

      Function getUser has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        getUser(req, res, next) {
          const username = req.body.username;
          const password = req.body.password;
          return User.findOne({ where: { username } }).then((user) => {
            if (!user) {
      Severity: Minor
      Found in server/controllers/UserController.js - About 1 hr to fix

        Function updateUserInfo has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          updateUserInfo(req, res, next) {
            delete req.body.isAdmin;
            req.body.passwordResetToken = null;
            return User.findById(req.user.id)
              .then((user) => {
        Severity: Minor
        Found in server/controllers/UserController.js - About 1 hr to fix

          Function getBorrowedBooks has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            getBorrowedBooks(req, res, next) {
              const id = req.params.id;
              User.findOne({
                where: { id },
                include: [
          Severity: Minor
          Found in server/controllers/UserController.js - About 1 hr to fix

            There are no issues that match your filters.

            Category
            Status