server/controllers/UserController.js
Function createUser
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
createUser(req, res, next) {
delete req.body.isAdmin;
const username = req.body.username;
const email = req.body.email;
return User.find({
Function passwordResetMail
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
passwordResetMail(req, res) {
return User.findOne({
where: { email: req.body.email },
attributes: ['id', 'email'],
plain: true,
Function getUser
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getUser(req, res, next) {
const username = req.body.username;
const password = req.body.password;
return User.findOne({ where: { username } }).then((user) => {
if (!user) {
Function updateUserInfo
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
updateUserInfo(req, res, next) {
delete req.body.isAdmin;
req.body.passwordResetToken = null;
return User.findById(req.user.id)
.then((user) => {
Function getBorrowedBooks
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getBorrowedBooks(req, res, next) {
const id = req.params.id;
User.findOne({
where: { id },
include: [