backend_adaptive_learning/models/usersModels/studentModel.js

53 lines
1007 B
JavaScript
Raw Normal View History

2024-09-13 13:03:35 +00:00
import db from "../../database/db.js";
const StudentModel = (DataTypes) => {
const Students = db.define(
"student",
{
ID_SISWA: {
type: DataTypes.UUID,
primaryKey: true,
defaultValue: DataTypes.UUIDV4,
allowNull: false,
validate: {
notEmpty: true,
},
},
ID_CLASS: {
type: DataTypes.UUID,
allowNull: true,
references: {
model: "class",
key: "ID_CLASS",
},
},
2024-09-13 13:03:35 +00:00
ID: {
type: DataTypes.UUID,
allowNull: false,
validate: {
notEmpty: true,
},
references: {
model: "users",
key: "ID",
},
},
NISN: {
type: DataTypes.INTEGER,
allowNull: false,
unique: true,
validate: {
notEmpty: true,
},
},
},
{
timestamps: false,
tableName: "student",
}
);
return Students;
};
export default StudentModel;