bullpen/backend/models/position.model.js

33 lines
876 B
JavaScript

const { Model } = require('sequelize');
module.exports = (sequelize, DataTypes) => {
class Position extends Model {
/**
* Helper method for defining associations.
* This method is not a part of Sequelize lifecycle.
* The `models/index` file will call this method automatically.
*/
static associate(models) {
// define association here
}
}
Position.init({
name: {
type: DataTypes.STRING,
allowNull: false,
unique: true
},
abbreviation: {
type: DataTypes.STRING,
allowNull: false
},
description: {
type: DataTypes.STRING,
allowNull: false
}
}, {
sequelize,
modelName: 'Position',
tableName: 'Positions'
});
return Position;
};