feat: document the Redux mutation methods

This commit is contained in:
Ahmed Bouhuolia
2024-07-29 14:03:37 +02:00
parent f64cd32985
commit f5e18fc1fe
2 changed files with 39 additions and 3 deletions

View File

@@ -49,7 +49,7 @@ const mapDipatchToProps = (dispatch: any): WithBankingActionsProps => ({
/**
* Sets the selected uncategorized transactions.
* @param {Array<string | number>} ids
* @param {Array<string | number>} ids
*/
setUncategorizedTransactionsSelected: (ids: Array<string | number>) =>
dispatch(
@@ -76,17 +76,29 @@ const mapDipatchToProps = (dispatch: any): WithBankingActionsProps => ({
),
/**
* Resets the excluded selected transactions
* Resets the excluded selected transactions.
*/
resetExcludedTransactionsSelected: () =>
dispatch(resetExcludedTransactionsSelected()),
/**
* Sets the selected transactions to categorize or match.
* @param {Array<string | number>} ids
*/
setTransactionsToCategorizeSelected: (ids: Array<string | number>) =>
dispatch(setTransactionsToCategorizeSelected({ ids })),
/**
* Resets the selected transactions to categorize or match.
*/
resetTransactionsToCategorizeSelected: () =>
dispatch(resetTransactionsToCategorizeSelected()),
enableMultipleCategorization: (enable) =>
/**
* Enables/Disables the multiple selection to categorize or match.
* @param {boolean} enable
*/
enableMultipleCategorization: (enable: boolean) =>
dispatch(enableMultipleCategorization({ enable })),
});

View File

@@ -104,6 +104,11 @@ export const PlaidSlice = createSlice({
state.excludedTransactionsSelected = [];
},
/**
* Sets the selected transactions to categorize or match.
* @param {StorePlaidState} state
* @param {PayloadAction<{ ids: Array<string | number> }>} action
*/
setTransactionsToCategorizeSelected: (
state: StorePlaidState,
action: PayloadAction<{ ids: Array<string | number> }>,
@@ -111,6 +116,11 @@ export const PlaidSlice = createSlice({
state.transactionsToCategorizeSelected = action.payload.ids;
},
/**
* Adds a transaction to selected transactions to categorize or match.
* @param {StorePlaidState} state
* @param {PayloadAction<{ id: string | number }>} action
*/
addTransactionsToCategorizeSelected: (
state: StorePlaidState,
action: PayloadAction<{ id: string | number }>,
@@ -121,6 +131,11 @@ export const PlaidSlice = createSlice({
]);
},
/**
* Removes a transaction from the selected transactions to categorize or match.
* @param {StorePlaidState} state
* @param {PayloadAction<{ id: string | number }>} action
*/
removeTransactionsToCategorizeSelected: (
state: StorePlaidState,
action: PayloadAction<{ id: string | number }>,
@@ -131,10 +146,19 @@ export const PlaidSlice = createSlice({
);
},
/**
* Resets the selected transactions to categorize or match.
* @param {StorePlaidState} state
*/
resetTransactionsToCategorizeSelected: (state: StorePlaidState) => {
state.transactionsToCategorizeSelected = [];
},
/**
* Enables/Disables the multiple selection to categorize or match.
* @param {StorePlaidState} state
* @param {PayloadAction<{ enable: boolean }>} action
*/
enableMultipleCategorization: (
state: StorePlaidState,
action: PayloadAction<{ enable: boolean }>,