backend_adaptive_learning/models/contentModels/sectionModel.js

57 lines
1.1 KiB
JavaScript
Raw Normal View History

2024-09-13 13:03:35 +00:00
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.STRING(1024),
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,
},
},
2024-09-13 13:03:35 +00:00
TIME_SECTION: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
},
},
{
timestamps: false,
tableName: "section",
}
);
return Sections;
};
export default SectionModel;