refactor(nestjs): exportable modules

This commit is contained in:
Ahmed Bouhuolia
2025-04-08 22:44:24 +02:00
parent 04c25bd31a
commit e8f1fedf35
21 changed files with 408 additions and 408 deletions

View File

@@ -36,6 +36,7 @@ import { SendSaleReceiptMailProcess } from './processes/SendSaleReceiptMail.proc
import { MailModule } from '../Mail/Mail.module';
import { SendSaleReceiptMailQueue } from './constants';
import { SaleReceiptsExportable } from './commands/SaleReceiptsExportable';
import { SaleReceiptsImportable } from './commands/SaleReceiptsImportable';
@Module({
controllers: [SaleReceiptsController],
@@ -76,7 +77,8 @@ import { SaleReceiptsExportable } from './commands/SaleReceiptsExportable';
SaleReceiptInventoryTransactions,
SaleReceiptInventoryTransactionsSubscriber,
SendSaleReceiptMailProcess,
SaleReceiptsExportable
SaleReceiptsExportable,
SaleReceiptsImportable,
],
})
export class SaleReceiptsModule {}

View File

@@ -1,45 +1,44 @@
// import { Inject, Service } from 'typedi';
// import { Knex } from 'knex';
// import { IAccountCreateDTO, ISaleReceiptDTO } from '@/interfaces';
// import { CreateSaleReceipt } from './commands/CreateSaleReceipt.service';
// import { Importable } from '@/services/Import/Importable';
// import { SaleReceiptsSampleData } from './constants';
import { Injectable } from '@nestjs/common';
import { Knex } from 'knex';
import { CreateSaleReceipt } from './CreateSaleReceipt.service';
import { Importable } from '@/modules/Import/Importable';
import { CreateSaleReceiptDto } from '../dtos/SaleReceipt.dto';
import { SaleReceiptsSampleData } from '../constants';
// @Service()
// export class SaleReceiptsImportable extends Importable {
// @Inject()
// private createReceiptService: CreateSaleReceipt;
@Injectable()
export class SaleReceiptsImportable extends Importable {
constructor(private readonly createReceiptService: CreateSaleReceipt) {
super();
}
// /**
// * Importing to sale receipts service.
// * @param {number} tenantId
// * @param {IAccountCreateDTO} createAccountDTO
// * @returns
// */
// public importable(
// tenantId: number,
// createAccountDTO: ISaleReceiptDTO,
// trx?: Knex.Transaction
// ) {
// return this.createReceiptService.createSaleReceipt(
// tenantId,
// createAccountDTO,
// trx
// );
// }
/**
* Importing to sale receipts service.
* @param {number} tenantId
* @param {IAccountCreateDTO} createAccountDTO
* @returns
*/
public importable(
createAccountDTO: CreateSaleReceiptDto,
trx?: Knex.Transaction,
) {
return this.createReceiptService.createSaleReceipt(
createAccountDTO,
trx,
);
}
// /**
// * Concurrrency controlling of the importing process.
// * @returns {number}
// */
// public get concurrency() {
// return 1;
// }
/**
* Concurrrency controlling of the importing process.
* @returns {number}
*/
public get concurrency() {
return 1;
}
// /**
// * Retrieves the sample data that used to download accounts sample sheet.
// */
// public sampleData(): any[] {
// return SaleReceiptsSampleData;
// }
// }
/**
* Retrieves the sample data that used to download accounts sample sheet.
*/
public sampleData(): any[] {
return SaleReceiptsSampleData;
}
}