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: {
|
2024-08-16 07:22:19 +00:00
|
|
|
type: DataTypes.UUID,
|
2024-08-12 02:44:06 +00:00
|
|
|
primaryKey: true,
|
2024-08-16 07:22:19 +00:00
|
|
|
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-08-12 02:44:06 +00:00
|
|
|
type: DataTypes.STRING,
|
|
|
|
|
allowNull: false,
|
|
|
|
|
validate: {
|
|
|
|
|
notEmpty: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-09-13 13:03:35 +00:00
|
|
|
EMAIL: {
|
2024-08-12 02:44:06 +00:00
|
|
|
type: DataTypes.STRING,
|
|
|
|
|
allowNull: false,
|
|
|
|
|
unique: true,
|
|
|
|
|
validate: {
|
|
|
|
|
notEmpty: true,
|
|
|
|
|
isEmail: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-09-13 13:03:35 +00:00
|
|
|
PASSWORD: {
|
2024-08-12 02:44:06 +00:00
|
|
|
type: DataTypes.STRING,
|
|
|
|
|
allowNull: false,
|
|
|
|
|
},
|
2024-09-13 13:03:35 +00:00
|
|
|
ROLE: {
|
2024-08-12 02:44:06 +00:00
|
|
|
type: DataTypes.STRING,
|
|
|
|
|
allowNull: true,
|
|
|
|
|
},
|
2024-09-13 13:03:35 +00:00
|
|
|
PICTURE: {
|
|
|
|
|
type: DataTypes.STRING,
|
2024-08-12 02:44:06 +00:00
|
|
|
allowNull: true,
|
|
|
|
|
},
|
2024-10-03 03:32:34 +00:00
|
|
|
REFRESH_TOKEN: {
|
|
|
|
|
type: DataTypes.STRING,
|
|
|
|
|
},
|
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;
|