feat: rewrite repositories with base entity repository class.

feat: sales and purchases status.
feat: sales and purchases auto-increment number.
fix: settings find query with extra columns.
This commit is contained in:
Ahmed Bouhuolia
2020-12-13 19:50:59 +02:00
parent e9e4ddaee0
commit 188e411f02
78 changed files with 1634 additions and 869 deletions

View File

@@ -65,8 +65,8 @@ export default class JournalCommands{
async customerOpeningBalance(customerId: number, openingBalance: number) {
const { accountRepository } = this.repositories;
const openingBalanceAccount = await accountRepository.getBySlug('opening-balance');
const receivableAccount = await accountRepository.getBySlug('accounts-receivable');
const openingBalanceAccount = await accountRepository.findOne({ slug: 'opening-balance' });
const receivableAccount = await accountRepository.findOne({ slug: 'accounts-receivable' });
const commonEntry = {
referenceType: 'CustomerOpeningBalance',
@@ -98,8 +98,8 @@ export default class JournalCommands{
async vendorOpeningBalance(vendorId: number, openingBalance: number) {
const { accountRepository } = this.repositories;
const payableAccount = await accountRepository.getBySlug('accounts-payable');
const otherCost = await accountRepository.getBySlug('other-expenses');
const payableAccount = await accountRepository.findOne({ slug: 'accounts-payable' });
const otherCost = await accountRepository.findOne({ slug: 'other-expenses' });
const commonEntry = {
referenceType: 'VendorOpeningBalance',

View File

@@ -166,7 +166,7 @@ export default class JournalPoster implements IJournalPoster {
accountsIds.map(async (account: number) => {
const accountChange = accountsChange[account];
const accountNode = this.accountsDepGraph.getNodeData(account);
const accountTypeMeta = await accountTypeRepository.getTypeMeta(accountNode.accountTypeId);
const accountTypeMeta = await accountTypeRepository.findOneById(accountNode.accountTypeId);
const { normal }: { normal: TEntryType } = accountTypeMeta;
let change = 0;