mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-05-09 11:01:45 +00:00
fix(invoices): exibir ícone de anexo na fatura do cartão (2.5.1)
fetchCardTransactions não preenchia hasAttachments, então o ícone não aparecia em /cards/[cardId]/invoice. Agora delega para fetchTransactionsWithRelations, que já calcula o flag via EXISTS. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { and, desc, eq, type SQL, sum } from "drizzle-orm";
|
||||
import { and, eq, type SQL, sum } from "drizzle-orm";
|
||||
import { cards, invoices, transactions } from "@/db/schema";
|
||||
import { fetchTransactionsWithRelations } from "@/features/transactions/queries";
|
||||
import { buildInvoicePaymentNote } from "@/shared/lib/accounts/constants";
|
||||
import { db } from "@/shared/lib/db";
|
||||
import {
|
||||
@@ -104,14 +105,5 @@ export async function fetchInvoiceData(
|
||||
}
|
||||
|
||||
export async function fetchCardTransactions(filters: SQL[]) {
|
||||
return db.query.transactions.findMany({
|
||||
where: and(...filters),
|
||||
with: {
|
||||
payer: true,
|
||||
financialAccount: true,
|
||||
card: true,
|
||||
category: true,
|
||||
},
|
||||
orderBy: desc(transactions.purchaseDate),
|
||||
});
|
||||
return fetchTransactionsWithRelations({ filters });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user