42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
|
'use strict';
|
||
|
const {
|
||
|
Model, INTEGER
|
||
|
} = require('sequelize');
|
||
|
module.exports = (sequelize, DataTypes) => {
|
||
|
class users extends Model {
|
||
|
/**
|
||
|
* Helper method for defining associations.
|
||
|
* This method is not a part of Sequelize lifecycle.
|
||
|
* The `models/index` file will call this method automatically.
|
||
|
*/
|
||
|
static associate(models) {
|
||
|
// define association here
|
||
|
models.order.belongsTo(models.users);
|
||
|
models.prescription.belongsTo(models.users);
|
||
|
models.subscription.belongsTo(models.users);
|
||
|
|
||
|
//models.medicines.hasOne(models.orderDetails);
|
||
|
}
|
||
|
}
|
||
|
users.init({
|
||
|
userType: DataTypes.INTEGER,
|
||
|
name: DataTypes.STRING,
|
||
|
image: DataTypes.TEXT,
|
||
|
referralDoctor: DataTypes.STRING,
|
||
|
email: DataTypes.STRING,
|
||
|
contactNumber: DataTypes.STRING,
|
||
|
whatsAppNumber: DataTypes.STRING,
|
||
|
address1: DataTypes.STRING,
|
||
|
address2: DataTypes.STRING,
|
||
|
pincode: DataTypes.INTEGER,
|
||
|
location: DataTypes.STRING,
|
||
|
deviceId: DataTypes.STRING,
|
||
|
username: DataTypes.STRING,
|
||
|
password: DataTypes.STRING,
|
||
|
status: DataTypes.INTEGER
|
||
|
}, {
|
||
|
sequelize,
|
||
|
modelName: 'users',
|
||
|
});
|
||
|
return users;
|
||
|
};
|