In my app, I want both social and app login. What is the best way to handle this with a single User table? Should I change these allowNull fields to true? because I cannot get the password,phone,address etc of a user who signed-up in my app using Gmail,Facebook etc My current user model looks like this:
{
firstName: {
type: DataTypes.STRING,
allowNull: false,
},
lastName: {
type: DataTypes.STRING,
allowNull: false,
},
email: {
type: DataTypes.STRING,
allowNull: false,
unique: true,
validate: { isEmail: true },
},
password: {
type: DataTypes.STRING,
allowNull: false,
},
role: {
type: DataTypes.STRING,
defaultValue: "Customer",
allowNull: false,
validate: {
isIn: [["Super-Admin", "Admin", "Sub-Admin", "Customer"]],
},
},
phone: {
type: DataTypes.STRING,
allowNull: false,
},
address: {
type: DataTypes.STRING,
allowNull: false,
},
isConfirm: {
type: DataTypes.BOOLEAN,
defaultValue: false,
allowNull: false,
},
},