api/models/vegetables_pictures.js
2018-09-08 00:00:47 +02:00

15 lines
467 B
JavaScript

module.exports = (sequelize, DataTypes) => {
const vegetablePictures = sequelize.define('vegetablePictures', {
url: DataTypes.STRING,
order: DataTypes.INTEGER,
vegetablesId: {
type: DataTypes.INTEGER,
references: 'vegetables',
referencesKey: 'id'
}
}, {})
vegetablePictures.associate = function (models) {
vegetablePictures.hasOne(models.vegetables, { as: 'Vegetables', foreignKey: 'id' })
}
return vegetablePictures
}