Sindbad~EG File Manager

Current Path : /home/infinitibizsol/autocrm.infinitibizsol.com/models/
Upload File :
Current File : /home/infinitibizsol/autocrm.infinitibizsol.com/models/User.js

module.exports = (sequelize, DataTypes) => {
  const User = sequelize.define(
    "tblUser",
    {
      user_id: {
        type: DataTypes.INTEGER,
        primaryKey: true,
        autoIncrement: true,
      },

      firstname: {
        type: DataTypes.STRING,
        allowNull: false,
        validate: {
          notEmpty: {
            args: true,
            msg: "Please provide a firstname",
          },
          notNull: {
            args: true,
            msg: "The firstname cannot be null",
          },
        },
      },

      lastname: {
        type: DataTypes.STRING,
        allowNull: false,
        validate: {
          notEmpty: {
            args: true,
            msg: "Please provide a lastname",
          },
          notNull: {
            args: true,
            msg: "The lastname cannot be null",
          },
        },
      },

      mobile_no: {
        type: DataTypes.STRING,
        allowNull: false,
        validate: {
          notEmpty: {
            args: true,
            msg: "Please provide a mobile_no",
          },
          notNull: {
            args: true,
            msg: "The mobile_no cannot be null",
          },
          len: {
            args: [7, 15],
            msg: "The mobile_no must be between 7 and 15 digits",
          },
        },
      },

      business_name: {
        type: DataTypes.STRING,
        allowNull: false,
        validate: {
          notEmpty: {
            args: true,
            msg: "Please provide a business_name",
          },
          notNull: {
            args: true,
            msg: "The business_name cannot be null",
          },
        },
      },

      business_phone: {
        type: DataTypes.STRING,
        allowNull: false,
        validate: {
          notEmpty: {
            args: true,
            msg: "Please provide a business_phone",
          },
          notNull: {
            args: true,
            msg: "The business_phone cannot be null",
          },
          len: {
            args: [7, 15],
            msg: "The business_phone must be between 7 and 15 digits",
          },
        },
      },
      
      business_email: {
        type: DataTypes.STRING,
        allowNull: false,
        unique: {
          args: true,
          msg: "The email address is already in use!",
        },
        validate: {
          notEmpty: {
            args: true,
            msg: "Please provide a business_email",
          },
          notNull: {
            args: true,
            msg: "The business_email cannot be null",
          },
          isEmail: {
            args: true,
            msg: "Please provide a valid business_email address",
          },
        },
      },
      
      business_logo: {
        type: DataTypes.STRING,
        allowNull: true,
      },

      business_address: {
        type: DataTypes.STRING,
        allowNull: false,
        validate: {
          notEmpty: {
            args: true,
            msg: "Please provide a business_address",
          },
          notNull: {
            args: true,
            msg: "The business_address cannot be null",
          },
        },
      },

      password: {
        type: DataTypes.STRING,
        allowNull: false,
        validate: {
          notEmpty: {
            args: true,
            msg: "Please provide a password",
          },
          notNull: {
            args: true,
            msg: "The password cannot be null",
          },
        },
      },

      resetPasswordToken: {
        type: DataTypes.STRING,
      },
      
      resetPasswordExpires: {
        type: DataTypes.DATE,
      },
      
    },
    {
      timestamps: true,
    }
  );

  return User;
};

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists