backend_adaptive_learning/models/usersModels/userModel.js
2024-10-14 08:23:37 +07:00

63 lines
1.2 KiB
JavaScript

import db from "../../database/db.js";
const UserModel = (DataTypes) => {
const Users = db.define(
"users",
{
ID: {
type: DataTypes.UUID,
primaryKey: true,
defaultValue: DataTypes.UUIDV4,
allowNull: false,
validate: {
notEmpty: true,
},
},
NAME_USERS: {
type: DataTypes.STRING(100),
allowNull: false,
validate: {
notEmpty: true,
},
},
EMAIL: {
type: DataTypes.STRING(100),
allowNull: false,
unique: true,
validate: {
notEmpty: true,
isEmail: true,
},
},
PASSWORD: {
type: DataTypes.STRING(100),
allowNull: false,
},
ROLE: {
type: DataTypes.STRING(100),
allowNull: true,
},
PICTURE: {
type: DataTypes.STRING(1024),
allowNull: true,
},
REFRESH_TOKEN: {
type: DataTypes.STRING(256),
allowNull: true,
},
TIME_USERS: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: DataTypes.NOW,
},
},
{
timestamps: false,
tableName: "users",
}
);
return Users;
};
export default UserModel;