feat(admin): add admin invoice listing and detail endpoints - #55
Conversation
- Implement GET /api/v1/admin/invoices with status & merchantAddress filtering and pagination - Implement GET /api/v1/admin/invoices/:id for cross-merchant invoice details - Add query parsing and validation for admin invoice list parameters - Add comprehensive integration and unit tests for admin invoice endpoints Closes ShadeProtocol#43
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe PR adds authenticated admin invoice list and detail endpoints. It supports status and merchant-address filters, pagination, cross-merchant retrieval, validation errors, application error mapping, and integration and unit tests. ChangesAdmin invoice endpoints
Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to The PR adds authenticated admin invoice listing and detail endpoints with validation, pagination, filtering, and reported passing checks; no actionable merge-blocking risk remains beyond normal review. Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant AdminClient
participant authenticateAdmin
participant AdminInvoiceController
participant InvoiceServices
participant Prisma
AdminClient->>authenticateAdmin: Request admin invoice endpoint
authenticateAdmin->>AdminInvoiceController: Forward authenticated request
AdminInvoiceController->>InvoiceServices: Parse input and call invoice service
InvoiceServices->>Prisma: Query invoices or invoice by ID
Prisma-->>InvoiceServices: Return records or not found
InvoiceServices-->>AdminInvoiceController: Return sanitized data or error
AdminInvoiceController-->>AdminClient: Return HTTP response
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Linked Issues checkExplanation The changes implement issue Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 8 files. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
codebestia
left a comment
There was a problem hiding this comment.
LGTM!
Thank you for your contribution
Summary
Closes #43
Introduces cross-merchant admin invoice visibility endpoints for the admin dashboard.
Details
1. New Endpoints
GET /api/v1/admin/invoices:authenticateAdmin.merchantAddress(via joined relation onmerchant.address) andstatus(reusing existingInvoiceStatusenum).DEFAULT_LIMIT(20) /MAX_LIMIT(100) conventions with default ordering bycreatedAt desc(andid desctiebreaker).GET /api/v1/admin/invoices/:id:authenticateAdmin.404when the invoice does not exist.2. Validation & Services
parseAdminInvoiceListQueryinsrc/utils/invoice.validation.ts.listAdminInvoicesandgetAdminInvoiceinsrc/services/invoice.services.ts.listAdminInvoicesControllerandgetAdminInvoiceControllerinsrc/controllers/admin-invoice.controllers.ts.invoiceRoutesinsrc/routes/admin/index.ts.3. Tests & Verification
tests/unit/admin-invoice.validation.test.ts&tests/unit/invoice.services.test.tstests/integration/admin.invoices.routes.test.tsnpm run checkandnpm test(48 test suites, 430 tests passing).Summary by CodeRabbit
New Features
Bug Fixes