backend_adaptive_learning/models/contentModels/sectionModel.js
2024-11-06 13:05:04 +07:00

57 lines
1.1 KiB
JavaScript

import db from "../../database/db.js";
const SectionModel = (DataTypes) => {
const Sections = db.define(
"section",
{
ID_SECTION: {
type: DataTypes.UUID,
primaryKey: true,
defaultValue: DataTypes.UUIDV4,
validate: {
notEmpty: true,
},
},
NAME_SECTION: {
type: DataTypes.STRING(100),
allowNull: false,
validate: {
notEmpty: true,
},
},
DESCRIPTION_SECTION: {
type: DataTypes.TEXT,
allowNull: false,
validate: {
notEmpty: true,
},
},
THUMBNAIL: {
type: DataTypes.STRING(255),
allowNull: true,
},
IS_DELETED: {
type: DataTypes.TINYINT(1),
allowNull: true,
defaultValue: 0,
validate: {
min: 0,
max: 1,
},
},
TIME_SECTION: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
},
},
{
timestamps: false,
tableName: "section",
}
);
return Sections;
};
export default SectionModel;