using the sequelize auto index file for model/db config

This commit is contained in:
Arjun Patel
2019-03-16 21:55:50 -07:00
parent 661828bab2
commit 52c284f02a
6 changed files with 91 additions and 30 deletions
+2 -13
View File
@@ -7,23 +7,12 @@ module.exports = models => {
Organization,
Charge,
PaymentPlan,
GrantsOrganizations
GrantsOrganizations,
Project
} = models;
Donor.hasMany(Grant, { foreignKey: 'donor_id' });
Grant.belongsToMany(Cause, {
through: 'grants_causes',
foreignKey: 'grant_id',
otherKey: 'cause_id'
});
Grant.belongsToMany(Region, {
through: 'grants_regions',
foreignKey: 'grant_id',
otherKey: 'region_id'
});
Grant.belongsToMany(Organization, {
through: 'grants_organizations',
foreignKey: 'grant_id',