working on new tables for payments

This commit is contained in:
Arjun Patel
2019-01-29 19:55:32 -08:00
parent ad26f7b6fd
commit d6643c32f9
8 changed files with 154 additions and 13 deletions
+11 -6
View File
@@ -1,5 +1,13 @@
module.exports = models => {
const { Donor, Grant, Cause, Region, Organization, Charge } = models;
const {
Donor,
Grant,
Cause,
Region,
Organization,
Charge,
PaymentPlan
} = models;
Donor.hasMany(Grant, { foreignKey: 'donor_id' });
@@ -20,12 +28,9 @@ module.exports = models => {
foreignKey: 'grant_id',
otherKey: 'organization_id'
});
Grant.hasMany(Charge, { foreignKey: 'grant_id' });
Donor.hasMany(Charge, {
foreignKey: 'user_id'
});
Organization.hasMany(Charge, {
Donor.hasOne(PaymentPlan, {
foreignKey: 'user_id'
});
};