-
Notifications
You must be signed in to change notification settings - Fork 134
Open
Labels
good first issueGood for newcomersGood for newcomers
Description
Location: backend/src/invoices/
Description
Members need to retrieve their invoices and download them as PDFs. Admins need to see all invoices platform-wide. This issue implements the read endpoints for the invoices module, including a dedicated download endpoint that streams the PDF back to the client.
Acceptance Criteria
-
GET /invoicesreturns a paginated list of invoices- Supports query params:
page(default1),limit(default10),status(optional, filters byInvoiceStatus) - If the requesting user's role is
ADMIN,SUPER_ADMIN, orSTAFF— returns all invoices across all members - If the requesting user's role is
USER— returns only that user's own invoices - Each invoice includes the
booking,booking.workspace, anduserrelations - Response shape:
{ success: true, data: Invoice[], meta: { total, page, limit, totalPages } }
- Supports query params:
-
GET /invoices/:idreturns a single invoice by UUID- Members can only access their own invoices — throws
ForbiddenExceptionif the invoice does not belong to them - Throws
NotFoundExceptionif the invoice does not exist - Includes
booking,booking.workspace,user, andpaymentrelations - Response shape:
{ success: true, data: Invoice }
- Members can only access their own invoices — throws
-
GET /invoices/:id/downloadreturns the invoice as a PDF file- Same ownership rules apply — members can only download their own invoices
- Calls
PdfInvoiceProvider.generate()to produce the buffer - Sets response headers:
Content-Type: application/pdf,Content-Disposition: attachment; filename="invoice-<invoiceNumber>.pdf" - Pipes or writes the buffer to the response using
@Res() res: Response
- All three endpoints use
@GetCurrentUser('id')and@GetCurrentUser('role')to determine scope -
npx tsc --noEmitpasses with no errors
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers