feat(lancamentos): oculta parcelas antecipadas por preferencia

This commit is contained in:
Felipe Coutinho
2026-06-27 14:22:51 -03:00
parent d06bac5624
commit 32b190ab4e
16 changed files with 3088 additions and 10 deletions

View File

@@ -6,6 +6,7 @@ import {
ilike,
inArray,
isNotNull,
isNull,
lte,
or,
sql,
@@ -384,6 +385,7 @@ export const buildTransactionWhere = ({
cardId,
accountId,
payerId,
hideAnticipatedInstallments = false,
}: {
userId: string;
period: string;
@@ -392,6 +394,7 @@ export const buildTransactionWhere = ({
cardId?: string;
accountId?: string;
payerId?: string;
hideAnticipatedInstallments?: boolean;
}): SQL[] => {
const where: SQL[] = [eq(transactions.userId, userId)];
@@ -421,6 +424,15 @@ export const buildTransactionWhere = ({
where.push(eq(transactions.payerId, payerId));
}
if (hideAnticipatedInstallments) {
where.push(
or(
isNull(transactions.isAnticipated),
eq(transactions.isAnticipated, false),
) as SQL,
);
}
if (cardId) {
where.push(eq(transactions.cardId, cardId));
}