backend_adaptive_learning/models/learningModels/stdExerciseModel.js

76 lines
1.6 KiB
JavaScript
Raw Normal View History

2024-09-13 13:03:35 +00:00
import db from "../../database/db.js";
const StdExerciseModel = (DataTypes) => {
const StdExercise = db.define(
"student_exercise",
{
ID_STUDENT_EXERCISE: {
type: DataTypes.UUID,
primaryKey: true,
defaultValue: DataTypes.UUIDV4,
allowNull: false,
validate: {
notEmpty: true,
},
},
ID_ADMIN_EXERCISE: {
type: DataTypes.UUID,
allowNull: false,
validate: {
notEmpty: true,
},
references: {
model: "admin_exercise",
key: "ID_ADMIN_EXERCISE",
},
},
ID_STUDENT_LEARNING: {
type: DataTypes.UUID,
allowNull: false,
validate: {
notEmpty: true,
},
references: {
model: "student_learning",
key: "ID_STUDENT_LEARNING",
},
},
ANSWER_STUDENT: {
type: DataTypes.STRING(256),
2024-09-13 13:03:35 +00:00
allowNull: false,
validate: {
notEmpty: true,
},
},
IS_CORRECT: {
type: DataTypes.TINYINT(1),
2024-09-13 13:03:35 +00:00
allowNull: false,
defaultValue: 0,
validate: {
min: 0,
max: 1,
},
},
RESULT_SCORE_STUDENT: {
type: DataTypes.FLOAT,
2024-09-13 13:03:35 +00:00
allowNull: true,
defaultValue: null,
},
TIME_STUDENT_EXC: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: DataTypes.NOW,
onUpdate: DataTypes.NOW,
},
},
{
timestamps: false,
tableName: "student_exercise",
}
);
return StdExercise;
};
export default StdExerciseModel;