mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
- feat: Sales estimates APIs.
- feat: Sales invoices APIs. - feat: Sales receipts APIs. - WIP: Sales payment receipts. - WIP: Purchases bills. - WIP: Purchases payments made.
This commit is contained in:
46
server/src/models/PaymentReceive.js
Normal file
46
server/src/models/PaymentReceive.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import { Model, mixin } from 'objection';
|
||||
import moment from 'moment';
|
||||
import TenantModel from '@/models/TenantModel';
|
||||
import CachableQueryBuilder from '@/lib/Cachable/CachableQueryBuilder';
|
||||
import CachableModel from '@/lib/Cachable/CachableModel';
|
||||
|
||||
export default class PaymentReceive extends mixin(TenantModel, [CachableModel]) {
|
||||
/**
|
||||
* Table name
|
||||
*/
|
||||
static get tableName() {
|
||||
return 'payment_receives';
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamps columns.
|
||||
*/
|
||||
get timestamps() {
|
||||
return ['created_at', 'updated_at'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend query builder model.
|
||||
*/
|
||||
static get QueryBuilder() {
|
||||
return CachableQueryBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Relationship mapping.
|
||||
*/
|
||||
static get relationMappings() {
|
||||
const PaymentReceiveEntry = require('@/models/PaymentReceiveEntry');
|
||||
|
||||
return {
|
||||
entries: {
|
||||
relation: Model.HasManyRelation,
|
||||
modelClass: this.relationBindKnex(PaymentReceiveEntry.default),
|
||||
join: {
|
||||
from: 'payment_receives.id',
|
||||
to: 'payment_receives_entries.payment_receive_id',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user