Skip to main content

Function: resolveInvoiceNumbers()

resolveInvoiceNumbers(svc, companyId, ids): Promise<Map<string, string>>

Defined in: src/db/queries/invoices.ts:25

Resolve invoice_ids (e.g. time_entries.invoice_id) to their display numbers (e.g. "INV-0042"), company-scoped. Feeds invoiceLabelFor for the ADR-0050 §3 reissue warning shown wherever owner hours-entry surfaces read already-invoiced hours. Duplicate/empty ids are handled by the caller; an empty ids array skips the round-trip and returns an empty map.

Never throws: a lookup failure returns an empty map, which invoiceLabelFor renders as the unnumbered fallback warning. This is the whole reason it swallows — the warning is the safety mechanism, so degrading it to "some invoice" beats letting a transient invoices-table error reject the caller and silently drop the warning entirely.

Parameters

svc

SupabaseClient

companyId

string

ids

readonly string[]

Returns

Promise<Map<string, string>>