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/semester.js
2020-11-24 01:04:32 +01:00

28 lines
669 B
JavaScript

"use strict";
const { Model } = require("sequelize");
module.exports = (sequelize, DataTypes) => {
class Semester extends Model {
static associate(models) {
Semester.hasMany(models.Group);
Semester.belongsToMany(models.Event, {through: "EventSemester"});
}
}
Semester.init({
year: {
type: DataTypes.INTEGER,
allowNull: false,
unique: "semester"
},
name : {
type: DataTypes.STRING,
allowNull: false,
unique: "semester"
}
}, {
sequelize,
modelName: "Semester",
});
return Semester;
};