Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
WalkthroughThe PR threads Authorization header through multiple API-harmonization controllers and services: controllers now accept headers where needed, services extract Authorization before downstream calls and pass it as an extra argument, and mocked integration modules gain optional Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Controller
participant BlockService as Block Service
participant Integration as Mocked Integration
rect rgba(135,206,235,0.5)
Client->>Controller: HTTP request (includes Authorization header)
Controller->>BlockService: callBlock(..., headers)
BlockService->>BlockService: const authorization = headers.Authorization
BlockService->>Integration: getList(query, authorization)
Integration-->>BlockService: items[]
BlockService->>BlockService: map items -> enrich permissions if authorization
BlockService-->>Controller: block response
Controller-->>Client: HTTP response
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Coverage Report for packages/configs/vitest-config
File Coverage
|
||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/blocks/billing/invoice-list/src/api-harmonization/invoice-list.service.ts (1)
72-74: KeepgetInvoicePdf()transport-agnostic.This method only uses
headers[H.Authorization], so accepting the wholeAppHeadersobject makes the service boundary more HTTP-coupled than it needs to be.♻️ Narrow the service boundary
- getInvoicePdf(id: string, headers: AppHeaders): Observable<Buffer> { - const authorization = headers[H.Authorization]; - return this.invoiceService.getInvoicePdf({ id }, authorization); + getInvoicePdf(id: string, authorization?: string): Observable<Buffer> { + return this.invoiceService.getInvoicePdf({ id }, authorization); }The controller can extract the authorization value before calling this method.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/blocks/billing/invoice-list/src/api-harmonization/invoice-list.service.ts` around lines 72 - 74, The getInvoicePdf method is HTTP-coupled by accepting the whole AppHeaders; change its signature to accept the authorization string instead (e.g., getInvoicePdf(id: string, authorization: string)) and update call sites so the controller extracts headers[H.Authorization] before calling; inside invoice-list.service.ts replace usage of headers[H.Authorization] with the new authorization parameter and pass that into invoiceService.getInvoicePdf({ id }, authorization).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@packages/blocks/billing/invoice-list/src/api-harmonization/invoice-list.service.ts`:
- Around line 72-74: The getInvoicePdf method is HTTP-coupled by accepting the
whole AppHeaders; change its signature to accept the authorization string
instead (e.g., getInvoicePdf(id: string, authorization: string)) and update call
sites so the controller extracts headers[H.Authorization] before calling; inside
invoice-list.service.ts replace usage of headers[H.Authorization] with the new
authorization parameter and pass that into invoiceService.getInvoicePdf({ id },
authorization).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 84b00e6e-1121-475b-a676-606af9c31533
📒 Files selected for processing (14)
.changeset/tough-aliens-throw.mdpackages/blocks/billing/invoice-list/src/api-harmonization/invoice-list.controller.tspackages/blocks/billing/invoice-list/src/api-harmonization/invoice-list.service.tspackages/blocks/billing/payments-history/src/api-harmonization/payments-history.service.tspackages/blocks/billing/payments-summary/src/api-harmonization/payments-summary.service.tspackages/blocks/notifications/notification-details/src/api-harmonization/notification-details.controller.tspackages/blocks/notifications/notification-details/src/api-harmonization/notification-details.service.tspackages/blocks/notifications/notification-list/src/api-harmonization/notification-list.service.tspackages/blocks/notifications/notification-summary/src/api-harmonization/notification-summary.service.tspackages/blocks/products/recommended-products/src/api-harmonization/recommended-products.service.tspackages/blocks/services/service-details/src/api-harmonization/service-details.service.tspackages/integrations/mocked/src/modules/invoices/invoices.service.tspackages/integrations/mocked/src/modules/notifications/notifications.service.tspackages/integrations/mocked/src/modules/resources/resources.service.ts
✅ Files skipped from review due to trivial changes (1)
- .changeset/tough-aliens-throw.md
What does this PR do?
Related Ticket(s)
Key Changes
How to test
Media (Loom or gif)
Summary by CodeRabbit
New Features
Chores