Skip to content

fix(invoices): GET and POST responses missing gig_invoice_items line items #350

@forgou37

Description

@forgou37

Bug

The gig_invoice_items table was added today (migration 20260530210000_gig_invoice_items.sql) to support itemized invoices.

The GET /api/gigs/[id]/invoice route and the POST create response do not include line items:

GET handler (route.ts:56)

.select(`
  *,
  worker:profiles!worker_id(id, username, full_name, avatar_url),
  poster:profiles!poster_id(id, username, full_name, avatar_url)
  // ❌ missing: items:gig_invoice_items(...)
`)

POST response — returns invoice_id, pay_url, etc. but not the created line items.

Impact

  • Client fetching an invoice after creation cannot display line-item breakdown
  • Frontend InvoicePaymentActions / InvoiceCharges receive no item data even when items were saved

Fix

  1. Add items:gig_invoice_items(id, description, amount_usd, position) to the GET select
  2. Include items in the POST 201 response body

PR to follow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions