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

24 lines
567 B
JavaScript
Raw Normal View History

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