Files
Ucharify_api/app/config/associate.js
T
2019-03-16 23:49:11 -07:00

25 lines
424 B
JavaScript

module.exports = models => {
const {
donor,
Grant,
Cause,
Region,
Organization,
Charge,
PaymentPlan,
GrantsOrganizations,
Project
} = models;
console.log(models);
donor.hasMany(Grant, { foreignKey: 'donor_id' });
Grant.belongsToMany(Organization, {
through: 'Grant_Organization',
foreignKey: 'grant_id',
otherKey: 'organization_id'
});
Grant.hasMany(Charge, { foreignKey: 'grant_id' });
};