text: const bcrypt = require('bcrypt');
  const { Model, DataTypes } = require('sequelize');
  const sequelize = require('../config/connection');
  
  // create user model
  class User extends Model {
      // set up method to run on instance data (per user) to check password
      checkPassword(loginPw) {
          return bcrypt.compareSync(loginPw, this.password);
      }
  }
  
  // define table columns and configuration
  User.init(
      {
          // define columns
          id: {
              type: DataTypes.INTEGER,
              allowNull: false,
              primaryKey: true,
              autoIncrement: true
          },
          username: {
              type: DataTypes.STRING,
              allowNull: false
          },
          password: {
              type: DataTypes.STRING,
              allowNull: false,
              validate: {
                  len: [4] // password must be more than four characters long
              }
          }
      },
      {
          //TABLE CONFIGURATION OPTIONS GO HERE
          hooks: {
              // set up beforeCreate lifecycle "hook" functionality
              async beforeCreate(newUserData) {
                  newUserData.password = await bcrypt.hash(newUserData.password, 10);
                  return newUserData;
              },
              // set up beforeUpdate lifecycle "hook" functionality
              async beforeUpdate(updatedUserData) {
                  updatedUserData.password = await bcrypt.hash(updatedUserData.password, 10);
                  return updatedUserData;
              }
          },
          sequelize,
          // don't automatically create createdAt/updatedAt timestamp fields
          timestamps: false,
          // don't pluralize name of database table
          freezeTableName: true,
          // use unders0cres instead of camel-casing
          underscored: true,
          // make it so our model name stays lowercase in the database
          modelName: 'user'
      }
  );
  
  module.exports = User;