mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
refactor(nestjs): exportable modules
This commit is contained in:
@@ -13,6 +13,7 @@ import { CustomersController } from './Customers.controller';
|
||||
import { CustomersApplication } from './CustomersApplication.service';
|
||||
import { DeleteCustomer } from './commands/DeleteCustomer.service';
|
||||
import { CustomersExportable } from './CustomersExportable';
|
||||
import { CustomersImportable } from './CustomersImportable';
|
||||
|
||||
@Module({
|
||||
imports: [TenancyDatabaseModule],
|
||||
@@ -31,7 +32,8 @@ import { CustomersExportable } from './CustomersExportable';
|
||||
TenancyContext,
|
||||
TransformerInjectable,
|
||||
GetCustomerService,
|
||||
CustomersExportable
|
||||
CustomersExportable,
|
||||
CustomersImportable
|
||||
],
|
||||
})
|
||||
export class CustomersModule {}
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
// import { Inject, Service } from 'typedi';
|
||||
// import { Importable } from '@/services/Import/Importable';
|
||||
// import { CreateCustomer } from './CRUD/CreateCustomer';
|
||||
// import { Knex } from 'knex';
|
||||
// import { ICustomer, ICustomerNewDTO } from '@/interfaces';
|
||||
// import { CustomersSampleData } from './_SampleData';
|
||||
import { Knex } from 'knex';
|
||||
import { CustomersSampleData } from './_SampleData';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Importable } from '../Import/Importable';
|
||||
import { CreateCustomer } from './commands/CreateCustomer.service';
|
||||
import { CreateCustomerDto } from './dtos/CreateCustomer.dto';
|
||||
|
||||
// @Service()
|
||||
// export class CustomersImportable extends Importable {
|
||||
// @Inject()
|
||||
// private createCustomerService: CreateCustomer;
|
||||
@Injectable()
|
||||
export class CustomersImportable extends Importable {
|
||||
constructor(private readonly createCustomerService: CreateCustomer) {
|
||||
super();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Mapps the imported data to create a new customer service.
|
||||
// * @param {number} tenantId
|
||||
// * @param {ICustomerNewDTO} createDTO
|
||||
// * @param {Knex.Transaction} trx
|
||||
// * @returns {Promise<void>}
|
||||
// */
|
||||
// public async importable(
|
||||
// tenantId: number,
|
||||
// createDTO: ICustomerNewDTO,
|
||||
// trx?: Knex.Transaction<any, any[]>
|
||||
// ): Promise<void> {
|
||||
// await this.createCustomerService.createCustomer(tenantId, createDTO, trx);
|
||||
// }
|
||||
/**
|
||||
* Mapps the imported data to create a new customer service.
|
||||
* @param {number} tenantId
|
||||
* @param {ICustomerNewDTO} createDTO
|
||||
* @param {Knex.Transaction} trx
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
public async importable(
|
||||
createDTO: CreateCustomerDto,
|
||||
trx?: Knex.Transaction<any, any[]>,
|
||||
): Promise<void> {
|
||||
await this.createCustomerService.createCustomer(createDTO, trx);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Retrieves the sample data of customers used to download sample sheet.
|
||||
// */
|
||||
// public sampleData(): any[] {
|
||||
// return CustomersSampleData;
|
||||
// }
|
||||
// }
|
||||
/**
|
||||
* Retrieves the sample data of customers used to download sample sheet.
|
||||
*/
|
||||
public sampleData(): any[] {
|
||||
return CustomersSampleData;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user