chore: fix typing

This commit is contained in:
Ahmed Bouhuolia
2024-08-04 22:20:31 +02:00
parent 647bed5c67
commit 86631ea8c3
4 changed files with 13 additions and 8 deletions

View File

@@ -49,7 +49,7 @@ export default class GetCashflowAccounts extends BaseController {
* @param {NextFunction} next * @param {NextFunction} next
*/ */
private getCashflowTransaction = async ( private getCashflowTransaction = async (
req: Request, req: Request<{ transactionId: number }>,
res: Response, res: Response,
next: NextFunction next: NextFunction
) => { ) => {
@@ -76,13 +76,17 @@ export default class GetCashflowAccounts extends BaseController {
* @param {NextFunction} next * @param {NextFunction} next
*/ */
private async getMatchedTransactions( private async getMatchedTransactions(
req: Request<{ transactionId: number }>, req: Request<
{ transactionId: number },
null,
null,
{ uncategorizeTransactionsIds: Array<number> }
>,
res: Response, res: Response,
next: NextFunction next: NextFunction
) { ) {
const { tenantId } = req; const { tenantId } = req;
const uncategorizeTransactionsIds: Array<number> = const uncategorizeTransactionsIds = req.query.uncategorizeTransactionsIds;
req.query.uncategorizeTransactionsIds;
const filter = this.matchedQueryData(req) as GetMatchedTransactionsFilter; const filter = this.matchedQueryData(req) as GetMatchedTransactionsFilter;
try { try {

View File

@@ -167,7 +167,7 @@ export default class NewCashflowTransactionController extends BaseController {
* @param {NextFunction} next * @param {NextFunction} next
*/ */
private revertCategorizedCashflowTransaction = async ( private revertCategorizedCashflowTransaction = async (
req: Request, req: Request<{ id: number }>,
res: Response, res: Response,
next: NextFunction next: NextFunction
) => { ) => {
@@ -280,7 +280,7 @@ export default class NewCashflowTransactionController extends BaseController {
* @param {NextFunction} next * @param {NextFunction} next
*/ */
public getUncategorizedCashflowTransactions = async ( public getUncategorizedCashflowTransactions = async (
req: Request, req: Request<{ id: number }>,
res: Response, res: Response,
next: NextFunction next: NextFunction
) => { ) => {

View File

@@ -44,7 +44,7 @@ export abstract class GetMatchedTransactionsByType {
} }
/** /**
* * Creates the common matched transaction.
* @param {number} tenantId * @param {number} tenantId
* @param {Array<number>} uncategorizedTransactionIds * @param {Array<number>} uncategorizedTransactionIds
* @param {IMatchTransactionDTO} matchTransactionDTO * @param {IMatchTransactionDTO} matchTransactionDTO

View File

@@ -54,7 +54,8 @@ export class MatchBankTransactions {
const uncategorizedTransactions = const uncategorizedTransactions =
await UncategorizedCashflowTransaction.query() await UncategorizedCashflowTransaction.query()
.whereIn('id', uncategorizedTransactionIds) .whereIn('id', uncategorizedTransactionIds)
.withGraphFetched('matchedBankTransactions'); .withGraphFetched('matchedBankTransactions')
.throwIfNotFound();
// Validates the uncategorized transaction is not already matched. // Validates the uncategorized transaction is not already matched.
validateUncategorizedTransactionsNotMatched(uncategorizedTransactions); validateUncategorizedTransactionsNotMatched(uncategorizedTransactions);