mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
add server to monorepo.
This commit is contained in:
30
packages/server/src/repositories/SaleInvoiceRepository.ts
Normal file
30
packages/server/src/repositories/SaleInvoiceRepository.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import moment from 'moment';
|
||||
import { SaleInvoice } from 'models';
|
||||
import TenantRepository from '@/repositories/TenantRepository';
|
||||
|
||||
export default class SaleInvoiceRepository extends TenantRepository {
|
||||
/**
|
||||
* Gets the repository's model.
|
||||
*/
|
||||
get model() {
|
||||
return SaleInvoice.bindKnex(this.knex);
|
||||
}
|
||||
|
||||
dueInvoices(asDate = moment().format('YYYY-MM-DD'), withRelations) {
|
||||
return this.model
|
||||
.query()
|
||||
.modify('dueInvoices')
|
||||
.modify('notOverdue', asDate)
|
||||
.modify('fromDate', asDate)
|
||||
.withGraphFetched(withRelations);
|
||||
}
|
||||
|
||||
overdueInvoices(asDate = moment().format('YYYY-MM-DD'), withRelations) {
|
||||
return this.model
|
||||
.query()
|
||||
.modify('dueInvoices')
|
||||
.modify('overdue', asDate)
|
||||
.modify('fromDate', asDate)
|
||||
.withGraphFetched(withRelations);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user