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:
@@ -7,7 +7,6 @@ import { ExportApplication } from './ExportApplication';
|
||||
import { ResourceModule } from '../Resource/Resource.module';
|
||||
import { RegisterTenancyModel } from '../Tenancy/TenancyModels/Tenancy.module';
|
||||
import { ImportModel } from '../Import/models/Import';
|
||||
import { ExportableResources } from './ExportResources';
|
||||
import { ExportableRegistry } from './ExportRegistery';
|
||||
import { TemplateInjectableModule } from '../TemplateInjectable/TemplateInjectable.module';
|
||||
import { ChromiumlyTenancyModule } from '../ChromiumlyTenancy/ChromiumlyTenancy.module';
|
||||
@@ -28,7 +27,6 @@ const models = [RegisterTenancyModel(ImportModel)];
|
||||
ExportPdf,
|
||||
ExportAls,
|
||||
ExportApplication,
|
||||
ExportableResources,
|
||||
ExportableRegistry
|
||||
],
|
||||
exports: [...models],
|
||||
|
||||
@@ -3,7 +3,6 @@ import * as xlsx from 'xlsx';
|
||||
import * as R from 'ramda';
|
||||
import { get } from 'lodash';
|
||||
import { sanitizeResourceName } from '../Import/_utils';
|
||||
import { ExportableResources } from './ExportResources';
|
||||
import { Errors, ExportFormat } from './common';
|
||||
import { flatDataCollections, getDataAccessor } from './utils';
|
||||
import { ExportPdf } from './ExportPdf';
|
||||
@@ -19,7 +18,6 @@ export class ExportResourceService {
|
||||
constructor(
|
||||
private readonly exportAls: ExportAls,
|
||||
private readonly exportPdf: ExportPdf,
|
||||
private readonly exportableResources: ExportableResources,
|
||||
private readonly resourceService: ResourceService,
|
||||
private readonly moduleRef: ModuleRef,
|
||||
) {}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { Global } from "@nestjs/common";
|
||||
|
||||
const exportableModels = new Map<string, boolean>();
|
||||
const exportableService = new Map<string, any>()
|
||||
|
||||
@@ -15,6 +17,9 @@ export function ExportableModel() {
|
||||
export function ExportableService({ name }: { name: string }) {
|
||||
return function (target: any) {
|
||||
exportableService.set(name, target);
|
||||
|
||||
// Apply the @Global() decorator to make the service globally available
|
||||
Global()(target);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user