2018-09-07 21:14:05 +02:00
|
|
|
module.exports = (sequelize, DataTypes) => {
|
|
|
|
const vegetablePictures = sequelize.define('vegetablePictures', {
|
|
|
|
url: DataTypes.STRING,
|
|
|
|
order: DataTypes.INTEGER,
|
2018-09-08 00:00:47 +02:00
|
|
|
vegetablesId: {
|
2018-09-07 21:14:05 +02:00
|
|
|
type: DataTypes.INTEGER,
|
|
|
|
references: 'vegetables',
|
|
|
|
referencesKey: 'id'
|
|
|
|
}
|
|
|
|
}, {})
|
|
|
|
vegetablePictures.associate = function (models) {
|
2018-09-08 00:00:47 +02:00
|
|
|
vegetablePictures.hasOne(models.vegetables, { as: 'Vegetables', foreignKey: 'id' })
|
2018-09-07 21:14:05 +02:00
|
|
|
}
|
|
|
|
return vegetablePictures
|
|
|
|
}
|