title: TypeError: Cannot read property 'findAll' of undefined(sequelize)
body: <p>I did refer to similar questions like <a href="https://stackoverflow.com/questions/34795953/typeerror-cannot-read-property-findall-of-undefined-expressjs">this</a> but here while debugging I am getting <code>models</code> as empty. I am clueless as to why is this happening. DB table is <code>Users</code>.</p>
  
  <p>controllers/user.js:</p>
  
  <pre><code>const models = require('../models');
  const User = models.Users;
  exports.getAllUsers = (req,res,next) =&gt; {
    console.log(models);
    console.log(User);
  User.findAll({
    attributes: attributesUser
  }).then(users =&gt; {
    console.log(users);
    res.status(200).json({
      data: users
    });
  });
  }
  </code></pre>
  
  <p>models/user.js:</p>
  
  <pre><code>'use strict';
  module.exports = (sequelize, DataTypes) =&gt; {
    const Users = sequelize.define('Users', {
      firstName: {
        type: DataTypes.STRING,
        allowNull: false,
        validate: {
          len: [4, 255]
        }
      },
      middleName: {
        type: DataTypes.STRING,
        allowNull: false,
        validate: {
          len: [4, 255]
        }
      },
      lastName: {
        type: DataTypes.STRING,
        allowNull: false,
        validate: {
          len: [4,255]
        }
      },
      mobile: {
        type: DataTypes.STRING,
        validate:{
          len: [10,15],
          isNumeric:{
            msg:"Invalid Mobile Number"
          }
        }
      },
      address: {
        type: DataTypes.STRING,
        allowNull:false
      },
      dob: {
        type: DataTypes.DATEONLY,
        allowNull:false
      },
      email: {
        type: DataTypes.STRING,
        allowNull:false,
        unique: true,
        validate: {
          isEmail: true
        },
        set(email){
          this.setDataValue("email",email.toString().toLowerCase());
        }
      },
      password: {
        type: DataTypes.STRING,
        allowNull:false
      },
      gender: {
        type: DataTypes.STRING,
        allowNull:false
      },
      isDisabled: {
        type: DataTypes.BOOLEAN,
        allowNull: false
      },
      lastLoginTime: {
        type: DataTypes.DATE,
      },
      createdAt: {
        type: DataTypes.DATE,
        allowNull:false
      },
      updatedAt: {
        type: DataTypes.DATE,
      },
      deletedAt: {
        type: DataTypes.DATE,
      },
    }, {});
    Users.associate = function(models) {
      // associations can be defined here
      Users.belongsTo(models.UserType, {
        foreignKey: {
          name: "userTypeId",
          allowNull: false
        }
      });
      Users.belongsTo(models.Qualification, {
        foreignKey: {
          name: "qualificationId",
          allowNull: false
        }
      });
      Users.belongsTo(models.Organization, {
        foreignKey: "organizationId",
        allowNull: false
      });
    };
    return Users;
  };
  </code></pre>
  
  <p>Output: </p>
  
  <pre><code>TypeError: Cannot read property 'findAll' of undefined
      at exports.getAllUsers (/mnt/part1/projects/Video_Coaching/backend-v2/controllers/user.js:87:10)
      at Layer.handle [as handle_request] (/mnt/part1/projects/Video_Coaching/backend-v2/node_modules/express/lib/router/layer.js:95:5)
      at next (/mnt/part1/projects/Video_Coaching/backend-v2/node_modules/express/lib/router/route.js:137:13)
      at Route.dispatch (/mnt/part1/projects/Video_Coaching/backend-v2/node_modules/express/lib/router/route.js:112:3)
      at Layer.handle [as handle_request] (/mnt/part1/projects/Video_Coaching/backend-v2/node_modules/express/lib/router/layer.js:95:5)
      at /mnt/part1/projects/Video_Coaching/backend-v2/node_modules/express/lib/router/index.js:281:22
  </code></pre>