23 lines
506 B
JavaScript
23 lines
506 B
JavaScript
"use strict";
|
|
module.exports = (sequelize, DataTypes) => {
|
|
const Ingredient = sequelize.define('Ingredient', {
|
|
name: {
|
|
type: DataTypes.STRING,
|
|
allowNull: false,
|
|
unique: true
|
|
},
|
|
price: {
|
|
type: DataTypes.FLOAT,
|
|
defaultValue: 0,
|
|
allowNull: false
|
|
}
|
|
}, {
|
|
tableName: "Ingredients"
|
|
});
|
|
Ingredient.associate = function(models) {
|
|
Ingredient.belongsToMany(models.Command, {
|
|
through: "CommandsIngredients"
|
|
});
|
|
};
|
|
return Ingredient;
|
|
};
|