Description
src/lib/invoiceTags.ts manages tags on invoices but provides no utility to filter a list of invoices by one or more tags. Callers implement this filter ad-hoc in multiple places, leading to inconsistent behaviour when an invoice has multiple tags.
Acceptance Criteria
Context
- Target file:
src/lib/invoiceTags.ts
Invoice type from src/lib/types — use existing import pattern in the file
Description
src/lib/invoiceTags.tsmanages tags on invoices but provides no utility to filter a list of invoices by one or more tags. Callers implement this filter ad-hoc in multiple places, leading to inconsistent behaviour when an invoice has multiple tags.Acceptance Criteria
filterByTags(invoices: Invoice[], tags: string[], opts?: { matchAll?: boolean }): Invoice[]exported fromsrc/lib/invoiceTags.tsmatchAll: false): returns invoices that have any of the given tagsmatchAll: true: returns only invoices that have all of the given tagstagsarray returns all invoices unchangedContext
src/lib/invoiceTags.tsInvoicetype fromsrc/lib/types— use existing import pattern in the file