fix: sort chronologically

This commit is contained in:
2026-06-12 00:11:00 -04:00
parent 94e0a18bf5
commit 190fbd433b
8 changed files with 74 additions and 12 deletions
+5 -1
View File
@@ -83,7 +83,11 @@ async function addEntryToLatestInvoice(
or(eq(invoices.status, "draft"), eq(invoices.status, "sent")),
),
with: { items: true },
orderBy: [desc(invoices.createdAt)],
orderBy: [
desc(invoices.issueDate),
desc(invoices.dueDate),
desc(invoices.invoiceNumber),
],
});
if (!invoice) return null;