fix: validate payment made entries ids exists.

fix: retrieve payment made and receive details.
This commit is contained in:
Ahmed Bouhuolia
2020-11-04 00:23:58 +02:00
parent 083a2dfbc5
commit 1738a333c7
6 changed files with 132 additions and 38 deletions

View File

@@ -1,4 +1,4 @@
import { mixin } from 'objection';
import { mixin, Model } from 'objection';
import TenantModel from 'models/TenantModel';
export default class BillPaymentEntry extends TenantModel {
@@ -15,4 +15,22 @@ export default class BillPaymentEntry extends TenantModel {
get timestamps() {
return [];
}
/**
* Relationship mapping.
*/
static get relationMappings() {
const Bill = require('models/Bill');
return {
bill: {
relation: Model.BelongsToOneRelation,
modelClass: Bill.default,
join: {
from: 'bills_payments_entries.billId',
to: 'bills.id',
},
},
};
}
}