mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
refactor(nestjs): exportable modules
This commit is contained in:
@@ -1,45 +1,43 @@
|
|||||||
// import { Inject, Service } from 'typedi';
|
import { Knex } from 'knex';
|
||||||
// import { Knex } from 'knex';
|
import { Injectable } from '@nestjs/common';
|
||||||
// import { IAccountCreateDTO } from '@/interfaces';
|
import { Importable } from '../Import/Importable';
|
||||||
// import { CreateAccount } from './CreateAccount.service';
|
import { AccountsSampleData } from './AccountsImportable.SampleData';
|
||||||
// import { Importable } from '../Import/Importable';
|
import { CreateAccountDTO } from './CreateAccount.dto';
|
||||||
// import { AccountsSampleData } from './AccountsImportable.SampleData';
|
import { CreateAccountService } from './CreateAccount.service';
|
||||||
|
|
||||||
// @Service()
|
@Injectable()
|
||||||
// export class AccountsImportable extends Importable {
|
export class AccountsImportable extends Importable {
|
||||||
// @Inject()
|
constructor(private readonly createAccountService: CreateAccountService) {
|
||||||
// private createAccountService: CreateAccount;
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Importing to account service.
|
* Importing to account service.
|
||||||
// * @param {number} tenantId
|
* @param {CreateAccountDTO} createAccountDTO - Create account dto.
|
||||||
// * @param {IAccountCreateDTO} createAccountDTO
|
* @returns
|
||||||
// * @returns
|
*/
|
||||||
// */
|
public importable(
|
||||||
// public importable(
|
createAccountDTO: CreateAccountDTO,
|
||||||
// tenantId: number,
|
trx?: Knex.Transaction,
|
||||||
// createAccountDTO: IAccountCreateDTO,
|
) {
|
||||||
// trx?: Knex.Transaction
|
return this.createAccountService.createAccount(
|
||||||
// ) {
|
createAccountDTO,
|
||||||
// return this.createAccountService.createAccount(
|
trx,
|
||||||
// tenantId,
|
);
|
||||||
// createAccountDTO,
|
}
|
||||||
// trx
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Concurrrency controlling of the importing process.
|
* Concurrrency controlling of the importing process.
|
||||||
// * @returns {number}
|
* @returns {number}
|
||||||
// */
|
*/
|
||||||
// public get concurrency() {
|
public get concurrency() {
|
||||||
// return 1;
|
return 1;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Retrieves the sample data that used to download accounts sample sheet.
|
* Retrieves the sample data that used to download accounts sample sheet.
|
||||||
// */
|
*/
|
||||||
// public sampleData(): any[] {
|
public sampleData(): any[] {
|
||||||
// return AccountsSampleData;
|
return AccountsSampleData;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ import { CreateUncategorizedTransactionService } from './commands/CreateUncatego
|
|||||||
import { CategorizeTransactionAsExpense } from './commands/CategorizeTransactionAsExpense';
|
import { CategorizeTransactionAsExpense } from './commands/CategorizeTransactionAsExpense';
|
||||||
import { BankingTransactionsModule } from '../BankingTransactions/BankingTransactions.module';
|
import { BankingTransactionsModule } from '../BankingTransactions/BankingTransactions.module';
|
||||||
import { ExpensesModule } from '../Expenses/Expenses.module';
|
import { ExpensesModule } from '../Expenses/Expenses.module';
|
||||||
|
import { UncategorizedTransactionsImportable } from './commands/UncategorizedTransactionsImportable';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [BankingTransactionsModule, ExpensesModule],
|
imports: [BankingTransactionsModule, ExpensesModule],
|
||||||
providers: [
|
providers: [
|
||||||
CreateUncategorizedTransactionService,
|
CreateUncategorizedTransactionService,
|
||||||
CategorizeTransactionAsExpense,
|
CategorizeTransactionAsExpense,
|
||||||
|
UncategorizedTransactionsImportable
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
CreateUncategorizedTransactionService,
|
CreateUncategorizedTransactionService,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { CustomersController } from './Customers.controller';
|
|||||||
import { CustomersApplication } from './CustomersApplication.service';
|
import { CustomersApplication } from './CustomersApplication.service';
|
||||||
import { DeleteCustomer } from './commands/DeleteCustomer.service';
|
import { DeleteCustomer } from './commands/DeleteCustomer.service';
|
||||||
import { CustomersExportable } from './CustomersExportable';
|
import { CustomersExportable } from './CustomersExportable';
|
||||||
|
import { CustomersImportable } from './CustomersImportable';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [TenancyDatabaseModule],
|
imports: [TenancyDatabaseModule],
|
||||||
@@ -31,7 +32,8 @@ import { CustomersExportable } from './CustomersExportable';
|
|||||||
TenancyContext,
|
TenancyContext,
|
||||||
TransformerInjectable,
|
TransformerInjectable,
|
||||||
GetCustomerService,
|
GetCustomerService,
|
||||||
CustomersExportable
|
CustomersExportable,
|
||||||
|
CustomersImportable
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class CustomersModule {}
|
export class CustomersModule {}
|
||||||
|
|||||||
@@ -1,34 +1,34 @@
|
|||||||
// import { Inject, Service } from 'typedi';
|
import { Knex } from 'knex';
|
||||||
// import { Importable } from '@/services/Import/Importable';
|
import { CustomersSampleData } from './_SampleData';
|
||||||
// import { CreateCustomer } from './CRUD/CreateCustomer';
|
import { Injectable } from '@nestjs/common';
|
||||||
// import { Knex } from 'knex';
|
import { Importable } from '../Import/Importable';
|
||||||
// import { ICustomer, ICustomerNewDTO } from '@/interfaces';
|
import { CreateCustomer } from './commands/CreateCustomer.service';
|
||||||
// import { CustomersSampleData } from './_SampleData';
|
import { CreateCustomerDto } from './dtos/CreateCustomer.dto';
|
||||||
|
|
||||||
// @Service()
|
@Injectable()
|
||||||
// export class CustomersImportable extends Importable {
|
export class CustomersImportable extends Importable {
|
||||||
// @Inject()
|
constructor(private readonly createCustomerService: CreateCustomer) {
|
||||||
// private createCustomerService: CreateCustomer;
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Mapps the imported data to create a new customer service.
|
* Mapps the imported data to create a new customer service.
|
||||||
// * @param {number} tenantId
|
* @param {number} tenantId
|
||||||
// * @param {ICustomerNewDTO} createDTO
|
* @param {ICustomerNewDTO} createDTO
|
||||||
// * @param {Knex.Transaction} trx
|
* @param {Knex.Transaction} trx
|
||||||
// * @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
// */
|
*/
|
||||||
// public async importable(
|
public async importable(
|
||||||
// tenantId: number,
|
createDTO: CreateCustomerDto,
|
||||||
// createDTO: ICustomerNewDTO,
|
trx?: Knex.Transaction<any, any[]>,
|
||||||
// trx?: Knex.Transaction<any, any[]>
|
): Promise<void> {
|
||||||
// ): Promise<void> {
|
await this.createCustomerService.createCustomer(createDTO, trx);
|
||||||
// await this.createCustomerService.createCustomer(tenantId, createDTO, trx);
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Retrieves the sample data of customers used to download sample sheet.
|
* Retrieves the sample data of customers used to download sample sheet.
|
||||||
// */
|
*/
|
||||||
// public sampleData(): any[] {
|
public sampleData(): any[] {
|
||||||
// return CustomersSampleData;
|
return CustomersSampleData;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import { BranchesModule } from '../Branches/Branches.module';
|
|||||||
import { GetExpensesService } from './queries/GetExpenses.service';
|
import { GetExpensesService } from './queries/GetExpenses.service';
|
||||||
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
||||||
import { ExpensesExportable } from './ExpensesExportable';
|
import { ExpensesExportable } from './ExpensesExportable';
|
||||||
|
import { ExpensesImportable } from './ExpensesImportable';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [LedgerModule, BranchesModule, DynamicListModule],
|
imports: [LedgerModule, BranchesModule, DynamicListModule],
|
||||||
@@ -38,7 +39,8 @@ import { ExpensesExportable } from './ExpensesExportable';
|
|||||||
ExpenseGLEntriesStorageService,
|
ExpenseGLEntriesStorageService,
|
||||||
ExpenseGLEntriesService,
|
ExpenseGLEntriesService,
|
||||||
GetExpensesService,
|
GetExpensesService,
|
||||||
ExpensesExportable
|
ExpensesExportable,
|
||||||
|
ExpensesImportable
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class ExpensesModule {}
|
export class ExpensesModule {}
|
||||||
|
|||||||
@@ -1,46 +1,41 @@
|
|||||||
// import { Inject, Service } from 'typedi';
|
import { Knex } from 'knex';
|
||||||
// import { Knex } from 'knex';
|
import { Importable } from '../Import/Importable';
|
||||||
// import { IExpenseCreateDTO } from '@/interfaces';
|
import { ExpensesSampleData } from './constants';
|
||||||
// import { Importable } from '../Import/Importable';
|
import { Injectable } from '@nestjs/common';
|
||||||
// import { CreateExpense } from './CRUD/CreateExpense.service';
|
import { CreateExpense } from './commands/CreateExpense.service';
|
||||||
// import { ExpensesSampleData } from './constants';
|
import { CreateExpenseDto } from './dtos/Expense.dto';
|
||||||
|
|
||||||
// @Service()
|
@Injectable()
|
||||||
// export class ExpensesImportable extends Importable {
|
export class ExpensesImportable extends Importable {
|
||||||
// @Inject()
|
constructor(private readonly createExpenseService: CreateExpense) {
|
||||||
// private createExpenseService: CreateExpense;
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Importing to account service.
|
* Importing to account service.
|
||||||
// * @param {number} tenantId
|
* @param {number} tenantId
|
||||||
// * @param {IAccountCreateDTO} createAccountDTO
|
* @param {IAccountCreateDTO} createAccountDTO
|
||||||
// * @returns
|
* @returns
|
||||||
// */
|
*/
|
||||||
// public importable(
|
public importable(
|
||||||
// tenantId: number,
|
createAccountDTO: CreateExpenseDto,
|
||||||
// createAccountDTO: IExpenseCreateDTO,
|
trx?: Knex.Transaction,
|
||||||
// trx?: Knex.Transaction
|
) {
|
||||||
// ) {
|
return this.createExpenseService.newExpense(createAccountDTO, trx);
|
||||||
// return this.createExpenseService.newExpense(
|
}
|
||||||
// tenantId,
|
|
||||||
// createAccountDTO,
|
|
||||||
// {},
|
|
||||||
// trx
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Concurrrency controlling of the importing process.
|
* Concurrrency controlling of the importing process.
|
||||||
// * @returns {number}
|
* @returns {number}
|
||||||
// */
|
*/
|
||||||
// public get concurrency() {
|
public get concurrency() {
|
||||||
// return 1;
|
return 1;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Retrieves the sample data that used to download accounts sample sheet.
|
* Retrieves the sample data that used to download accounts sample sheet.
|
||||||
// */
|
*/
|
||||||
// public sampleData(): any[] {
|
public sampleData(): any[] {
|
||||||
// return ExpensesSampleData;
|
return ExpensesSampleData;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|||||||
@@ -1,38 +1,32 @@
|
|||||||
// import { Inject, Service } from 'typedi';
|
import { Importable } from '../Import/Importable';
|
||||||
// import ItemCategoriesService from './ItemCategoriesService';
|
import { Knex } from 'knex';
|
||||||
// import { Importable } from '../Import/Importable';
|
import { ItemCategoriesSampleData } from './constants';
|
||||||
// import { Knex } from 'knex';
|
import { Injectable } from '@nestjs/common';
|
||||||
// import { IItemCategoryOTD } from '@/interfaces';
|
import { CreateItemCategoryDto } from './dtos/ItemCategory.dto';
|
||||||
// import { ItemCategoriesSampleData } from './constants';
|
import { ItemCategoryApplication } from './ItemCategory.application';
|
||||||
|
|
||||||
// @Service()
|
@Injectable()
|
||||||
// export class ItemCategoriesImportable extends Importable {
|
export class ItemCategoriesImportable extends Importable {
|
||||||
// @Inject()
|
constructor(private readonly itemCategoriesApp: ItemCategoryApplication) {
|
||||||
// private itemCategoriesService: ItemCategoriesService;
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Importing to create new item category service.
|
* Importing to create new item category service.
|
||||||
// * @param {number} tenantId
|
* @param {CreateItemCategoryDto} createDTO
|
||||||
// * @param {any} createDTO
|
* @param {Knex.Transaction} trx
|
||||||
// * @param {Knex.Transaction} trx
|
*/
|
||||||
// */
|
public async importable(
|
||||||
// public async importable(
|
createDTO: CreateItemCategoryDto,
|
||||||
// tenantId: number,
|
trx?: Knex.Transaction,
|
||||||
// createDTO: IItemCategoryOTD,
|
) {
|
||||||
// trx?: Knex.Transaction
|
await this.itemCategoriesApp.createItemCategory(createDTO, trx);
|
||||||
// ) {
|
}
|
||||||
// await this.itemCategoriesService.newItemCategory(
|
|
||||||
// tenantId,
|
|
||||||
// createDTO,
|
|
||||||
// {},
|
|
||||||
// trx
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Item categories sample data used to download sample sheet file.
|
* Item categories sample data used to download sample sheet file.
|
||||||
// */
|
*/
|
||||||
// public sampleData(): any[] {
|
public sampleData(): any[] {
|
||||||
// return ItemCategoriesSampleData;
|
return ItemCategoriesSampleData;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { EditItemCategoryService } from './commands/EditItemCategory.service';
|
|||||||
import { GetItemCategoryService } from './queries/GetItemCategory.service';
|
import { GetItemCategoryService } from './queries/GetItemCategory.service';
|
||||||
import { GetItemCategoriesService } from './queries/GetItemCategories.service';
|
import { GetItemCategoriesService } from './queries/GetItemCategories.service';
|
||||||
import { CreateItemCategoryDto, EditItemCategoryDto } from './dtos/ItemCategory.dto';
|
import { CreateItemCategoryDto, EditItemCategoryDto } from './dtos/ItemCategory.dto';
|
||||||
|
import { Knex } from 'knex';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ItemCategoryApplication {
|
export class ItemCategoryApplication {
|
||||||
@@ -33,8 +34,9 @@ export class ItemCategoryApplication {
|
|||||||
*/
|
*/
|
||||||
public createItemCategory(
|
public createItemCategory(
|
||||||
itemCategoryDTO: CreateItemCategoryDto,
|
itemCategoryDTO: CreateItemCategoryDto,
|
||||||
|
trx?: Knex.Transaction,
|
||||||
) {
|
) {
|
||||||
return this.createItemCategoryService.newItemCategory(itemCategoryDTO);
|
return this.createItemCategoryService.newItemCategory(itemCategoryDTO, trx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { TenancyContext } from '../Tenancy/TenancyContext.service';
|
|||||||
import { GetItemCategoriesService } from './queries/GetItemCategories.service';
|
import { GetItemCategoriesService } from './queries/GetItemCategories.service';
|
||||||
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
||||||
import { ItemCategoriesExportable } from './ItemCategoriesExportable';
|
import { ItemCategoriesExportable } from './ItemCategoriesExportable';
|
||||||
|
import { ItemCategoriesImportable } from './ItemCategoriesImportable';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [TenancyDatabaseModule, DynamicListModule],
|
imports: [TenancyDatabaseModule, DynamicListModule],
|
||||||
@@ -27,6 +28,7 @@ import { ItemCategoriesExportable } from './ItemCategoriesExportable';
|
|||||||
ItemCategoriesExportable,
|
ItemCategoriesExportable,
|
||||||
TransformerInjectable,
|
TransformerInjectable,
|
||||||
TenancyContext,
|
TenancyContext,
|
||||||
|
ItemCategoriesImportable
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class ItemCategoryModule {}
|
export class ItemCategoryModule {}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import { ManualJournalWriteGLSubscriber } from './commands/ManualJournalGLEntrie
|
|||||||
import { ManualJournalGLEntries } from './commands/ManualJournalGLEntries';
|
import { ManualJournalGLEntries } from './commands/ManualJournalGLEntries';
|
||||||
import { LedgerModule } from '../Ledger/Ledger.module';
|
import { LedgerModule } from '../Ledger/Ledger.module';
|
||||||
import { ManualJournalsExportable } from './commands/ManualJournalExportable';
|
import { ManualJournalsExportable } from './commands/ManualJournalExportable';
|
||||||
|
import { ManualJournalImportable } from './commands/ManualJournalsImport';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [BranchesModule, LedgerModule],
|
imports: [BranchesModule, LedgerModule],
|
||||||
@@ -35,7 +36,8 @@ import { ManualJournalsExportable } from './commands/ManualJournalExportable';
|
|||||||
GetManualJournal,
|
GetManualJournal,
|
||||||
ManualJournalGLEntries,
|
ManualJournalGLEntries,
|
||||||
ManualJournalWriteGLSubscriber,
|
ManualJournalWriteGLSubscriber,
|
||||||
ManualJournalsExportable
|
ManualJournalsExportable,
|
||||||
|
ManualJournalImportable
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class ManualJournalsModule {}
|
export class ManualJournalsModule {}
|
||||||
|
|||||||
@@ -1,60 +1,57 @@
|
|||||||
// import { Inject } from 'typedi';
|
import { Knex } from 'knex';
|
||||||
// import { Knex } from 'knex';
|
import * as Yup from 'yup';
|
||||||
// import * as Yup from 'yup';
|
import { Importable } from '../../Import/Importable';
|
||||||
// import { Importable } from '../../Import/Importable';
|
import { CreateManualJournalService } from './CreateManualJournal.service';
|
||||||
// import { CreateManualJournalService } from './CreateManualJournal.service';
|
import { ImportableContext } from '../../Import/interfaces';
|
||||||
// import { IManualJournalDTO } from '@/interfaces';
|
import { ManualJournalsSampleData } from '../constants';
|
||||||
// import { ImportableContext } from '../../Import/interfaces';
|
import { CreateManualJournalDto } from '../dtos/ManualJournal.dto';
|
||||||
// import { ManualJournalsSampleData } from '../constants';
|
|
||||||
|
|
||||||
// export class ManualJournalImportable extends Importable {
|
export class ManualJournalImportable extends Importable {
|
||||||
// @Inject()
|
constructor(
|
||||||
// private createManualJournalService: CreateManualJournalService;
|
private readonly createManualJournalService: CreateManualJournalService,
|
||||||
|
) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Importing to account service.
|
* Importing to account service.
|
||||||
// * @param {number} tenantId
|
* @param {CreateManualJournalDto} createAccountDTO
|
||||||
// * @param {IAccountCreateDTO} createAccountDTO
|
*/
|
||||||
// * @returns
|
public importable(
|
||||||
// */
|
createJournalDTO: CreateManualJournalDto,
|
||||||
// public importable(
|
trx?: Knex.Transaction,
|
||||||
// tenantId: number,
|
) {
|
||||||
// createJournalDTO: IManualJournalDTO,
|
return this.createManualJournalService.makeJournalEntries(
|
||||||
// trx?: Knex.Transaction
|
createJournalDTO,
|
||||||
// ) {
|
trx,
|
||||||
// return this.createManualJournalService.makeJournalEntries(
|
);
|
||||||
// tenantId,
|
}
|
||||||
// createJournalDTO,
|
|
||||||
// {},
|
|
||||||
// trx
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Transformes the DTO before passing it to importable and validation.
|
* Transformes the DTO before passing it to importable and validation.
|
||||||
// * @param {Record<string, any>} createDTO
|
* @param {Record<string, any>} createDTO
|
||||||
// * @param {ImportableContext} context
|
* @param {ImportableContext} context
|
||||||
// * @returns {Record<string, any>}
|
* @returns {Record<string, any>}
|
||||||
// */
|
*/
|
||||||
// public transform(createDTO: Record<string, any>, context: ImportableContext) {
|
public transform(createDTO: Record<string, any>, context: ImportableContext) {
|
||||||
// return createDTO;
|
return createDTO;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Params validation schema.
|
* Params validation schema.
|
||||||
// * @returns {ValidationSchema[]}
|
* @returns {ValidationSchema[]}
|
||||||
// */
|
*/
|
||||||
// public paramsValidationSchema() {
|
public paramsValidationSchema() {
|
||||||
// return Yup.object().shape({
|
return Yup.object().shape({
|
||||||
// autoIncrement: Yup.boolean(),
|
autoIncrement: Yup.boolean(),
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Retrieves the sample data of manual journals that used to download sample sheet.
|
* Retrieves the sample data of manual journals that used to download sample sheet.
|
||||||
// * @returns {Record<string, any>}
|
* @returns {Record<string, any>}
|
||||||
// */
|
*/
|
||||||
// public sampleData(): Record<string, any>[] {
|
public sampleData(): Record<string, any>[] {
|
||||||
// return ManualJournalsSampleData;
|
return ManualJournalsSampleData;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import { SendPaymentReceivedMailProcessor } from './processors/PaymentReceivedMa
|
|||||||
import { BullModule } from '@nestjs/bull';
|
import { BullModule } from '@nestjs/bull';
|
||||||
import { SEND_PAYMENT_RECEIVED_MAIL_QUEUE } from './constants';
|
import { SEND_PAYMENT_RECEIVED_MAIL_QUEUE } from './constants';
|
||||||
import { PaymentsReceivedExportable } from './commands/PaymentsReceivedExportable';
|
import { PaymentsReceivedExportable } from './commands/PaymentsReceivedExportable';
|
||||||
|
import { PaymentsReceivedImportable } from './commands/PaymentsReceivedImportable';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [PaymentReceivesController],
|
controllers: [PaymentReceivesController],
|
||||||
@@ -60,7 +61,8 @@ import { PaymentsReceivedExportable } from './commands/PaymentsReceivedExportabl
|
|||||||
GetPaymentsReceivedService,
|
GetPaymentsReceivedService,
|
||||||
SendPaymentReceiveMailNotification,
|
SendPaymentReceiveMailNotification,
|
||||||
SendPaymentReceivedMailProcessor,
|
SendPaymentReceivedMailProcessor,
|
||||||
PaymentsReceivedExportable
|
PaymentsReceivedExportable,
|
||||||
|
PaymentsReceivedImportable
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
PaymentReceivesApplication,
|
PaymentReceivesApplication,
|
||||||
|
|||||||
@@ -1,46 +1,45 @@
|
|||||||
// import { Inject, Service } from 'typedi';
|
import { Knex } from 'knex';
|
||||||
// import { Knex } from 'knex';
|
import { CreatePaymentReceivedDto } from '../dtos/PaymentReceived.dto';
|
||||||
// import { IPaymentReceivedCreateDTO } from '@/interfaces';
|
import { Injectable } from '@nestjs/common';
|
||||||
// import { Importable } from '@/services/Import/Importable';
|
import { PaymentsReceiveSampleData } from '../constants';
|
||||||
// import { CreatePaymentReceived } from './commands/CreatePaymentReceived.serivce';
|
import { CreatePaymentReceivedService } from './CreatePaymentReceived.serivce';
|
||||||
// import { PaymentsReceiveSampleData } from './constants';
|
import { Importable } from '@/modules/Import/Importable';
|
||||||
|
|
||||||
// @Service()
|
@Injectable()
|
||||||
// export class PaymentsReceivedImportable extends Importable {
|
export class PaymentsReceivedImportable extends Importable {
|
||||||
// @Inject()
|
constructor(
|
||||||
// private createPaymentReceiveService: CreatePaymentReceived;
|
private readonly createPaymentReceiveService: CreatePaymentReceivedService,
|
||||||
|
) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Importing to account service.
|
* Importing to account service.
|
||||||
// * @param {number} tenantId
|
* @param {CreatePaymentReceivedDto} createAccountDTO
|
||||||
// * @param {IAccountCreateDTO} createAccountDTO
|
* @returns
|
||||||
// * @returns
|
*/
|
||||||
// */
|
public importable(
|
||||||
// public importable(
|
createPaymentDTO: CreatePaymentReceivedDto,
|
||||||
// tenantId: number,
|
trx?: Knex.Transaction,
|
||||||
// createPaymentDTO: IPaymentReceivedCreateDTO,
|
) {
|
||||||
// trx?: Knex.Transaction
|
return this.createPaymentReceiveService.createPaymentReceived(
|
||||||
// ) {
|
createPaymentDTO,
|
||||||
// return this.createPaymentReceiveService.createPaymentReceived(
|
trx,
|
||||||
// tenantId,
|
);
|
||||||
// createPaymentDTO,
|
}
|
||||||
// {},
|
|
||||||
// trx
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Concurrrency controlling of the importing process.
|
* Concurrrency controlling of the importing process.
|
||||||
// * @returns {number}
|
* @returns {number}
|
||||||
// */
|
*/
|
||||||
// public get concurrency() {
|
public get concurrency() {
|
||||||
// return 1;
|
return 1;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Retrieves the sample data that used to download accounts sample sheet.
|
* Retrieves the sample data that used to download accounts sample sheet.
|
||||||
// */
|
*/
|
||||||
// public sampleData(): any[] {
|
public sampleData(): any[] {
|
||||||
// return PaymentsReceiveSampleData;
|
return PaymentsReceiveSampleData;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import { SaleEstimatePdfTemplate } from '../SaleInvoices/queries/SaleEstimatePdf
|
|||||||
import { PdfTemplatesModule } from '../PdfTemplate/PdfTemplates.module';
|
import { PdfTemplatesModule } from '../PdfTemplate/PdfTemplates.module';
|
||||||
import { SendSaleEstimateMailQueue } from './types/SaleEstimates.types';
|
import { SendSaleEstimateMailQueue } from './types/SaleEstimates.types';
|
||||||
import { SaleEstimatesExportable } from './SaleEstimatesExportable';
|
import { SaleEstimatesExportable } from './SaleEstimatesExportable';
|
||||||
|
import { SaleEstimatesImportable } from './SaleEstimatesImportable';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -76,7 +77,8 @@ import { SaleEstimatesExportable } from './SaleEstimatesExportable';
|
|||||||
SendSaleEstimateMail,
|
SendSaleEstimateMail,
|
||||||
GetSaleEstimatePdf,
|
GetSaleEstimatePdf,
|
||||||
SaleEstimatePdfTemplate,
|
SaleEstimatePdfTemplate,
|
||||||
SaleEstimatesExportable
|
SaleEstimatesExportable,
|
||||||
|
SaleEstimatesImportable
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class SaleEstimatesModule {}
|
export class SaleEstimatesModule {}
|
||||||
|
|||||||
@@ -1,45 +1,45 @@
|
|||||||
// import { Inject, Service } from 'typedi';
|
import { Knex } from 'knex';
|
||||||
// import { Knex } from 'knex';
|
import { CreateSaleEstimate } from './commands/CreateSaleEstimate.service';
|
||||||
// import { ISaleEstimateDTO } from '@/interfaces';
|
import { SaleEstimatesSampleData } from './constants';
|
||||||
// import { CreateSaleEstimate } from './commands/CreateSaleEstimate.service';
|
import { Injectable } from '@nestjs/common';
|
||||||
// import { Importable } from '@/services/Import/Importable';
|
import { CreateSaleEstimateDto } from './dtos/SaleEstimate.dto';
|
||||||
// import { SaleEstimatesSampleData } from './constants';
|
import { Importable } from '../Import/Importable';
|
||||||
|
|
||||||
// @Service()
|
@Injectable()
|
||||||
// export class SaleEstimatesImportable extends Importable {
|
export class SaleEstimatesImportable extends Importable{
|
||||||
// @Inject()
|
constructor(
|
||||||
// private createEstimateService: CreateSaleEstimate;
|
private readonly createEstimateService: CreateSaleEstimate
|
||||||
|
) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Importing to account service.
|
* Importing to account service.
|
||||||
// * @param {number} tenantId
|
* @param {CreateSaleEstimateDto} createAccountDTO
|
||||||
// * @param {IAccountCreateDTO} createAccountDTO
|
* @returns
|
||||||
// * @returns
|
*/
|
||||||
// */
|
public importable(
|
||||||
// public importable(
|
createEstimateDTO: CreateSaleEstimateDto,
|
||||||
// tenantId: number,
|
trx?: Knex.Transaction
|
||||||
// createEstimateDTO: ISaleEstimateDTO,
|
) {
|
||||||
// trx?: Knex.Transaction
|
return this.createEstimateService.createEstimate(
|
||||||
// ) {
|
createEstimateDTO,
|
||||||
// return this.createEstimateService.createEstimate(
|
trx
|
||||||
// tenantId,
|
);
|
||||||
// createEstimateDTO,
|
}
|
||||||
// trx
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Concurrrency controlling of the importing process.
|
* Concurrrency controlling of the importing process.
|
||||||
// * @returns {number}
|
* @returns {number}
|
||||||
// */
|
*/
|
||||||
// public get concurrency() {
|
public get concurrency() {
|
||||||
// return 1;
|
return 1;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Retrieves the sample data that used to download accounts sample sheet.
|
* Retrieves the sample data that used to download accounts sample sheet.
|
||||||
// */
|
*/
|
||||||
// public sampleData(): any[] {
|
public sampleData(): any[] {
|
||||||
// return SaleEstimatesSampleData;
|
return SaleEstimatesSampleData;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import { SendSaleReceiptMailProcess } from './processes/SendSaleReceiptMail.proc
|
|||||||
import { MailModule } from '../Mail/Mail.module';
|
import { MailModule } from '../Mail/Mail.module';
|
||||||
import { SendSaleReceiptMailQueue } from './constants';
|
import { SendSaleReceiptMailQueue } from './constants';
|
||||||
import { SaleReceiptsExportable } from './commands/SaleReceiptsExportable';
|
import { SaleReceiptsExportable } from './commands/SaleReceiptsExportable';
|
||||||
|
import { SaleReceiptsImportable } from './commands/SaleReceiptsImportable';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
controllers: [SaleReceiptsController],
|
controllers: [SaleReceiptsController],
|
||||||
@@ -76,7 +77,8 @@ import { SaleReceiptsExportable } from './commands/SaleReceiptsExportable';
|
|||||||
SaleReceiptInventoryTransactions,
|
SaleReceiptInventoryTransactions,
|
||||||
SaleReceiptInventoryTransactionsSubscriber,
|
SaleReceiptInventoryTransactionsSubscriber,
|
||||||
SendSaleReceiptMailProcess,
|
SendSaleReceiptMailProcess,
|
||||||
SaleReceiptsExportable
|
SaleReceiptsExportable,
|
||||||
|
SaleReceiptsImportable,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class SaleReceiptsModule {}
|
export class SaleReceiptsModule {}
|
||||||
|
|||||||
@@ -1,45 +1,44 @@
|
|||||||
// import { Inject, Service } from 'typedi';
|
import { Injectable } from '@nestjs/common';
|
||||||
// import { Knex } from 'knex';
|
import { Knex } from 'knex';
|
||||||
// import { IAccountCreateDTO, ISaleReceiptDTO } from '@/interfaces';
|
import { CreateSaleReceipt } from './CreateSaleReceipt.service';
|
||||||
// import { CreateSaleReceipt } from './commands/CreateSaleReceipt.service';
|
import { Importable } from '@/modules/Import/Importable';
|
||||||
// import { Importable } from '@/services/Import/Importable';
|
import { CreateSaleReceiptDto } from '../dtos/SaleReceipt.dto';
|
||||||
// import { SaleReceiptsSampleData } from './constants';
|
import { SaleReceiptsSampleData } from '../constants';
|
||||||
|
|
||||||
// @Service()
|
@Injectable()
|
||||||
// export class SaleReceiptsImportable extends Importable {
|
export class SaleReceiptsImportable extends Importable {
|
||||||
// @Inject()
|
constructor(private readonly createReceiptService: CreateSaleReceipt) {
|
||||||
// private createReceiptService: CreateSaleReceipt;
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Importing to sale receipts service.
|
* Importing to sale receipts service.
|
||||||
// * @param {number} tenantId
|
* @param {number} tenantId
|
||||||
// * @param {IAccountCreateDTO} createAccountDTO
|
* @param {IAccountCreateDTO} createAccountDTO
|
||||||
// * @returns
|
* @returns
|
||||||
// */
|
*/
|
||||||
// public importable(
|
public importable(
|
||||||
// tenantId: number,
|
createAccountDTO: CreateSaleReceiptDto,
|
||||||
// createAccountDTO: ISaleReceiptDTO,
|
trx?: Knex.Transaction,
|
||||||
// trx?: Knex.Transaction
|
) {
|
||||||
// ) {
|
return this.createReceiptService.createSaleReceipt(
|
||||||
// return this.createReceiptService.createSaleReceipt(
|
createAccountDTO,
|
||||||
// tenantId,
|
trx,
|
||||||
// createAccountDTO,
|
);
|
||||||
// trx
|
}
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Concurrrency controlling of the importing process.
|
* Concurrrency controlling of the importing process.
|
||||||
// * @returns {number}
|
* @returns {number}
|
||||||
// */
|
*/
|
||||||
// public get concurrency() {
|
public get concurrency() {
|
||||||
// return 1;
|
return 1;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Retrieves the sample data that used to download accounts sample sheet.
|
* Retrieves the sample data that used to download accounts sample sheet.
|
||||||
// */
|
*/
|
||||||
// public sampleData(): any[] {
|
public sampleData(): any[] {
|
||||||
// return SaleReceiptsSampleData;
|
return SaleReceiptsSampleData;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import { SyncItemTaxRateOnEditTaxRate } from './SyncItemTaxRateOnEditTaxRate';
|
|||||||
import { RegisterTenancyModel } from '../Tenancy/TenancyModels/Tenancy.module';
|
import { RegisterTenancyModel } from '../Tenancy/TenancyModels/Tenancy.module';
|
||||||
import { TaxRateTransaction } from './models/TaxRateTransaction.model';
|
import { TaxRateTransaction } from './models/TaxRateTransaction.model';
|
||||||
import { TaxRatesExportable } from './TaxRatesExportable';
|
import { TaxRatesExportable } from './TaxRatesExportable';
|
||||||
|
import { TaxRatesImportable } from './TaxRatesImportable';
|
||||||
|
|
||||||
const models = [RegisterTenancyModel(TaxRateTransaction)];
|
const models = [RegisterTenancyModel(TaxRateTransaction)];
|
||||||
|
|
||||||
@@ -48,7 +49,8 @@ const models = [RegisterTenancyModel(TaxRateTransaction)];
|
|||||||
SyncItemTaxRateOnEditTaxSubscriber,
|
SyncItemTaxRateOnEditTaxSubscriber,
|
||||||
WriteTaxTransactionsItemEntries,
|
WriteTaxTransactionsItemEntries,
|
||||||
SyncItemTaxRateOnEditTaxRate,
|
SyncItemTaxRateOnEditTaxRate,
|
||||||
TaxRatesExportable
|
TaxRatesExportable,
|
||||||
|
TaxRatesImportable
|
||||||
],
|
],
|
||||||
exports: [ItemEntriesTaxTransactions, ...models],
|
exports: [ItemEntriesTaxTransactions, ...models],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,46 +1,40 @@
|
|||||||
// import { Inject, Service } from 'typedi';
|
import { Knex } from 'knex';
|
||||||
// import { Knex } from 'knex';
|
import { CreateTaxRate } from './commands/CreateTaxRate.service';
|
||||||
// import { ICreateTaxRateDTO } from '@/interfaces';
|
import { Importable } from '../Import/Importable';
|
||||||
// import { CreateTaxRate } from './commands/CreateTaxRate.service';
|
import { TaxRatesSampleData } from './TaxRatesImportable.SampleData';
|
||||||
// import { Importable } from '../Import/Importable';
|
import { CreateTaxRateDto } from './dtos/TaxRate.dto';
|
||||||
// import { TaxRatesSampleData } from './TaxRatesImportable.SampleData';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
// @Service()
|
@Injectable()
|
||||||
// export class TaxRatesImportable extends Importable {
|
export class TaxRatesImportable extends Importable {
|
||||||
// @Inject()
|
constructor(private readonly createTaxRateService: CreateTaxRate) {
|
||||||
// private createTaxRateService: CreateTaxRate;
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Importing to tax rate creating service.
|
* Importing to tax rate creating service.
|
||||||
// * @param {number} tenantId -
|
* @param {CreateTaxRateDto} ICreateTaxRateDTO -
|
||||||
// * @param {ICreateTaxRateDTO} ICreateTaxRateDTO -
|
* @param {Knex.Transaction} trx -
|
||||||
// * @param {Knex.Transaction} trx -
|
*/
|
||||||
// * @returns
|
public importable(
|
||||||
// */
|
createAccountDTO: CreateTaxRateDto,
|
||||||
// public importable(
|
trx?: Knex.Transaction,
|
||||||
// tenantId: number,
|
) {
|
||||||
// createAccountDTO: ICreateTaxRateDTO,
|
return this.createTaxRateService.createTaxRate(createAccountDTO, trx);
|
||||||
// trx?: Knex.Transaction
|
}
|
||||||
// ) {
|
|
||||||
// return this.createTaxRateService.createTaxRate(
|
|
||||||
// tenantId,
|
|
||||||
// createAccountDTO,
|
|
||||||
// trx
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Concurrrency controlling of the importing process.
|
* Concurrrency controlling of the importing process.
|
||||||
// * @returns {number}
|
* @returns {number}
|
||||||
// */
|
*/
|
||||||
// public get concurrency() {
|
public get concurrency() {
|
||||||
// return 1;
|
return 1;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Retrieves the sample data that used to download accounts sample sheet.
|
* Retrieves the sample data that used to download accounts sample sheet.
|
||||||
// */
|
*/
|
||||||
// public sampleData(): any[] {
|
public sampleData(): any[] {
|
||||||
// return TaxRatesSampleData;
|
return TaxRatesSampleData;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import { VendorsController } from './Vendors.controller';
|
|||||||
import { GetVendorsService } from './queries/GetVendors.service';
|
import { GetVendorsService } from './queries/GetVendors.service';
|
||||||
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
import { DynamicListModule } from '../DynamicListing/DynamicList.module';
|
||||||
import { VendorsExportable } from './VendorsExportable';
|
import { VendorsExportable } from './VendorsExportable';
|
||||||
|
import { VendorsImportable } from './VendorsImportable';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [TenancyDatabaseModule, DynamicListModule],
|
imports: [TenancyDatabaseModule, DynamicListModule],
|
||||||
@@ -32,7 +33,8 @@ import { VendorsExportable } from './VendorsExportable';
|
|||||||
VendorsApplication,
|
VendorsApplication,
|
||||||
TransformerInjectable,
|
TransformerInjectable,
|
||||||
TenancyContext,
|
TenancyContext,
|
||||||
VendorsExportable
|
VendorsExportable,
|
||||||
|
VendorsImportable
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class VendorsModule {}
|
export class VendorsModule {}
|
||||||
|
|||||||
@@ -1,32 +1,34 @@
|
|||||||
// import { Importable } from '@/services/Import/Importable';
|
import { Knex } from 'knex';
|
||||||
// import { CreateVendor } from './CRUD/CreateVendor.service';
|
import { VendorsSampleData } from './_SampleData';
|
||||||
// import { Knex } from 'knex';
|
import { Injectable } from '@nestjs/common';
|
||||||
// import { Inject, Service } from 'typedi';
|
import { Importable } from '../Import/Importable';
|
||||||
// import { VendorsSampleData } from './_SampleData';
|
import { CreateVendorService } from './commands/CreateVendor.service';
|
||||||
|
import { CreateVendorDto } from './dtos/CreateVendor.dto';
|
||||||
|
|
||||||
// @Service()
|
@Injectable()
|
||||||
// export class VendorsImportable extends Importable {
|
export class VendorsImportable extends Importable {
|
||||||
// @Inject()
|
constructor(
|
||||||
// private createVendorService: CreateVendor;
|
private readonly createVendorService: CreateVendorService,
|
||||||
|
) {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Maps the imported data to create a new vendor service.
|
* Maps the imported data to create a new vendor service.
|
||||||
// * @param {number} tenantId
|
* @param {CreateVendorDto} createDTO
|
||||||
// * @param {} createDTO
|
* @param {Knex.Transaction} trx
|
||||||
// * @param {Knex.Transaction} trx
|
*/
|
||||||
// */
|
public async importable(
|
||||||
// public async importable(
|
createDTO: CreateVendorDto,
|
||||||
// tenantId: number,
|
trx?: Knex.Transaction<any, any[]>
|
||||||
// createDTO: any,
|
): Promise<void> {
|
||||||
// trx?: Knex.Transaction<any, any[]>
|
await this.createVendorService.createVendor(createDTO, trx);
|
||||||
// ): Promise<void> {
|
}
|
||||||
// await this.createVendorService.createVendor(tenantId, createDTO, trx);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Retrieves the sample data of vendors sample sheet.
|
* Retrieves the sample data of vendors sample sheet.
|
||||||
// */
|
*/
|
||||||
// public sampleData(): any[] {
|
public sampleData(): any[] {
|
||||||
// return VendorsSampleData;
|
return VendorsSampleData;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user