feat: document functions

This commit is contained in:
Ahmed Bouhuolia
2024-07-29 13:00:50 +02:00
parent f457759e39
commit 4345623ea9
6 changed files with 46 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
import { Inject, Service } from 'typedi'; import { Inject, Service } from 'typedi';
import { ExcludeBankTransaction } from './ExcludeBankTransaction';
import PromisePool from '@supercharge/promise-pool'; import PromisePool from '@supercharge/promise-pool';
import { castArray } from 'lodash'; import { castArray } from 'lodash';
import { ExcludeBankTransaction } from './ExcludeBankTransaction';
@Service() @Service()
export class ExcludeBankTransactions { export class ExcludeBankTransactions {
@@ -12,6 +12,7 @@ export class ExcludeBankTransactions {
* Exclude bank transactions in bulk. * Exclude bank transactions in bulk.
* @param {number} tenantId * @param {number} tenantId
* @param {number} bankTransactionIds * @param {number} bankTransactionIds
* @returns {Promise<void>}
*/ */
public async excludeBankTransactions( public async excludeBankTransactions(
tenantId: number, tenantId: number,
@@ -21,7 +22,7 @@ export class ExcludeBankTransactions {
await PromisePool.withConcurrency(1) await PromisePool.withConcurrency(1)
.for(_bankTransactionIds) .for(_bankTransactionIds)
.process(async (bankTransactionId: number) => { .process((bankTransactionId: number) => {
return this.excludeBankTransaction.excludeBankTransaction( return this.excludeBankTransaction.excludeBankTransaction(
tenantId, tenantId,
bankTransactionId bankTransactionId

View File

@@ -21,7 +21,7 @@ export class UnexcludeBankTransactions {
await PromisePool.withConcurrency(1) await PromisePool.withConcurrency(1)
.for(_bankTransactionIds) .for(_bankTransactionIds)
.process(async (bankTransactionId: number) => { .process((bankTransactionId: number) => {
return this.unexcludeBankTransaction.unexcludeBankTransaction( return this.unexcludeBankTransaction.unexcludeBankTransaction(
tenantId, tenantId,
bankTransactionId bankTransactionId

View File

@@ -39,7 +39,6 @@ import { withBanking } from '../withBanking';
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
import { import {
useExcludeUncategorizedTransactions, useExcludeUncategorizedTransactions,
useUnexcludeUncategorizedTransaction,
useUnexcludeUncategorizedTransactions, useUnexcludeUncategorizedTransactions,
} from '@/hooks/query/bank-rules'; } from '@/hooks/query/bank-rules';
@@ -136,7 +135,7 @@ function AccountTransactionsActionsBar({
}) })
.then(() => { .then(() => {
AppToaster.show({ AppToaster.show({
message: 'The selected transactions have been unexcluded.', message: 'The selected excluded transactions have been unexcluded.',
intent: Intent.SUCCESS, intent: Intent.SUCCESS,
}); });
}) })
@@ -198,10 +197,9 @@ function AccountTransactionsActionsBar({
onClick={handleExcludeUncategorizedBtnClick} onClick={handleExcludeUncategorizedBtnClick}
className={Classes.MINIMAL} className={Classes.MINIMAL}
intent={Intent.DANGER} intent={Intent.DANGER}
disable={isExcludingLoading} disabled={isExcludingLoading}
/> />
)} )}
{!isEmpty(excludedTransactionsIdsSelected) && ( {!isEmpty(excludedTransactionsIdsSelected) && (
<Button <Button
icon={<Icon icon="disable" iconSize={16} />} icon={<Icon icon="disable" iconSize={16} />}
@@ -209,7 +207,7 @@ function AccountTransactionsActionsBar({
onClick={handleUnexcludeUncategorizedBtnClick} onClick={handleUnexcludeUncategorizedBtnClick}
className={Classes.MINIMAL} className={Classes.MINIMAL}
intent={Intent.DANGER} intent={Intent.DANGER}
disable={isUnexcludingLoading} disabled={isUnexcludingLoading}
/> />
)} )}
</NavbarGroup> </NavbarGroup>

View File

@@ -39,21 +39,37 @@ const mapDipatchToProps = (dispatch: any): WithBankingActionsProps => ({
closeReconcileMatchingTransaction: () => closeReconcileMatchingTransaction: () =>
dispatch(closeReconcileMatchingTransaction()), dispatch(closeReconcileMatchingTransaction()),
/**
* Sets the selected uncategorized transactions.
* @param {Array<string | number>} ids
*/
setUncategorizedTransactionsSelected: (ids: Array<string | number>) => setUncategorizedTransactionsSelected: (ids: Array<string | number>) =>
dispatch( dispatch(
setUncategorizedTransactionsSelected({ setUncategorizedTransactionsSelected({
transactionIds: ids, transactionIds: ids,
}), }),
), ),
/**
* Resets the selected uncategorized transactions.
*/
resetUncategorizedTransactionsSelected: () => resetUncategorizedTransactionsSelected: () =>
dispatch(resetUncategorizedTransactionsSelected()), dispatch(resetUncategorizedTransactionsSelected()),
/**
* Sets excluded selected transactions.
* @param {Array<string | number>} ids
*/
setExcludedTransactionsSelected: (ids: Array<string | number>) => setExcludedTransactionsSelected: (ids: Array<string | number>) =>
dispatch( dispatch(
setExcludedTransactionsSelected({ setExcludedTransactionsSelected({
ids, ids,
}), }),
), ),
/**
* Resets the excluded selected transactions
*/
resetExcludedTransactionsSelected: () => resetExcludedTransactionsSelected: () =>
dispatch(resetExcludedTransactionsSelected()), dispatch(resetExcludedTransactionsSelected()),
}); });

View File

@@ -58,6 +58,11 @@ export const PlaidSlice = createSlice({
state.openReconcileMatchingTransaction.pending = 0; state.openReconcileMatchingTransaction.pending = 0;
}, },
/**
* Sets the selected uncategorized transactions.
* @param {StorePlaidState} state
* @param {PayloadAction<{ transactionIds: Array<string | number> }>} action
*/
setUncategorizedTransactionsSelected: ( setUncategorizedTransactionsSelected: (
state: StorePlaidState, state: StorePlaidState,
action: PayloadAction<{ transactionIds: Array<string | number> }>, action: PayloadAction<{ transactionIds: Array<string | number> }>,
@@ -65,10 +70,19 @@ export const PlaidSlice = createSlice({
state.uncategorizedTransactionsSelected = action.payload.transactionIds; state.uncategorizedTransactionsSelected = action.payload.transactionIds;
}, },
/**
* Resets the selected uncategorized transactions.
* @param {StorePlaidState} state
*/
resetUncategorizedTransactionsSelected: (state: StorePlaidState) => { resetUncategorizedTransactionsSelected: (state: StorePlaidState) => {
state.uncategorizedTransactionsSelected = []; state.uncategorizedTransactionsSelected = [];
}, },
/**
* Sets excluded selected transactions.
* @param {StorePlaidState} state
* @param {PayloadAction<{ ids: Array<string | number> }>} action
*/
setExcludedTransactionsSelected: ( setExcludedTransactionsSelected: (
state: StorePlaidState, state: StorePlaidState,
action: PayloadAction<{ ids: Array<string | number> }>, action: PayloadAction<{ ids: Array<string | number> }>,
@@ -76,6 +90,10 @@ export const PlaidSlice = createSlice({
state.excludedTransactionsSelected = action.payload.ids; state.excludedTransactionsSelected = action.payload.ids;
}, },
/**
* Resets the excluded selected transactions
* @param {StorePlaidState} state
*/
resetExcludedTransactionsSelected: (state: StorePlaidState) => { resetExcludedTransactionsSelected: (state: StorePlaidState) => {
state.excludedTransactionsSelected = []; state.excludedTransactionsSelected = [];
}, },

View File

@@ -208,12 +208,16 @@ $dashboard-views-bar-height: 44px;
} }
&.#{$ns}-minimal.#{$ns}-intent-danger { &.#{$ns}-minimal.#{$ns}-intent-danger {
color: #c23030; color: rgb(194, 48, 48);
&:not(.bp4-disabled)
&:hover, &:hover,
&:focus { &:focus {
background: rgba(219, 55, 55, 0.1); background: rgba(219, 55, 55, 0.1);
} }
&.bp4-disabled{
color: rgb(194, 48, 48, 0.6);
}
} }
&.#{$ns}-minimal.#{$ns}-intent-success{ &.#{$ns}-minimal.#{$ns}-intent-success{
color: #1c6e42; color: #1c6e42;