Fixed bug in VegetableProperties
This commit is contained in:
parent
abffdc9438
commit
dcc78c725b
2 changed files with 6 additions and 5 deletions
|
@ -181,9 +181,9 @@ class Vegetables {
|
||||||
'Type',
|
'Type',
|
||||||
'Pictures',
|
'Pictures',
|
||||||
{
|
{
|
||||||
model: models.vegetableProperties,
|
model: models.vegetableProperties,
|
||||||
as: 'Properties',
|
as: 'Properties',
|
||||||
include: ['Property']
|
include: ['Property']
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
|
@ -17,9 +17,10 @@ module.exports = (sequelize, DataTypes) => {
|
||||||
as: 'Vegetable',
|
as: 'Vegetable',
|
||||||
foreignKey: 'id'
|
foreignKey: 'id'
|
||||||
})
|
})
|
||||||
vegetableProperties.hasOne(models.properties, {
|
vegetableProperties.belongsTo(models.properties, {
|
||||||
as: 'Property',
|
as: 'Property',
|
||||||
foreignKey: 'id'
|
foreignKey: 'propertyId',
|
||||||
|
targetKey: 'id'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return vegetableProperties
|
return vegetableProperties
|
||||||
|
|
Loading…
Reference in a new issue