adding 'as' in associations
This commit is contained in:
@@ -4,18 +4,21 @@ module.exports = models => {
|
|||||||
Donors.hasMany(Grants, { foreignKey: 'donor_id' });
|
Donors.hasMany(Grants, { foreignKey: 'donor_id' });
|
||||||
|
|
||||||
Grants.belongsToMany(Causes, {
|
Grants.belongsToMany(Causes, {
|
||||||
|
as: 'GrantsCauses',
|
||||||
through: 'grants_causes',
|
through: 'grants_causes',
|
||||||
foreignKey: 'grant_id',
|
foreignKey: 'grant_id',
|
||||||
otherKey: 'cause_id'
|
otherKey: 'cause_id'
|
||||||
});
|
});
|
||||||
|
|
||||||
Grants.belongsToMany(Regions, {
|
Grants.belongsToMany(Regions, {
|
||||||
|
as: 'GrantsRegions',
|
||||||
through: 'grants_regions',
|
through: 'grants_regions',
|
||||||
foreignKey: 'grant_id',
|
foreignKey: 'grant_id',
|
||||||
otherKey: 'region_id'
|
otherKey: 'region_id'
|
||||||
});
|
});
|
||||||
|
|
||||||
Grants.belongsToMany(Organizations, {
|
Grants.belongsToMany(Organizations, {
|
||||||
|
as: 'GrantsOrganizations',
|
||||||
through: 'grants_organizations',
|
through: 'grants_organizations',
|
||||||
foreignKey: 'grant_id',
|
foreignKey: 'grant_id',
|
||||||
otherKey: 'organization_id'
|
otherKey: 'organization_id'
|
||||||
|
|||||||
Reference in New Issue
Block a user