Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.4 kB
2
Indexable
Never
const db = require("../database/db");
const Sequelize = require('sequelize'); 

const model = {
  id: {
    type: Sequelize.BIGINT,
    primaryKey: true,
    validate: {
      len: {
        args: [0,20],
        msg: "Min length of the phone number is 10"
      }
    }
  },
  name: {
    type: Sequelize.STRING,
    allowNull: false,
  },
  email: {
    type: Sequelize.STRING,
    unique: {
        args: true,
        msg: 'Email ID already in use!'
    },
    allowNull: true,
  },
  phone: {
    type: Sequelize.STRING,
    unique: {
        args: true,
        msg: 'User already exists'
    },
    length:10,
    allowNull: true,
    require:true
  },
  email_verified_at: {
    type: Sequelize.STRING,
    allowNull: true,
  },
  password: {
    type: Sequelize.STRING,
    allowNull: true,
  },
  gender: {
    type: Sequelize.STRING,
    allowNull: false,
    require:true
  }, 
  userType :{
    type: Sequelize.INTEGER,
    allowNull:false,
    require:true
  },
  auth_token : {
    type: Sequelize.STRING,
    allowNull:true
  },
  permission : {
    type: Sequelize.JSON,
    allowNull:true
  },
  created_at: {
    type: Sequelize.DATE,
    defaultValue: Sequelize.NOW
  },
  updated_at: {
    type: Sequelize.DATE,
    defaultValue: Sequelize.NOW
  }
}



module.exports = { model };