mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 22:30:31 +00:00
refactor: import resource module to nestjs
This commit is contained in:
@@ -2,6 +2,7 @@ import { Knex } from 'knex';
|
||||
import { IItemEntryDTO } from '../TransactionItemEntry/ItemEntry.types';
|
||||
import { AttachmentLinkDTO } from '../Attachments/Attachments.types';
|
||||
import { Bill } from './models/Bill';
|
||||
import { IDynamicListFilter } from '../DynamicListing/DynamicFilter/DynamicFilter.types';
|
||||
|
||||
export interface IBillDTO {
|
||||
vendorId: number;
|
||||
@@ -42,12 +43,12 @@ export interface IBillEditDTO {
|
||||
attachments?: AttachmentLinkDTO[];
|
||||
}
|
||||
|
||||
// export interface IBillsFilter extends IDynamicListFilterDTO {
|
||||
// stringifiedFilterRoles?: string;
|
||||
// page: number;
|
||||
// pageSize: number;
|
||||
// filterQuery?: (q: any) => void;
|
||||
// }
|
||||
export interface IBillsFilter extends IDynamicListFilter {
|
||||
stringifiedFilterRoles?: string;
|
||||
page: number;
|
||||
pageSize: number;
|
||||
filterQuery?: (q: any) => void;
|
||||
}
|
||||
|
||||
export interface IBillCreatedPayload {
|
||||
// tenantId: number;
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import * as R from 'ramda';
|
||||
import { TransformerInjectable } from '@/modules/Transformer/TransformerInjectable.service';
|
||||
import { DynamicListService } from '@/modules/DynamicListing/DynamicList.service';
|
||||
import { Bill } from '../models/Bill';
|
||||
import { IFilterMeta, IPaginationMeta } from '@/interfaces/Model';
|
||||
import { BillTransformer } from './Bill.transformer';
|
||||
import { IBillsFilter } from '../Bills.types';
|
||||
|
||||
@Injectable()
|
||||
export class GetBillsService {
|
||||
constructor(
|
||||
private transformer: TransformerInjectable,
|
||||
private dynamicListService: DynamicListService,
|
||||
|
||||
@Inject(Bill.name) private billModel: typeof Bill,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Retrieve bills data table list.
|
||||
* @param {IBillsFilter} billsFilter -
|
||||
* @param {IBillsFilter} billsFilter -
|
||||
*/
|
||||
public async getBills(
|
||||
filterDTO: IBillsFilter,
|
||||
): Promise<{
|
||||
public async getBills(filterDTO: IBillsFilter): Promise<{
|
||||
bills: Bill;
|
||||
pagination: IPaginationMeta;
|
||||
filterMeta: IFilterMeta;
|
||||
@@ -32,7 +33,8 @@ export class GetBillsService {
|
||||
Bill,
|
||||
filter,
|
||||
);
|
||||
const { results, pagination } = await Bill.query()
|
||||
const { results, pagination } = await this.billModel
|
||||
.query()
|
||||
.onBuild((builder) => {
|
||||
builder.withGraphFetched('vendor');
|
||||
builder.withGraphFetched('entries.item');
|
||||
|
||||
Reference in New Issue
Block a user