mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
fix: Banking api account and page query.
This commit is contained in:
@@ -42,7 +42,11 @@ export class ExcludeBankTransactionsController extends BaseController {
|
|||||||
);
|
);
|
||||||
router.get(
|
router.get(
|
||||||
'/excluded',
|
'/excluded',
|
||||||
[],
|
[
|
||||||
|
query('account_id').optional().isNumeric().toInt(),
|
||||||
|
query('page').optional().isNumeric().toInt(),
|
||||||
|
query('page_size').optional().isNumeric().toInt(),
|
||||||
|
],
|
||||||
this.validationResult,
|
this.validationResult,
|
||||||
this.getExcludedBankTransactions.bind(this)
|
this.getExcludedBankTransactions.bind(this)
|
||||||
);
|
);
|
||||||
@@ -177,7 +181,7 @@ export class ExcludeBankTransactionsController extends BaseController {
|
|||||||
next: NextFunction
|
next: NextFunction
|
||||||
): Promise<Response | void> {
|
): Promise<Response | void> {
|
||||||
const { tenantId } = req;
|
const { tenantId } = req;
|
||||||
const filter = this.matchedBodyData(req);
|
const filter = this.matchedQueryData(req);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data =
|
const data =
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Inject, Service } from 'typedi';
|
import { Inject, Service } from 'typedi';
|
||||||
import { NextFunction, Request, Response, Router } from 'express';
|
import { NextFunction, Request, Response, Router } from 'express';
|
||||||
|
import { query } from 'express-validator';
|
||||||
import BaseController from '@/api/controllers/BaseController';
|
import BaseController from '@/api/controllers/BaseController';
|
||||||
import { CashflowApplication } from '@/services/Cashflow/CashflowApplication';
|
import { CashflowApplication } from '@/services/Cashflow/CashflowApplication';
|
||||||
|
|
||||||
@@ -14,7 +15,16 @@ export class RecognizedTransactionsController extends BaseController {
|
|||||||
router() {
|
router() {
|
||||||
const router = Router();
|
const router = Router();
|
||||||
|
|
||||||
router.get('/', this.getRecognizedTransactions.bind(this));
|
router.get(
|
||||||
|
'/',
|
||||||
|
[
|
||||||
|
query('page').optional().isNumeric().toInt(),
|
||||||
|
query('page_size').optional().isNumeric().toInt(),
|
||||||
|
query('account_id').optional().isNumeric().toInt(),
|
||||||
|
],
|
||||||
|
this.validationResult,
|
||||||
|
this.getRecognizedTransactions.bind(this)
|
||||||
|
);
|
||||||
router.get(
|
router.get(
|
||||||
'/transactions/:uncategorizedTransactionId',
|
'/transactions/:uncategorizedTransactionId',
|
||||||
this.getRecognizedTransaction.bind(this)
|
this.getRecognizedTransaction.bind(this)
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ function RecognizedTransactionsTableBoot({
|
|||||||
hasNextPage: hasUncategorizedTransactionsNextPage,
|
hasNextPage: hasUncategorizedTransactionsNextPage,
|
||||||
} = useRecognizedBankTransactionsInfinity({
|
} = useRecognizedBankTransactionsInfinity({
|
||||||
page_size: 50,
|
page_size: 50,
|
||||||
|
account_id: accountId,
|
||||||
});
|
});
|
||||||
// Memorized the cashflow account transactions.
|
// Memorized the cashflow account transactions.
|
||||||
const recognizedTransactions = React.useMemo(
|
const recognizedTransactions = React.useMemo(
|
||||||
|
|||||||
@@ -276,6 +276,11 @@ const onValidateExcludeUncategorizedTransaction = (queryClient) => {
|
|||||||
|
|
||||||
// invalidate bank account summary.
|
// invalidate bank account summary.
|
||||||
queryClient.invalidateQueries(BANK_QUERY_KEY.BANK_ACCOUNT_SUMMARY_META);
|
queryClient.invalidateQueries(BANK_QUERY_KEY.BANK_ACCOUNT_SUMMARY_META);
|
||||||
|
|
||||||
|
// Invalidate the recognized transactions.
|
||||||
|
queryClient.invalidateQueries([
|
||||||
|
BANK_QUERY_KEY.RECOGNIZED_BANK_TRANSACTIONS_INFINITY,
|
||||||
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
type ExcludeUncategorizedTransactionValue = number;
|
type ExcludeUncategorizedTransactionValue = number;
|
||||||
@@ -312,10 +317,6 @@ export function useExcludeUncategorizedTransaction(
|
|||||||
{
|
{
|
||||||
onSuccess: (res, id) => {
|
onSuccess: (res, id) => {
|
||||||
onValidateExcludeUncategorizedTransaction(queryClient);
|
onValidateExcludeUncategorizedTransaction(queryClient);
|
||||||
queryClient.invalidateQueries([
|
|
||||||
BANK_QUERY_KEY.BANK_ACCOUNT_SUMMARY_META,
|
|
||||||
id,
|
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
...options,
|
...options,
|
||||||
},
|
},
|
||||||
@@ -357,10 +358,6 @@ export function useUnexcludeUncategorizedTransaction(
|
|||||||
{
|
{
|
||||||
onSuccess: (res, id) => {
|
onSuccess: (res, id) => {
|
||||||
onValidateExcludeUncategorizedTransaction(queryClient);
|
onValidateExcludeUncategorizedTransaction(queryClient);
|
||||||
queryClient.invalidateQueries([
|
|
||||||
BANK_QUERY_KEY.BANK_ACCOUNT_SUMMARY_META,
|
|
||||||
id,
|
|
||||||
]);
|
|
||||||
},
|
},
|
||||||
...options,
|
...options,
|
||||||
},
|
},
|
||||||
@@ -649,7 +646,6 @@ export function useRecognizedBankTransactionsInfinity(
|
|||||||
getPreviousPageParam: (firstPage) => firstPage.pagination.page - 1,
|
getPreviousPageParam: (firstPage) => firstPage.pagination.page - 1,
|
||||||
getNextPageParam: (lastPage) => {
|
getNextPageParam: (lastPage) => {
|
||||||
const { pagination } = lastPage;
|
const { pagination } = lastPage;
|
||||||
|
|
||||||
return pagination.total > pagination.page_size * pagination.page
|
return pagination.total > pagination.page_size * pagination.page
|
||||||
? lastPage.pagination.page + 1
|
? lastPage.pagination.page + 1
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user