// This model was generated by Forest CLI. However, you remain in control of your models.
// Learn how here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models
module.exports = (sequelize, DataTypes) => {
const { Sequelize } = sequelize;
// This section contains the fields of your model, mapped to your table's columns.
// Learn more here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models#declaring-a-new-field-in-a-model
const Users = sequelize.define('users', {
firstName: {
type: DataTypes.STRING,
allowNull: false,
},
lastName: {
type: DataTypes.STRING,
allowNull: false,
},
email: {
type: DataTypes.STRING,
allowNull: false,
},
organizationId: {
type: DataTypes.STRING,
allowNull: false,
},
siteId: {
type: DataTypes.INTEGER,
},
companyId: {
type: DataTypes.INTEGER,
},
dateOfLogin: {
type: DataTypes.DATE,
},
language: {
type: DataTypes.STRING,
allowNull: false,
},
password: {
type: DataTypes.STRING,
allowNull: false,
},
erpId: {
type: DataTypes.STRING,
},
erpEmail: {
type: DataTypes.STRING,
},
dateOfLastNotification: {
type: DataTypes.DATE,
},
phoneNumber: {
type: DataTypes.STRING,
},
isBlocked: {
type: DataTypes.BOOLEAN,
},
dailyEmailSchedule: {
type: DataTypes.DATE,
},
id: {
type: DataTypes.INTEGER,
field: 'id',
},
}, {
tableName: 'users',
timestamps: false,
});
// This section contains the relationships for this model. See: https://docs.forestadmin.com/documentation/v/v6/reference-guide/relationships#adding-relationships.
Users.associate = (models) => {
Users.hasMany(models.exchangeRates, {
foreignKey: {
name: 'updatedByIdKey',
field: 'updatedById',
},
as: 'updatedByExchangeRates',
});
Users.hasOne(models.usersAdministration, {
foreignKey: {
name: 'userIdKey',
field: 'userId',
},
as: 'usersAdministration',
});
};
return Users;
};