backend_adaptive_learning/models/contentModels/exerciseModel.js

93 lines
1.8 KiB
JavaScript
Raw Normal View History

2024-09-13 13:03:35 +00:00
import db from "../../database/db.js";
const ExerciseModel = (DataTypes) => {
const Exercises = db.define(
"admin_exercise",
{
ID_ADMIN_EXERCISE: {
type: DataTypes.UUID,
primaryKey: true,
defaultValue: DataTypes.UUIDV4,
allowNull: false,
validate: {
notEmpty: true,
},
},
ID_LEVEL: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: "level",
key: "ID_LEVEL",
},
validate: {
notEmpty: true,
},
},
TITLE: {
type: DataTypes.STRING(100),
allowNull: false,
validate: {
notEmpty: true,
},
},
QUESTION: {
type: DataTypes.TEXT,
allowNull: false,
validate: {
notEmpty: true,
},
},
SCORE_WEIGHT: {
type: DataTypes.INTEGER(11),
2024-09-13 13:03:35 +00:00
allowNull: false,
defaultValue: 1,
validate: {
notEmpty: true,
},
},
QUESTION_TYPE: {
2024-11-06 06:05:04 +00:00
type: DataTypes.TEXT,
2024-09-13 13:03:35 +00:00
allowNull: false,
validate: {
notEmpty: true,
},
},
AUDIO: {
type: DataTypes.STRING(1024),
allowNull: true,
},
VIDEO: {
type: DataTypes.STRING(1024),
allowNull: true,
},
IMAGE: {
type: DataTypes.STRING(1024),
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_ADMIN_EXC: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: DataTypes.NOW,
},
},
{
timestamps: false,
tableName: "admin_exercise",
}
);
return Exercises;
};
export default ExerciseModel;