Background
Cross-merchant invoice visibility for the admin dashboard — as scoped, this is listing and detail only (filter by merchant address and status, paginated; no sort options were requested here, so none are added beyond the implicit createdAt desc ordering).
Proposed Steps
GET /admin/invoices — paginated, filters: merchantAddress (joins merchant.address), status (reuse the existing InvoiceStatus validation from invoice.validation.ts). Default order createdAt desc.
GET /admin/invoices/:id — full invoice detail, unscoped by merchant ownership (unlike the merchant-facing getInvoice, which enforces merchantId match — here there is none, admin sees any invoice).
Acceptance Criteria
Background
Cross-merchant invoice visibility for the admin dashboard — as scoped, this is listing and detail only (filter by merchant address and status, paginated; no sort options were requested here, so none are added beyond the implicit
createdAt descordering).Proposed Steps
GET /admin/invoices— paginated, filters:merchantAddress(joinsmerchant.address),status(reuse the existingInvoiceStatusvalidation frominvoice.validation.ts). Default ordercreatedAt desc.GET /admin/invoices/:id— full invoice detail, unscoped by merchant ownership (unlike the merchant-facinggetInvoice, which enforcesmerchantIdmatch — here there is none, admin sees any invoice).Acceptance Criteria
GET /admin/invoicesfilters correctly bymerchantAddressandstatus, independently and combinedGET /admin/invoicesis paginated using the existingDEFAULT_LIMIT/MAX_LIMITconventionGET /admin/invoices/:idreturns any invoice regardless of which merchant owns it,404if the id doesn't exist