[NAE-2451] Optimize and Reduce Outcome Size - #342
Conversation
Updated resource service methods to include additional query fields (`outcomes`, `outcome`, `task(stringId)`, etc.) for task and case-related API calls. This enhancement ensures more comprehensive data retrieval for operations like assign, cancel, delegate, finish, and data manipulation.
Updated resource service methods to include additional query fields (`outcomes`, `outcome`, `task(stringId)`, etc.) for task and case-related API calls. This enhancement ensures more comprehensive data retrieval for operations like assign, cancel, delegate, finish, and data manipulation.
Enhanced task and case-related API methods by introducing `HttpParams` to support additional query parameters. This change enables more versatile and detailed requests for task and case operations.
WalkthroughThe engine resource services now accept optional request parameters. They apply default ChangesEngine request parameter support
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.ts`:
- Line 78: Update the service tests to omit HttpParams and verify each method’s
default fields projection: deleteCase and createCase in
projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.ts
(lines 78-78 and 116-116), and assignTask, cancelTask, delegateTask, finishTask,
getData, and setData in
projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts
(lines 61-61, 77-77, 93-93, 109-109, 221-221, and 246-246). Assert that each
request includes its expected default fields parameter.
In
`@projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.ts`:
- Around line 206-211: Update the default fields in rawGetData to include
outcome alongside outcomes, task(stringId), and data, so getData receives the
response required by its responseOutcome.outcome.data access. Preserve
caller-provided params unchanged.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: df7d027b-f8f2-4fac-8220-23fd6cb82e7c
📒 Files selected for processing (5)
projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.tsprojects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.tsprojects/netgrif-components-core/src/lib/resources/engine-endpoint/public/public-task-resource.service.tsprojects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.tsprojects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.ts
| inject([HttpTestingController], | ||
| (httpMock: HttpTestingController) => { | ||
| service.deleteCase('id').subscribe(res => { | ||
| service.deleteCase('id', false, new HttpParams()).subscribe(res => { |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Test the omitted-parameter behavior.
Every changed test supplies new HttpParams(). That bypasses the new default projection branch. Add no-parameter tests that assert the expected fields parameter.
projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.ts#L78-L78: calldeleteCasewithoutHttpParamsand assert its default projection.projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.ts#L116-L116: callcreateCasewithoutHttpParamsand assert its default projection.projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L61-L61: callassignTaskwithoutHttpParamsand assert its default projection.projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L77-L77: callcancelTaskwithoutHttpParamsand assert its default projection.projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L93-L93: calldelegateTaskwithoutHttpParamsand assert its default projection.projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L109-L109: callfinishTaskwithoutHttpParamsand assert its default projection.projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L221-L221: callgetDatawithoutHttpParamsand assert its default projection.projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L246-L246: callsetDatawithoutHttpParamsand assert its default projection.
📍 Affects 2 files
projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.ts#L78-L78(this comment)projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.ts#L116-L116projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L61-L61projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L77-L77projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L93-L93projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L109-L109projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L221-L221projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts#L246-L246
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.ts`
at line 78, Update the service tests to omit HttpParams and verify each method’s
default fields projection: deleteCase and createCase in
projects/netgrif-components-core/src/lib/resources/engine-endpoint/case-resource.service.spec.ts
(lines 78-78 and 116-116), and assignTask, cancelTask, delegateTask, finishTask,
getData, and setData in
projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.spec.ts
(lines 61-61, 77-77, 93-93, 109-109, 221-221, and 246-246). Assert that each
request includes its expected default fields parameter.
| public rawGetData(taskId: string, params?: Params): Observable<EventOutcomeMessageResource> { | ||
| if (!params) { | ||
| params = new HttpParams(); | ||
| params = params.set('fields', 'outcomes,task(stringId),data'); | ||
| } | ||
| return this._resourceProvider.get$('task/' + taskId + "/data", this.SERVER_URL, params) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Request outcome in the default projection.
When getData(taskId) omits params, this request does not select outcome. Line 233 then dereferences responseOutcome.outcome.data. Add outcome to the default fields to preserve the response required by getData.
Proposed fix
- params = params.set('fields', 'outcomes,task(stringId),data');
+ params = params.set('fields', 'outcomes,outcome,task(stringId),data');📝 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 rawGetData(taskId: string, params?: Params): Observable<EventOutcomeMessageResource> { | |
| if (!params) { | |
| params = new HttpParams(); | |
| params = params.set('fields', 'outcomes,task(stringId),data'); | |
| } | |
| return this._resourceProvider.get$('task/' + taskId + "/data", this.SERVER_URL, params) | |
| public rawGetData(taskId: string, params?: Params): Observable<EventOutcomeMessageResource> { | |
| if (!params) { | |
| params = new HttpParams(); | |
| params = params.set('fields', 'outcomes,outcome,task(stringId),data'); | |
| } | |
| return this._resourceProvider.get$('task/' + taskId + "/data", this.SERVER_URL, params) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@projects/netgrif-components-core/src/lib/resources/engine-endpoint/task-resource.service.ts`
around lines 206 - 211, Update the default fields in rawGetData to include
outcome alongside outcomes, task(stringId), and data, so getData receives the
response required by its responseOutcome.outcome.data access. Preserve
caller-provided params unchanged.
|


Description
Implements NAE-2451
Dependencies
No new dependencies were introduced
Third party dependencies
No new dependencies were introduced
Blocking Pull requests
There are no dependencies on other PR
How Has Been This Tested?
This was test manually and with unit tests.
Test Configuration
Checklist:
Summary by CodeRabbit