organize general routes

This commit is contained in:
Arjun Patel
2019-01-19 00:42:56 -08:00
parent 59c327d8df
commit fc2b73b715
18 changed files with 154 additions and 83 deletions
+5 -5
View File
@@ -1,21 +1,21 @@
module.exports = models => {
const { Donors, Grants, Causes, Regions, Organizations } = models;
const { Donor, Grant, Cause, Region, Organization } = models;
Donors.hasMany(Grants, { foreignKey: 'donor_id' });
Donor.hasMany(Grant, { foreignKey: 'donor_id' });
Grants.belongsToMany(Causes, {
Grant.belongsToMany(Cause, {
through: 'grants_causes',
foreignKey: 'grant_id',
otherKey: 'cause_id'
});
Grants.belongsToMany(Regions, {
Grant.belongsToMany(Region, {
through: 'grants_regions',
foreignKey: 'grant_id',
otherKey: 'region_id'
});
Grants.belongsToMany(Organizations, {
Grant.belongsToMany(Organization, {
through: 'grants_organizations',
foreignKey: 'grant_id',
otherKey: 'organization_id'