-
Notifications
You must be signed in to change notification settings - Fork 0
feat(api): add count endpoints for meetings and committees in dashboards #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Replace inefficient full resource fetching with dedicated count endpoints for project metrics. This improves performance by avoiding unnecessary data transfer when only counts are needed. - Add getMeetingsCount() method to meeting service - Add getCommitteesCount() method to committee service - Add QueryServiceCountResponse interface for count API responses - Update project controller to use count methods instead of fetching arrays - Remove TODO comments as optimization is now implemented 🤖 Generated with [Claude Code](https://claude.ai/code) Signed-off-by: Andres Tobon <[email protected]>
Replace inefficient array fetching with dedicated count endpoints across multiple dashboard components to improve performance and reduce bandwidth usage. Frontend changes: - Add getMeetingsCountByProject() and getCommitteesCountByProject() methods to services - Update project dashboard to use count endpoints for total statistics - Update meetings dashboard to use count endpoint for total meetings display - Update committees dashboard to use count endpoint for total committees display Backend changes: - Add /api/meetings/count and /api/committees/count endpoints - Add getMeetingsCount() and getCommitteesCount() controller methods - Utilize existing optimized count service methods Performance improvements: - Reduced bandwidth by fetching counts instead of full resource arrays - Better scalability as performance no longer degrades with resource growth - Faster loading times for dashboard statistics 🤖 Generated with [Claude Code](https://claude.ai/code) Signed-off-by: Andres Tobon <[email protected]>
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds dedicated count endpoints and client count signals: new server routes/controllers/services return numeric counts for meetings and committees via the microservice proxy; frontend services call those endpoints and Angular components use Signal count signals instead of deriving counts from full lists. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Comp as MeetingDashboardComponent
participant CliSvc as MeetingService (client)
participant API as HTTP /api/meetings/count
participant Router as MeetingsRouter
participant Ctl as MeetingController.getMeetingsCount
participant Svc as Server MeetingService.getMeetingsCount
participant Proxy as Microservice Proxy (/query/resources/count)
User->>Comp: View dashboard
Comp->>CliSvc: getMeetingsCountByProject(project.uid)
CliSvc->>API: GET /meetings/count?tags=project_uid:uid
API->>Router: route
Router->>Ctl: invoke
Ctl->>Svc: getMeetingsCount(req, query, type?)
Svc->>Proxy: GET /query/resources/count{...}
Proxy-->>Svc: { count, has_more }
Svc-->>Ctl: count (number)
Ctl-->>API: { count }
API-->>CliSvc: { count }
CliSvc-->>Comp: number
Note over Comp: meetingsCount signal updates (0 → response)
sequenceDiagram
autonumber
actor User
participant Comp as CommitteeDashboardComponent / ProjectComponent
participant CliSvc as CommitteeService (client)
participant API as HTTP /api/committees/count
participant Router as CommitteesRouter
participant Ctl as CommitteeController.getCommitteesCount
participant Svc as Server CommitteeService.getCommitteesCount
participant Proxy as Microservice Proxy (/query/resources/count)
User->>Comp: View committees
Comp->>CliSvc: getCommitteesCountByProject(project.uid)
CliSvc->>API: GET /committees/count?tags=project_uid:uid
API->>Router: route
Router->>Ctl: invoke
Ctl->>Svc: getCommitteesCount(req, query)
Svc->>Proxy: GET /query/resources/count{ type:'committee', ... }
Proxy-->>Svc: { count, has_more }
Svc-->>Ctl: count (number)
Ctl-->>API: { count }
API-->>CliSvc: { count }
CliSvc-->>Comp: number
Note over Comp: committeesCount signal updates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip 🧪 Early access (models): enabledWe are currently testing Sonnet 4.5 code review models, which should lead to better review quality. However, this model may result in higher noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience. Note:
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR optimizes dashboard performance by replacing inefficient array fetching with dedicated count endpoints for meetings and committees across multiple dashboard components.
- Add
/api/meetings/countand/api/committees/countendpoints to backend with corresponding service methods - Update frontend services with
getMeetingsCountByProject()andgetCommitteesCountByProject()methods - Optimize project dashboard, meetings dashboard, and committees dashboard to use count endpoints instead of fetching full arrays
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/shared/src/interfaces/api.interface.ts | Add QueryServiceCountResponse interface for count endpoint responses |
| apps/lfx-one/src/server/services/meeting.service.ts | Add getMeetingsCount service method |
| apps/lfx-one/src/server/services/committee.service.ts | Add getCommitteesCount service method |
| apps/lfx-one/src/server/routes/meetings.route.ts | Add /count route endpoint |
| apps/lfx-one/src/server/routes/committees.route.ts | Add /count route endpoint |
| apps/lfx-one/src/server/controllers/project.controller.ts | Replace array length counting with count service calls |
| apps/lfx-one/src/server/controllers/meeting.controller.ts | Add getMeetingsCount controller method |
| apps/lfx-one/src/server/controllers/committee.controller.ts | Add getCommitteesCount controller method |
| apps/lfx-one/src/app/shared/services/meeting.service.ts | Add getMeetingsCountByProject frontend service method |
| apps/lfx-one/src/app/shared/services/committee.service.ts | Add getCommitteesCountByProject frontend service method |
| apps/lfx-one/src/app/modules/project/meetings/meeting-dashboard/meeting-dashboard.component.ts | Use count endpoint for total meetings display |
| apps/lfx-one/src/app/modules/project/meetings/meeting-dashboard/meeting-dashboard.component.html | Update template to use meetingsCount signal |
| apps/lfx-one/src/app/modules/project/dashboard/project-dashboard/project.component.ts | Use count endpoints for project statistics |
| apps/lfx-one/src/app/modules/project/committees/committee-dashboard/committee-dashboard.component.ts | Use count endpoint for total committees display |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
✅ E2E Tests PassedBrowser: chromium All E2E tests passed successfully. Test Configuration
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (4)
apps/lfx-one/src/app/shared/services/meeting.service.ts (1)
25-80: Replace redundantswitchMapwithmapin count flow.Wrapping the response in
of()and chaining anotherpipe/switchMapadds an unnecessary hop. Usingmapkeeps the stream synchronous and removes the extra subscription layer.-import { catchError, defer, Observable, of, switchMap, take, tap, throwError } from 'rxjs'; +import { catchError, defer, map, Observable, of, switchMap, take, tap, throwError } from 'rxjs'; @@ - return this.http - .get<{ count: number }>('/api/meetings/count', { params }) - .pipe( - catchError((error) => { - console.error('Failed to load meetings count:', error); - return of({ count: 0 }); - }) - ) - .pipe( - // Extract just the count number from the response - switchMap((response) => of(response.count)) - ); + return this.http + .get<{ count: number }>('/api/meetings/count', { params }) + .pipe( + catchError((error) => { + console.error('Failed to load meetings count:', error); + return of({ count: 0 }); + }), + map((response) => response.count) + );apps/lfx-one/src/app/shared/services/committee.service.ts (1)
7-43: Streamline count extraction withmap.Same pattern here—
switchMap+of()is redundant. A singlemapkeeps the observable chain cleaner.-import { catchError, Observable, of, switchMap, take, tap, throwError } from 'rxjs'; +import { catchError, map, Observable, of, switchMap, take, tap, throwError } from 'rxjs'; @@ - return this.http - .get<{ count: number }>('/api/committees/count', { params }) - .pipe( - catchError((error) => { - console.error('Failed to load committees count:', error); - return of({ count: 0 }); - }) - ) - .pipe(switchMap((response) => of(response.count))); + return this.http + .get<{ count: number }>('/api/committees/count', { params }) + .pipe( + catchError((error) => { + console.error('Failed to load committees count:', error); + return of({ count: 0 }); + }), + map((response) => response.count) + );apps/lfx-one/src/server/controllers/project.controller.ts (2)
36-38: Fetch both counts in parallel per projectSlight perf win: run both count calls concurrently and then assign.
- project.meetings_count = Number(await this.meetingService.getMeetingsCount(req, { tags: `project_uid:${project.uid}` }).catch(() => 0)); - project.committees_count = Number(await this.committeeService.getCommitteesCount(req, { tags: `project_uid:${project.uid}` }).catch(() => 0)); + const [meetingsCount, committeesCount] = await Promise.all([ + this.meetingService.getMeetingsCount(req, { tags: `project_uid:${project.uid}` }).catch(() => 0), + this.committeeService.getCommitteesCount(req, { tags: `project_uid:${project.uid}` }).catch(() => 0), + ]); + project.meetings_count = Number(meetingsCount); + project.committees_count = Number(committeesCount);Also applies to: 87-89
35-39: Consider upstream protection for large project listsIf project lists can be large, cap concurrency to protect the query service (e.g., p-limit). Optional, depending on typical list sizes.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (14)
apps/lfx-one/src/app/modules/project/committees/committee-dashboard/committee-dashboard.component.ts(4 hunks)apps/lfx-one/src/app/modules/project/dashboard/project-dashboard/project.component.ts(4 hunks)apps/lfx-one/src/app/modules/project/meetings/meeting-dashboard/meeting-dashboard.component.html(1 hunks)apps/lfx-one/src/app/modules/project/meetings/meeting-dashboard/meeting-dashboard.component.ts(3 hunks)apps/lfx-one/src/app/shared/services/committee.service.ts(2 hunks)apps/lfx-one/src/app/shared/services/meeting.service.ts(1 hunks)apps/lfx-one/src/server/controllers/committee.controller.ts(1 hunks)apps/lfx-one/src/server/controllers/meeting.controller.ts(1 hunks)apps/lfx-one/src/server/controllers/project.controller.ts(2 hunks)apps/lfx-one/src/server/routes/committees.route.ts(1 hunks)apps/lfx-one/src/server/routes/meetings.route.ts(1 hunks)apps/lfx-one/src/server/services/committee.service.ts(2 hunks)apps/lfx-one/src/server/services/meeting.service.ts(2 hunks)packages/shared/src/interfaces/api.interface.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
packages/shared/src/interfaces/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Place all TypeScript interfaces in the shared package at packages/shared/src/interfaces
Files:
packages/shared/src/interfaces/api.interface.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Use TypeScript interfaces instead of union types for better maintainability
When defining PrimeNG-related types, reference the official PrimeNG component interfaces
Files:
packages/shared/src/interfaces/api.interface.tsapps/lfx-one/src/server/controllers/meeting.controller.tsapps/lfx-one/src/app/shared/services/meeting.service.tsapps/lfx-one/src/app/modules/project/committees/committee-dashboard/committee-dashboard.component.tsapps/lfx-one/src/server/controllers/project.controller.tsapps/lfx-one/src/app/modules/project/meetings/meeting-dashboard/meeting-dashboard.component.tsapps/lfx-one/src/server/services/committee.service.tsapps/lfx-one/src/server/services/meeting.service.tsapps/lfx-one/src/server/controllers/committee.controller.tsapps/lfx-one/src/server/routes/meetings.route.tsapps/lfx-one/src/app/modules/project/dashboard/project-dashboard/project.component.tsapps/lfx-one/src/app/shared/services/committee.service.tsapps/lfx-one/src/server/routes/committees.route.ts
**/*.{ts,tsx,js,jsx,mjs,cjs,html,css,scss}
📄 CodeRabbit inference engine (CLAUDE.md)
Include required license headers on all source files
Files:
packages/shared/src/interfaces/api.interface.tsapps/lfx-one/src/server/controllers/meeting.controller.tsapps/lfx-one/src/app/shared/services/meeting.service.tsapps/lfx-one/src/app/modules/project/meetings/meeting-dashboard/meeting-dashboard.component.htmlapps/lfx-one/src/app/modules/project/committees/committee-dashboard/committee-dashboard.component.tsapps/lfx-one/src/server/controllers/project.controller.tsapps/lfx-one/src/app/modules/project/meetings/meeting-dashboard/meeting-dashboard.component.tsapps/lfx-one/src/server/services/committee.service.tsapps/lfx-one/src/server/services/meeting.service.tsapps/lfx-one/src/server/controllers/committee.controller.tsapps/lfx-one/src/server/routes/meetings.route.tsapps/lfx-one/src/app/modules/project/dashboard/project-dashboard/project.component.tsapps/lfx-one/src/app/shared/services/committee.service.tsapps/lfx-one/src/server/routes/committees.route.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Do not nest ternary expressions
Files:
packages/shared/src/interfaces/api.interface.tsapps/lfx-one/src/server/controllers/meeting.controller.tsapps/lfx-one/src/app/shared/services/meeting.service.tsapps/lfx-one/src/app/modules/project/committees/committee-dashboard/committee-dashboard.component.tsapps/lfx-one/src/server/controllers/project.controller.tsapps/lfx-one/src/app/modules/project/meetings/meeting-dashboard/meeting-dashboard.component.tsapps/lfx-one/src/server/services/committee.service.tsapps/lfx-one/src/server/services/meeting.service.tsapps/lfx-one/src/server/controllers/committee.controller.tsapps/lfx-one/src/server/routes/meetings.route.tsapps/lfx-one/src/app/modules/project/dashboard/project-dashboard/project.component.tsapps/lfx-one/src/app/shared/services/committee.service.tsapps/lfx-one/src/server/routes/committees.route.ts
apps/lfx-one/src/**/*.html
📄 CodeRabbit inference engine (CLAUDE.md)
apps/lfx-one/src/**/*.html: Always add data-testid attributes when creating new Angular components for reliable test targeting
Use data-testid naming convention [section]-[component]-[element]
Files:
apps/lfx-one/src/app/modules/project/meetings/meeting-dashboard/meeting-dashboard.component.html
🧬 Code graph analysis (2)
apps/lfx-one/src/server/services/committee.service.ts (1)
packages/shared/src/interfaces/api.interface.ts (1)
QueryServiceCountResponse(67-73)
apps/lfx-one/src/server/services/meeting.service.ts (1)
packages/shared/src/interfaces/api.interface.ts (1)
QueryServiceCountResponse(67-73)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: E2E Tests / Playwright E2E Tests
🔇 Additional comments (14)
apps/lfx-one/src/server/services/committee.service.ts (1)
53-65: LGTM: lean count endpoint wrapperClean params build and typed proxy with QueryServiceCountResponse. Returning the raw count keeps the controller usage simple.
apps/lfx-one/src/server/services/meeting.service.ts (1)
67-79: LGTM: meetings count supportMatches the query-service contract and keeps meetingType consistent with resource type.
apps/lfx-one/src/app/modules/project/meetings/meeting-dashboard/meeting-dashboard.component.ts (1)
58-59: LGTM: introduce meetingsCount signalNew signal cleanly separates total count from list data.
apps/lfx-one/src/app/modules/project/committees/committee-dashboard/committee-dashboard.component.ts (2)
75-76: LGTM: totalCommittees derived from backend countUsing the count avoids loading full lists for the KPI.
64-65: LGTM: introduce committeesCount signalConsistent with the meetings dashboard approach.
apps/lfx-one/src/app/modules/project/dashboard/project-dashboard/project.component.ts (3)
177-194: LGTM: meetings count signal with proper error fallbackUses project$ and catchError; matches best practice for toSignal sources.
196-214: LGTM: committees count signal with proper error fallbackPattern mirrors meetings count; solid.
322-340: LGTM: switch stats to backend countsProjectStats now uses counts from dedicated endpoints; array-derived stats remain for secondary metrics.
apps/lfx-one/src/app/modules/project/meetings/meeting-dashboard/meeting-dashboard.component.html (1)
145-145: Update meets Angular signals best practices.The change to use
meetingsCount()instead ofmeetings().lengthaligns with the performance optimization goal of the PR, enabling dedicated count endpoints without fetching full arrays. This follows Angular signals best practices for reactive data binding.apps/lfx-one/src/server/routes/committees.route.ts (1)
14-14: Consider route ordering and potential conflicts.The new
/countroute is correctly positioned before the/:idroute, preventing parameter collision. The route delegation tocommitteeController.getCommitteesCountfollows the established pattern.packages/shared/src/interfaces/api.interface.ts (1)
63-74: Well-structured interface for count responses.The
QueryServiceCountResponseinterface provides a clear contract for count endpoints with:
- Typed
countfield for the resource counthas_moreboolean to indicate if the query scope should be narrowed- Comprehensive documentation explaining the fields
This interface properly supports the count-focused API endpoints introduced in the PR.
As per coding guidelines, this interface is correctly placed in the shared package at
packages/shared/src/interfaces.apps/lfx-one/src/server/controllers/committee.controller.ts (1)
39-60: Consistent controller pattern for count endpoint.The
getCommitteesCountmethod follows the established controller pattern with:
- Proper logging with
Logger.startandLogger.success/Logger.error- Consistent error handling that forwards to
next()- Clear response format
{ count }matching the API patternThe implementation correctly delegates to the service layer and maintains consistency with existing controller methods.
apps/lfx-one/src/server/controllers/meeting.controller.ts (1)
69-94: Consistent implementation following established patterns.The
getMeetingsCountmethod maintains consistency with the existing controller patterns:
- Proper logging with operation name
get_meetings_count- Query parameter sanitization for security
- Standard error handling and response format
{ count }- Clear documentation with route comment
The implementation correctly delegates to the service layer and follows the same structure as other controller methods.
apps/lfx-one/src/server/routes/meetings.route.ts (1)
21-23: No changes needed: count routes are consistent
Both meetings and committees definerouter.get('/count', …)under their respective mounts, yielding/api/meetings/countand/api/committees/count.Likely an incorrect or invalid review comment.
...-one/src/app/modules/project/committees/committee-dashboard/committee-dashboard.component.ts
Show resolved
Hide resolved
apps/lfx-one/src/app/modules/project/meetings/meeting-dashboard/meeting-dashboard.component.ts
Show resolved
Hide resolved
…ty extraction Replace unnecessary switchMap + of pattern with map for extracting count property from HTTP responses in meeting and committee services. Changes: - meetingService.getMeetingsCountByProject(): use map instead of switchMap + of - committeeService.getCommitteesCountByProject(): use map instead of switchMap + of This follows RxJS best practices where map should be used for synchronous transformations and switchMap only when flattening observables. 🤖 Generated with [Claude Code](https://claude.ai/code) Signed-off-by: Andres Tobon <[email protected]>
🚀 Deployment StatusYour branch has been deployed to: https://ui-pr-106.dev.v2.cluster.linuxfound.info Deployment Details:
The deployment will be automatically removed when this PR is closed. |
asithade
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Minor nit
...-one/src/app/modules/project/committees/committee-dashboard/committee-dashboard.component.ts
Outdated
Show resolved
Hide resolved
… services - Use QueryServiceCountResponse interface for better type safety in count endpoints - Remove unnecessary computed() wrapper for totalCommittees signal - Add proper interface imports for count response types This ensures consistent typing across count endpoints and eliminates redundant signal wrapping where direct signal assignment is sufficient. 🤖 Generated with [Claude Code](https://claude.ai/code) Signed-off-by: Andres Tobon <[email protected]>
… into andrest50/count-resources
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/lfx-one/src/app/modules/project/committees/committee-dashboard/committee-dashboard.component.ts (1)
75-76: Consider count endpoints for filtered statistics to match the performance optimization pattern.While
totalCommitteesnow uses a dedicated count endpoint,publicCommitteesandactiveVotingstill derive from the full committees array. For consistency with the PR's performance goals, consider adding filtered count endpoints (e.g.,getCommitteesCountByProjectwith query parameters forpublicandenable_votingfilters) to avoid fetching the full array just for statistics.Would you like me to open an issue to track adding filtered count endpoints for these statistics?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
apps/lfx-one/src/app/modules/project/committees/committee-dashboard/committee-dashboard.component.ts(3 hunks)apps/lfx-one/src/app/shared/services/committee.service.ts(2 hunks)apps/lfx-one/src/app/shared/services/meeting.service.ts(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/lfx-one/src/app/shared/services/committee.service.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Use TypeScript interfaces instead of union types for better maintainability
When defining PrimeNG-related types, reference the official PrimeNG component interfaces
Files:
apps/lfx-one/src/app/modules/project/committees/committee-dashboard/committee-dashboard.component.tsapps/lfx-one/src/app/shared/services/meeting.service.ts
**/*.{ts,tsx,js,jsx,mjs,cjs,html,css,scss}
📄 CodeRabbit inference engine (CLAUDE.md)
Include required license headers on all source files
Files:
apps/lfx-one/src/app/modules/project/committees/committee-dashboard/committee-dashboard.component.tsapps/lfx-one/src/app/shared/services/meeting.service.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Do not nest ternary expressions
Files:
apps/lfx-one/src/app/modules/project/committees/committee-dashboard/committee-dashboard.component.tsapps/lfx-one/src/app/shared/services/meeting.service.ts
🧬 Code graph analysis (1)
apps/lfx-one/src/app/shared/services/meeting.service.ts (1)
packages/shared/src/interfaces/api.interface.ts (1)
QueryServiceCountResponse(67-73)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: E2E Tests / Playwright E2E Tests
🔇 Additional comments (2)
apps/lfx-one/src/app/modules/project/committees/committee-dashboard/committee-dashboard.component.ts (1)
263-267: Address the reactivity and error handling issues flagged in previous review.This method still has the critical issues identified in the previous review:
- The project check is evaluated once at construction time rather than reacting to project changes.
- Missing error handling that could cause the signal stream to break.
The previous review comment provides a complete solution using
this.projectService.project$.pipe()with properswitchMapandcatchErroroperators.apps/lfx-one/src/app/shared/services/meeting.service.ts (1)
21-21: LGTM! Imports are correct.The
QueryServiceCountResponseinterface andmapoperator are properly imported and necessary for the new count method implementation.Also applies to: 26-26
| public getMeetingsCountByProject(projectId: string): Observable<number> { | ||
| const params = new HttpParams().set('tags', `project_uid:${projectId}`); | ||
| return this.http | ||
| .get<QueryServiceCountResponse>('/api/meetings/count', { params }) | ||
| .pipe( | ||
| catchError((error) => { | ||
| console.error('Failed to load meetings count:', error); | ||
| return of({ count: 0 }); | ||
| }) | ||
| ) | ||
| .pipe( | ||
| // Extract just the count number from the response | ||
| map((response) => response.count) | ||
| ); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combine operators into a single pipe call.
The double pipe chaining remains despite the previous review comment being marked as "Fixed." Both catchError and map should be combined into a single .pipe() call for idiomatic RxJS code.
Apply this diff to combine the operators:
public getMeetingsCountByProject(projectId: string): Observable<number> {
const params = new HttpParams().set('tags', `project_uid:${projectId}`);
- return this.http
- .get<QueryServiceCountResponse>('/api/meetings/count', { params })
- .pipe(
- catchError((error) => {
- console.error('Failed to load meetings count:', error);
- return of({ count: 0 });
- })
- )
- .pipe(
- // Extract just the count number from the response
- map((response) => response.count)
- );
+ return this.http.get<QueryServiceCountResponse>('/api/meetings/count', { params }).pipe(
+ catchError((error) => {
+ console.error('Failed to load meetings count:', error);
+ return of({ count: 0 });
+ }),
+ map((response) => response.count)
+ );
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| public getMeetingsCountByProject(projectId: string): Observable<number> { | |
| const params = new HttpParams().set('tags', `project_uid:${projectId}`); | |
| return this.http | |
| .get<QueryServiceCountResponse>('/api/meetings/count', { params }) | |
| .pipe( | |
| catchError((error) => { | |
| console.error('Failed to load meetings count:', error); | |
| return of({ count: 0 }); | |
| }) | |
| ) | |
| .pipe( | |
| // Extract just the count number from the response | |
| map((response) => response.count) | |
| ); | |
| } | |
| public getMeetingsCountByProject(projectId: string): Observable<number> { | |
| const params = new HttpParams().set('tags', `project_uid:${projectId}`); | |
| return this.http.get<QueryServiceCountResponse>('/api/meetings/count', { params }).pipe( | |
| catchError((error) => { | |
| console.error('Failed to load meetings count:', error); | |
| return of({ count: 0 }); | |
| }), | |
| map((response) => response.count) | |
| ); | |
| } |
🤖 Prompt for AI Agents
In apps/lfx-one/src/app/shared/services/meeting.service.ts around lines 68 to
82, combine the two .pipe() calls into a single .pipe(...) invocation; keep the
existing operator order (catchError(...) then map(...)) so the catchError
returns a QueryServiceCountResponse fallback ({ count: 0 }) which the subsequent
map can extract, i.e. replace the chained .pipe(catchError(...)).pipe(map(...))
with one .pipe(catchError(...), map(response => response.count)).
🧹 Deployment RemovedThe deployment for PR #106 has been removed. |
Summary
/api/meetings/countand/api/committees/countendpoints to backendgetMeetingsCountByProject()andgetCommitteesCountByProject()methodsPerformance Improvements
Changes Made
Backend
getMeetingsCount()andgetCommitteesCount()controller methodsFrontend
Test Plan
JIRA References
🤖 Generated with Claude Code