You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

167 lines
3.2 KiB

4 years ago
import _sequelize from 'sequelize';
const { Model, Sequelize } = _sequelize;
export default class users extends Model {
static init(sequelize, DataTypes) {
super.init({
ID: {
autoIncrement: true,
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true
},
Username: {
type: DataTypes.STRING(50),
allowNull: true
},
Password: {
type: DataTypes.TEXT,
allowNull: true
},
Salt: {
type: DataTypes.STRING(10),
allowNull: true
},
FirstName: {
type: DataTypes.STRING(50),
allowNull: true
},
LastName: {
type: DataTypes.STRING(50),
allowNull: false
},
DisplayName: {
type: DataTypes.STRING(100),
allowNull: true
},
NationalCode: {
type: DataTypes.BIGINT,
allowNull: false
},
MobileNo: {
type: DataTypes.STRING(15),
allowNull: false
},
Email: {
type: DataTypes.STRING(50),
allowNull: true
},
SuperUser: {
type: DataTypes.TINYINT,
allowNull: true,
defaultValue: 0
},
PasswordMustBeChanged: {
type: DataTypes.TINYINT,
allowNull: true,
defaultValue: 0
},
ExpirationDate: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: "1753-01-01 00:00:00"
},
DefaultPositionID: {
type: DataTypes.INTEGER,
allowNull: true
},
Index: {
type: DataTypes.TEXT,
allowNull: true
},
Status: {
type: DataTypes.TINYINT.UNSIGNED,
allowNull: true,
defaultValue: 1
},
RelationEmp: {
type: DataTypes.TINYINT.UNSIGNED,
allowNull: true
},
NetworkStructureID: {
type: DataTypes.INTEGER,
allowNull: true
},
CountryDivisionsID: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: 0
},
Phone: {
type: DataTypes.CHAR(8),
allowNull: true
},
CityCode: {
type: DataTypes.CHAR(3),
allowNull: true
},
CreatorUserID: {
type: DataTypes.INTEGER,
allowNull: true
},
CreateData: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: Sequelize.fn('current_timestamp')
},
L1ID: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1
},
L2ID: {
type: DataTypes.INTEGER,
allowNull: true
},
L3ID: {
type: DataTypes.INTEGER,
allowNull: true
},
L4ID: {
type: DataTypes.INTEGER,
allowNull: true
},
L5ID: {
type: DataTypes.INTEGER,
allowNull: true
},
L6ID: {
type: DataTypes.INTEGER,
allowNull: true
},
L7ID: {
type: DataTypes.INTEGER,
allowNull: true
},
L8ID: {
type: DataTypes.INTEGER,
allowNull: true
},
L9ID: {
type: DataTypes.INTEGER,
allowNull: true
},
JobTitle: {
type: DataTypes.STRING(50),
allowNull: true
}
}, {
sequelize,
tableName: 'users',
hasTrigger: true,
timestamps: false,
indexes: [
{
name: "PRIMARY",
unique: true,
using: "BTREE",
fields: [
{ name: "ID" },
]
},
]
});
return users;
}
}