mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 04:10:32 +00:00
refactor(nestjs): export module
This commit is contained in:
@@ -24,6 +24,7 @@ import { LedgerModule } from '../Ledger/Ledger.module';
|
||||
import { AccountsModule } from '../Accounts/Accounts.module';
|
||||
import { GetCreditNotesService } from './queries/GetCreditNotes.service';
|
||||
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
||||
import { CreditNotesExportable } from './commands/CreditNotesExportable';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
@@ -53,6 +54,7 @@ import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
||||
CreditNoteBrandingTemplate,
|
||||
CreditNoteGLEntries,
|
||||
CreditNoteGLEntriesSubscriber,
|
||||
CreditNotesExportable
|
||||
],
|
||||
exports: [
|
||||
CreateCreditNoteService,
|
||||
|
||||
@@ -1,35 +1,34 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import { ICreditNotesQueryDTO } from '@/interfaces';
|
||||
// import { Exportable } from '@/services/Export/Exportable';
|
||||
// import ListCreditNotes from '../ListCreditNotes';
|
||||
import { Exportable } from '@/modules/Export/Exportable';
|
||||
import { CreditNoteApplication } from '../CreditNoteApplication.service';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { ICreditNotesQueryDTO } from '../types/CreditNotes.types';
|
||||
|
||||
// @Service()
|
||||
// export class CreditNotesExportable extends Exportable {
|
||||
// @Inject()
|
||||
// private getCreditNotes: ListCreditNotes;
|
||||
@Injectable()
|
||||
export class CreditNotesExportable extends Exportable {
|
||||
constructor(private readonly creditNotesApp: CreditNoteApplication) {
|
||||
super();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Retrieves the accounts data to exportable sheet.
|
||||
// * @param {number} tenantId -
|
||||
// * @param {IVendorCreditsQueryDTO} query -
|
||||
// * @returns {}
|
||||
// */
|
||||
// public exportable(tenantId: number, query: ICreditNotesQueryDTO) {
|
||||
// const filterQuery = (query) => {
|
||||
// query.withGraphFetched('branch');
|
||||
// query.withGraphFetched('warehouse');
|
||||
// };
|
||||
// const parsedQuery = {
|
||||
// sortOrder: 'desc',
|
||||
// columnSortBy: 'created_at',
|
||||
// ...query,
|
||||
// page: 1,
|
||||
// pageSize: 12000,
|
||||
// filterQuery,
|
||||
// } as ICreditNotesQueryDTO;
|
||||
/**
|
||||
* Retrieves the accounts data to exportable sheet.
|
||||
* @param {IVendorCreditsQueryDTO} query -
|
||||
*/
|
||||
public exportable(query: ICreditNotesQueryDTO) {
|
||||
const filterQuery = (query) => {
|
||||
query.withGraphFetched('branch');
|
||||
query.withGraphFetched('warehouse');
|
||||
};
|
||||
const parsedQuery = {
|
||||
sortOrder: 'desc',
|
||||
columnSortBy: 'created_at',
|
||||
...query,
|
||||
page: 1,
|
||||
pageSize: 12000,
|
||||
filterQuery,
|
||||
} as ICreditNotesQueryDTO;
|
||||
|
||||
// return this.getCreditNotes
|
||||
// .getCreditNotesList(tenantId, parsedQuery)
|
||||
// .then((output) => output.creditNotes);
|
||||
// }
|
||||
// }
|
||||
return this.creditNotesApp
|
||||
.getCreditNotes(parsedQuery)
|
||||
.then((output) => output.creditNotes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,13 @@ import { DiscountType } from '@/common/types/Discount';
|
||||
import { BaseModel } from '@/models/Model';
|
||||
import { Branch } from '@/modules/Branches/models/Branch.model';
|
||||
import { Customer } from '@/modules/Customers/models/Customer';
|
||||
import { ExportableModel } from '@/modules/Export/decorators/ExportableModel.decorator';
|
||||
import { TenantBaseModel } from '@/modules/System/models/TenantBaseModel';
|
||||
import { ItemEntry } from '@/modules/TransactionItemEntry/models/ItemEntry';
|
||||
import { Warehouse } from '@/modules/Warehouses/models/Warehouse.model';
|
||||
import { mixin, Model, raw } from 'objection';
|
||||
|
||||
@ExportableModel()
|
||||
export class CreditNote extends TenantBaseModel {
|
||||
public amount: number;
|
||||
public exchangeRate: number;
|
||||
|
||||
Reference in New Issue
Block a user