mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 12:20:31 +00:00
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import { Knex } from 'knex';
|
|
import { Injectable } from '@nestjs/common';
|
|
import { Importable } from '../Import/Importable';
|
|
import { AccountsSampleData } from './AccountsImportable.SampleData';
|
|
import { CreateAccountDTO } from './CreateAccount.dto';
|
|
import { CreateAccountService } from './CreateAccount.service';
|
|
import { ImportableService } from '../Import/decorators/Import.decorator';
|
|
import { Account } from './models/Account.model';
|
|
|
|
@Injectable()
|
|
@ImportableService({ name: Account.name })
|
|
export class AccountsImportable extends Importable {
|
|
constructor(private readonly createAccountService: CreateAccountService) {
|
|
super();
|
|
}
|
|
|
|
/**
|
|
* Importing to account service.
|
|
* @param {CreateAccountDTO} createAccountDTO - Create account dto.
|
|
* @returns
|
|
*/
|
|
public importable(
|
|
createAccountDTO: CreateAccountDTO,
|
|
trx?: Knex.Transaction,
|
|
) {
|
|
return this.createAccountService.createAccount(
|
|
createAccountDTO,
|
|
trx,
|
|
);
|
|
}
|
|
|
|
/**
|
|
* 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 AccountsSampleData;
|
|
}
|
|
}
|