backend_adaptive_learning/models/usersModels/userModel.js

68 lines
1.3 KiB
JavaScript
Raw Normal View History

2024-09-13 13:03:35 +00:00
import db from "../../database/db.js";
2024-08-12 02:44:06 +00:00
const UserModel = (DataTypes) => {
const Users = db.define(
"users",
{
2024-09-13 13:03:35 +00:00
ID: {
type: DataTypes.UUID,
2024-08-12 02:44:06 +00:00
primaryKey: true,
defaultValue: DataTypes.UUIDV4,
allowNull: false,
2024-08-12 02:44:06 +00:00
validate: {
notEmpty: true,
},
},
2024-09-13 13:03:35 +00:00
NAME_USERS: {
2024-10-14 01:23:37 +00:00
type: DataTypes.STRING(100),
2024-08-12 02:44:06 +00:00
allowNull: false,
validate: {
notEmpty: true,
},
},
2024-09-13 13:03:35 +00:00
EMAIL: {
2024-10-14 01:23:37 +00:00
type: DataTypes.STRING(100),
2024-08-12 02:44:06 +00:00
allowNull: false,
unique: true,
validate: {
notEmpty: true,
isEmail: true,
},
},
2024-09-13 13:03:35 +00:00
PASSWORD: {
2024-10-14 01:23:37 +00:00
type: DataTypes.STRING(100),
2024-08-12 02:44:06 +00:00
allowNull: false,
},
2024-09-13 13:03:35 +00:00
ROLE: {
2024-10-14 01:23:37 +00:00
type: DataTypes.STRING(100),
2024-08-12 02:44:06 +00:00
allowNull: true,
},
2024-09-13 13:03:35 +00:00
PICTURE: {
2024-10-14 01:23:37 +00:00
type: DataTypes.STRING(1024),
2024-08-12 02:44:06 +00:00
allowNull: true,
},
2024-11-07 02:18:27 +00:00
IS_VALIDATED: {
type: DataTypes.TINYINT(1),
allowNull: true,
defaultValue: 0,
},
REFRESH_TOKEN: {
2024-10-14 01:23:37 +00:00
type: DataTypes.STRING(256),
allowNull: true,
},
2024-09-25 03:57:47 +00:00
TIME_USERS: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: DataTypes.NOW,
},
2024-08-12 02:44:06 +00:00
},
{
2024-09-13 13:03:35 +00:00
timestamps: false,
tableName: "users",
2024-08-12 02:44:06 +00:00
}
);
return Users;
};
export default UserModel;