1
0
Fork 0
This repository has been archived on 2024-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
letu/models/grade.js

31 lines
708 B
JavaScript
Raw Normal View History

"use strict";
const { Model } = require("sequelize");
module.exports = (sequelize, DataTypes) => {
class Grade extends Model {
static associate(models) {
Grade.belongsTo(models.Evaluation);
Grade.belongsTo(models.User, {as: "TeacherGrade"});
Grade.belongsTo(models.User, {as: "StudentGrade"});
}
}
Grade.init({
score: {
type: DataTypes.FLOAT,
allowNull: false
},
limit: {
type: DataTypes.FLOAT,
allowNull: false
},
comment: {
type: DataTypes.TEXT
}
}, {
sequelize,
modelName: "Grade",
});
return Grade;
};