mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-14 03:40:31 +00:00
feat: excluded bank transactions
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Inject, Service } from 'typedi';
|
||||
import { param } from 'express-validator';
|
||||
import { NextFunction, Request, Response, Router } from 'express';
|
||||
import { NextFunction, Request, Response, Router, query } from 'express';
|
||||
import BaseController from '../BaseController';
|
||||
import { ExcludeBankTransactionsApplication } from '@/services/Banking/Exclude/ExcludeBankTransactionsApplication';
|
||||
|
||||
@@ -27,6 +27,12 @@ export class ExcludeBankTransactionsController extends BaseController {
|
||||
this.validationResult,
|
||||
this.unexcludeBankTransaction.bind(this)
|
||||
);
|
||||
router.get(
|
||||
'/excluded',
|
||||
[],
|
||||
this.validationResult,
|
||||
this.getExcludedBankTransactions.bind(this)
|
||||
);
|
||||
return router;
|
||||
}
|
||||
|
||||
@@ -87,4 +93,32 @@ export class ExcludeBankTransactionsController extends BaseController {
|
||||
next(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the excluded uncategorized bank transactions.
|
||||
* @param {Request} req
|
||||
* @param {Response} res
|
||||
* @param {NextFunction} next
|
||||
* @returns {Promise<Response|null>}
|
||||
*/
|
||||
private async getExcludedBankTransactions(
|
||||
req: Request,
|
||||
res: Response,
|
||||
next: NextFunction
|
||||
): Promise<Response | void> {
|
||||
const { tenantId } = req;
|
||||
const filter = this.matchedBodyData(req);
|
||||
|
||||
console.log('123');
|
||||
try {
|
||||
const data =
|
||||
await this.excludeBankTransactionApp.getExcludedBankTransactions(
|
||||
tenantId,
|
||||
filter
|
||||
);
|
||||
return res.status(200).send(data);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,14 +14,11 @@ export class RecognizedTransactionsController extends BaseController {
|
||||
router() {
|
||||
const router = Router();
|
||||
|
||||
router.get(
|
||||
'/accounts/:accountId',
|
||||
this.getRecognizedTransactions.bind(this)
|
||||
);
|
||||
router.get('/', this.getRecognizedTransactions.bind(this));
|
||||
|
||||
return router;
|
||||
}
|
||||
k;
|
||||
|
||||
/**
|
||||
* Retrieves the recognized bank transactions.
|
||||
* @param {Request} req
|
||||
@@ -34,15 +31,15 @@ export class RecognizedTransactionsController extends BaseController {
|
||||
res: Response,
|
||||
next: NextFunction
|
||||
) {
|
||||
const { accountId } = req.params;
|
||||
const filter = this.matchedQueryData(req);
|
||||
const { tenantId } = req;
|
||||
|
||||
try {
|
||||
const data = await this.cashflowApplication.getRecognizedTransactions(
|
||||
tenantId,
|
||||
accountId
|
||||
filter
|
||||
);
|
||||
return res.status(200).send({ data });
|
||||
return res.status(200).send(data);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user