refactor(nestjs): export module

This commit is contained in:
Ahmed Bouhuolia
2025-04-08 16:19:35 +02:00
parent 6287f8b6e3
commit 04c25bd31a
60 changed files with 748 additions and 504 deletions

View File

@@ -21,6 +21,7 @@ import { WriteTaxTransactionsItemEntries } from './WriteTaxTransactionsItemEntri
import { SyncItemTaxRateOnEditTaxRate } from './SyncItemTaxRateOnEditTaxRate';
import { RegisterTenancyModel } from '../Tenancy/TenancyModels/Tenancy.module';
import { TaxRateTransaction } from './models/TaxRateTransaction.model';
import { TaxRatesExportable } from './TaxRatesExportable';
const models = [RegisterTenancyModel(TaxRateTransaction)];
@@ -47,6 +48,7 @@ const models = [RegisterTenancyModel(TaxRateTransaction)];
SyncItemTaxRateOnEditTaxSubscriber,
WriteTaxTransactionsItemEntries,
SyncItemTaxRateOnEditTaxRate,
TaxRatesExportable
],
exports: [ItemEntriesTaxTransactions, ...models],
})

View File

@@ -1,18 +1,20 @@
// import { Inject, Service } from 'typedi';
// import { Exportable } from '../Export/Exportable';
// import { TaxRatesApplication } from './TaxRate.application';
import { ExportableService } from '../Export/decorators/ExportableModel.decorator';
import { Exportable } from '../Export/Exportable';
import { TaxRateModel } from './models/TaxRate.model';
import { TaxRatesApplication } from './TaxRate.application';
import { Injectable } from '@nestjs/common';
// @Service()
// export class TaxRatesExportable extends Exportable {
// @Inject()
// private taxRatesApplication: TaxRatesApplication;
@Injectable()
@ExportableService({ name: TaxRateModel.name })
export class TaxRatesExportable extends Exportable {
constructor(private readonly taxRatesApplication: TaxRatesApplication) {
super();
}
// /**
// * Retrieves the accounts data to exportable sheet.
// * @param {number} tenantId
// * @returns
// */
// public exportable(tenantId: number) {
// return this.taxRatesApplication.getTaxRates(tenantId);
// }
// }
/**
* Retrieves the accounts data to exportable sheet.
*/
public exportable() {
return this.taxRatesApplication.getTaxRates();
}
}

View File

@@ -5,7 +5,9 @@ import { mixin, Model, raw } from 'objection';
// import TaxRateMeta from './TaxRate.settings';
// import ModelSetting from './ModelSetting';
import { BaseModel } from '@/models/Model';
import { ExportableModel } from '@/modules/Export/decorators/ExportableModel.decorator';
@ExportableModel()
export class TaxRateModel extends BaseModel {
active!: boolean;
code!: string;