Archived
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.
SOD/models/department.js

28 lines
529 B
JavaScript
Raw Permalink Normal View History

2020-08-15 12:36:20 +02:00
"use strict";
const {
Model
} = require("sequelize");
module.exports = (sequelize, DataTypes) => {
class Department extends Model {
static associate(models) {
2020-08-18 17:54:00 +02:00
Department.hasMany(models.Order);
Department.hasMany(models.User);
2020-08-15 12:36:20 +02:00
}
}
Department.init({
name: {
type: DataTypes.STRING,
primaryKey: true
},
enable: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true
2020-08-15 12:36:20 +02:00
}
}, {
sequelize,
modelName: "Department",
});
return Department;
};