22 lines
428 B
JavaScript
22 lines
428 B
JavaScript
"use strict";
|
|
const {
|
|
Model
|
|
} = require("sequelize");
|
|
module.exports = (sequelize, DataTypes) => {
|
|
class Department extends Model {
|
|
static associate(models) {
|
|
Department.hasMany(models.Order);
|
|
Department.hasMany(models.User);
|
|
}
|
|
}
|
|
Department.init({
|
|
name: {
|
|
type: DataTypes.STRING,
|
|
primaryKey: true
|
|
}
|
|
}, {
|
|
sequelize,
|
|
modelName: "Department",
|
|
});
|
|
return Department;
|
|
};
|