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/event.js

37 lines
925 B
JavaScript
Raw Permalink Normal View History

2020-11-22 16:48:06 +01:00
"use strict";
const { Model } = require("sequelize");
module.exports = (sequelize, DataTypes) => {
class Event extends Model {
static associate(models) {
Event.belongsToMany(models.Semester, {through: "EventSemester"});
Event.belongsToMany(models.Group, {through: "EventGroup"});
Event.belongsToMany(models.User, {through: "EventTeacher"});
Event.belongsTo(models.UE);
}
}
Event.init({
name: {
type: DataTypes.STRING,
allowNull: false
},
locations: {
type: DataTypes.STRING,
allowNull: false
},
startDate: {
type: DataTypes.DATE,
allowNull: false
},
endDate: {
type: DataTypes.DATE,
allowNull: false
}
}, {
sequelize,
modelName: "Event",
});
return Event;
};