api/models/vegetables_pictures.js

19 lines
481 B
JavaScript
Raw Normal View History

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-16 23:46:39 +02:00
vegetableId: {
2018-09-07 21:14:05 +02:00
type: DataTypes.INTEGER,
references: 'vegetables',
referencesKey: 'id'
}
}, {})
2018-09-16 23:46:39 +02:00
vegetablePictures.associate = function(models) {
vegetablePictures.hasOne(models.vegetables, {
as: 'Vegetables',
foreignKey: 'id'
})
2018-09-07 21:14:05 +02:00
}
return vegetablePictures
}