mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
refactor(nestjs): export module
This commit is contained in:
@@ -34,6 +34,7 @@ import { MailModule } from '../Mail/Mail.module';
|
||||
import { SendPaymentReceivedMailProcessor } from './processors/PaymentReceivedMailNotification.processor';
|
||||
import { BullModule } from '@nestjs/bull';
|
||||
import { SEND_PAYMENT_RECEIVED_MAIL_QUEUE } from './constants';
|
||||
import { PaymentsReceivedExportable } from './commands/PaymentsReceivedExportable';
|
||||
|
||||
@Module({
|
||||
controllers: [PaymentReceivesController],
|
||||
@@ -59,6 +60,7 @@ import { SEND_PAYMENT_RECEIVED_MAIL_QUEUE } from './constants';
|
||||
GetPaymentsReceivedService,
|
||||
SendPaymentReceiveMailNotification,
|
||||
SendPaymentReceivedMailProcessor,
|
||||
PaymentsReceivedExportable
|
||||
],
|
||||
exports: [
|
||||
PaymentReceivesApplication,
|
||||
|
||||
@@ -1,39 +1,34 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import { IAccountsStructureType, IPaymentsReceivedFilter } from '@/interfaces';
|
||||
// import { Exportable } from '@/services/Export/Exportable';
|
||||
// import { PaymentReceivesApplication } from './PaymentReceived.application';
|
||||
// import { EXPORT_SIZE_LIMIT } from '@/services/Export/constants';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { PaymentReceivesApplication } from '../PaymentReceived.application';
|
||||
import { IPaymentsReceivedFilter } from '../types/PaymentReceived.types';
|
||||
import { EXPORT_SIZE_LIMIT } from '@/modules/Export/constants';
|
||||
import { Exportable } from '@/modules/Export/Exportable';
|
||||
|
||||
// @Service()
|
||||
// export class PaymentsReceivedExportable extends Exportable {
|
||||
// @Inject()
|
||||
// private paymentReceivedApp: PaymentReceivesApplication;
|
||||
@Injectable()
|
||||
export class PaymentsReceivedExportable extends Exportable {
|
||||
constructor(private readonly paymentReceivedApp: PaymentReceivesApplication) {
|
||||
super();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Retrieves the accounts data to exportable sheet.
|
||||
// * @param {number} tenantId
|
||||
// * @param {IPaymentsReceivedFilter} query -
|
||||
// * @returns
|
||||
// */
|
||||
// public exportable(tenantId: number, query: IPaymentsReceivedFilter) {
|
||||
// const filterQuery = (builder) => {
|
||||
// builder.withGraphFetched('entries.invoice');
|
||||
// builder.withGraphFetched('branch');
|
||||
// };
|
||||
|
||||
// const parsedQuery = {
|
||||
// sortOrder: 'desc',
|
||||
// columnSortBy: 'created_at',
|
||||
// inactiveMode: false,
|
||||
// ...query,
|
||||
// structure: IAccountsStructureType.Flat,
|
||||
// page: 1,
|
||||
// pageSize: EXPORT_SIZE_LIMIT,
|
||||
// filterQuery,
|
||||
// } as IPaymentsReceivedFilter;
|
||||
|
||||
// return this.paymentReceivedApp
|
||||
// .getPaymentReceives(tenantId, parsedQuery)
|
||||
// .then((output) => output.paymentReceives);
|
||||
// }
|
||||
// }
|
||||
/**
|
||||
* Retrieves the accounts data to exportable sheet.
|
||||
* @param {number} tenantId
|
||||
* @param {IPaymentsReceivedFilter} query -
|
||||
* @returns
|
||||
*/
|
||||
public exportable(query: IPaymentsReceivedFilter) {
|
||||
const filterQuery = (builder) => {
|
||||
builder.withGraphFetched('entries.invoice');
|
||||
builder.withGraphFetched('branch');
|
||||
};
|
||||
const parsedQuery = {
|
||||
page: 1,
|
||||
pageSize: EXPORT_SIZE_LIMIT,
|
||||
filterQuery,
|
||||
...query
|
||||
};
|
||||
return this.paymentReceivedApp
|
||||
.getPaymentsReceived(parsedQuery)
|
||||
.then((output) => output.paymentReceives);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { Model } from 'objection';
|
||||
import { PaymentReceivedEntry } from './PaymentReceivedEntry';
|
||||
import { TenantBaseModel } from '@/modules/System/models/TenantBaseModel';
|
||||
import { ExportableModel } from '@/modules/Export/decorators/ExportableModel.decorator';
|
||||
|
||||
@ExportableModel()
|
||||
export class PaymentReceived extends TenantBaseModel {
|
||||
customerId: number;
|
||||
paymentDate: string;
|
||||
|
||||
Reference in New Issue
Block a user