51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
import db from "../database/db.js";
|
|
|
|
const SubjectModel = (DataTypes) => {
|
|
const Subjects = db.define(
|
|
"m_subjects",
|
|
{
|
|
id: {
|
|
type: DataTypes.INTEGER,
|
|
primaryKey: true,
|
|
autoIncrement: true,
|
|
validate: {
|
|
notEmpty: true,
|
|
},
|
|
},
|
|
name: {
|
|
type: DataTypes.STRING(50),
|
|
allowNull: false,
|
|
validate: {
|
|
notEmpty: true,
|
|
},
|
|
},
|
|
description: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: false,
|
|
validate: {
|
|
notEmpty: true,
|
|
},
|
|
},
|
|
icon: {
|
|
type: DataTypes.STRING(255),
|
|
allowNull: true,
|
|
},
|
|
thumbnail: {
|
|
type: DataTypes.STRING(255),
|
|
allowNull: true,
|
|
},
|
|
ts_entri: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
defaultValue: DataTypes.NOW,
|
|
},
|
|
},
|
|
{
|
|
timestamps: false, // Disable Sequelize's automatic timestamp fields (createdAt, updatedAt)
|
|
tableName: "m_subjects", // Ensure the table name matches the actual table name
|
|
}
|
|
);
|
|
return Subjects;
|
|
};
|
|
|
|
export default SubjectModel; |