mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 13:20:31 +00:00
feat: wip bank transaction matching
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
import { body } from 'express-validator';
|
||||
import BaseController from '../BaseController';
|
||||
import { Router } from 'express';
|
||||
import { Service } from 'typedi';
|
||||
|
||||
@Service()
|
||||
export class BankReconcileController extends BaseController {
|
||||
/**
|
||||
* Router constructor.
|
||||
*/
|
||||
public router() {
|
||||
const router = Router();
|
||||
|
||||
router.post(
|
||||
'/',
|
||||
[
|
||||
body('amount').exists(),
|
||||
body('date').exists(),
|
||||
body('fromAccountId').exists(),
|
||||
body('toAccountId').exists(),
|
||||
body('reference').optional({ nullable: true }),
|
||||
],
|
||||
this.validationResult,
|
||||
this.createBankReconcileTransaction.bind(this)
|
||||
);
|
||||
return router;
|
||||
}
|
||||
|
||||
createBankReconcileTransaction() {}
|
||||
}
|
||||
@@ -24,12 +24,14 @@ export class GetBankAccountSummary {
|
||||
.findById(bankAccountId)
|
||||
.throwIfNotFound();
|
||||
|
||||
// Retrieves the uncategorized transactions count of the given bank account.
|
||||
const uncategorizedTranasctionsCount =
|
||||
await UncategorizedCashflowTransaction.query()
|
||||
.where('accountId', bankAccountId)
|
||||
.count('id as total')
|
||||
.first();
|
||||
|
||||
// Retrieves the recognized transactions count of the given bank account.
|
||||
const recognizedTransactionsCount = await RecognizedBankTransaction.query()
|
||||
.whereExists(
|
||||
UncategorizedCashflowTransaction.query().where(
|
||||
|
||||
@@ -100,7 +100,6 @@ export class GetMatchedTransactions {
|
||||
moment(match.date).isSame(uncategorizedTransaction.date, 'day'),
|
||||
closestResullts
|
||||
);
|
||||
|
||||
const possibleMatches = R.difference(closestResullts, perfectMatches);
|
||||
|
||||
return { perfectMatches, possibleMatches };
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
} from './types';
|
||||
import { Inject, Service } from 'typedi';
|
||||
|
||||
// @Service()
|
||||
export abstract class GetMatchedTransactionsByType {
|
||||
@Inject()
|
||||
protected tenancy: HasTenancyService;
|
||||
@@ -17,6 +16,7 @@ export abstract class GetMatchedTransactionsByType {
|
||||
* Retrieves the matched transactions.
|
||||
* @param {number} tenantId -
|
||||
* @param {GetMatchedTransactionsFilter} filter -
|
||||
* @returns {Promise<MatchedTransactionsPOJO>}
|
||||
*/
|
||||
public async getMatchedTransactions(
|
||||
tenantId: number,
|
||||
@@ -31,6 +31,7 @@ export abstract class GetMatchedTransactionsByType {
|
||||
* Retrieves the matched transaction details.
|
||||
* @param {number} tenantId -
|
||||
* @param {number} transactionId -
|
||||
* @returns {Promise<MatchedTransactionPOJO>}
|
||||
*/
|
||||
public async getMatchedTransaction(
|
||||
tenantId: number,
|
||||
|
||||
Reference in New Issue
Block a user