mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-12 02:40:31 +00:00
feat: getting matched transactiosn from multi uncategorized transactions
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Service, Inject } from 'typedi';
|
||||
import { Router, Request, Response, NextFunction } from 'express';
|
||||
import { param } from 'express-validator';
|
||||
import { param, query } from 'express-validator';
|
||||
import BaseController from '../BaseController';
|
||||
import { ServiceError } from '@/exceptions';
|
||||
import CheckPolicies from '@/api/middleware/CheckPolicies';
|
||||
@@ -24,7 +24,12 @@ export default class GetCashflowAccounts extends BaseController {
|
||||
const router = Router();
|
||||
|
||||
router.get(
|
||||
'/transactions/:transactionId/matches',
|
||||
'/transactions/matches',
|
||||
[
|
||||
query('uncategorizeTransactionsIds').exists().isArray({ min: 1 }),
|
||||
query('uncategorizeTransactionsIds.*').exists().isNumeric().toInt(),
|
||||
],
|
||||
this.validationResult,
|
||||
this.getMatchedTransactions.bind(this)
|
||||
);
|
||||
router.get(
|
||||
@@ -76,14 +81,15 @@ export default class GetCashflowAccounts extends BaseController {
|
||||
next: NextFunction
|
||||
) {
|
||||
const { tenantId } = req;
|
||||
const { transactionId } = req.params;
|
||||
const uncategorizeTransactionsIds: Array<number> =
|
||||
req.query.uncategorizeTransactionsIds;
|
||||
const filter = this.matchedQueryData(req) as GetMatchedTransactionsFilter;
|
||||
|
||||
try {
|
||||
const data =
|
||||
await this.bankTransactionsMatchingApp.getMatchedTransactions(
|
||||
tenantId,
|
||||
transactionId,
|
||||
uncategorizeTransactionsIds,
|
||||
filter
|
||||
);
|
||||
return res.status(200).send(data);
|
||||
|
||||
Reference in New Issue
Block a user