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