-
Notifications
You must be signed in to change notification settings - Fork 4
[NAE-2354] Include assignee userRealmId in task response #315
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
- include userRealmId in Task resource interface
|
Caution Review failedThe pull request is closed. WalkthroughReplaced Task.interface's Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@projects/netgrif-components-core/src/lib/resources/interface/task.ts`:
- Around line 32-33: Add a JSDoc comment for the userRealmId property in the
Task resource interface to match the existing documentation style used for
userId; locate the userRealmId declaration in the Task interface and add a short
JSDoc line explaining that it represents the realm/identity provider of the user
(e.g., references the same realm concept as UserResourceSmall) and any optional
semantics or format expectations so API consumers understand its purpose.
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
projects/netgrif-components-core/src/lib/resources/interface/task.ts
⏰ 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). (9)
- GitHub Check: task-list-completed
- GitHub Check: task-list-completed
- GitHub Check: task-list-completed
- GitHub Check: task-list-completed
- GitHub Check: task-list-completed
- GitHub Check: Matrix Test (24)
- GitHub Check: Matrix Test (20)
- GitHub Check: Test with SonarCloud
- GitHub Check: Matrix Test (22)
🔇 Additional comments (1)
projects/netgrif-components-core/src/lib/resources/interface/task.ts (1)
33-33: LGTM - Clean interface extension.The optional
userRealmIdproperty is correctly placed afteruserId, maintains backward compatibility, and follows the existing pattern for optional user-related fields in this interface.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
projects/netgrif-components-core/src/lib/resources/interface/task.ts
Outdated
Show resolved
Hide resolved
- refactor Task to contain a new interface instead of just userId
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: 4
🤖 Fix all issues with AI agents
In
`@projects/netgrif-components-core/src/lib/panel/task-panel/abstract-task-panel.component.ts`:
- Around line 427-428: Replace the ternary null check with optional chaining and
a nullish fallback in the return object inside AbstractTaskPanelComponent (the
expression that currently returns { value: task.assignee ?
task.assignee.fullName : '', icon: 'account_circle', type: 'meta' }); use
task.assignee?.fullName ?? '' for brevity and correctness, and remove or update
the TODO comment above that line if it is now stale following the User/Assignee
refactor.
In `@projects/netgrif-components-core/src/lib/resources/interface/task.ts`:
- Line 9: The import for Assignee uses double quotes while the rest of the file
uses single quotes; update the import statement referencing Assignee (import
{Assignee} from "./assignee") to use single quotes (import {Assignee} from
'./assignee') so quote style is consistent with other imports in the file.
- Around line 31-33: The assignee property is declared as a required Assignee
but the JSDoc and code use it as optional/undefined; update the Task interface
to make the property optional (change the type of assignee from Assignee to
Assignee | undefined or mark it optional with ? on the assignee property) so
usages like task.assignee === undefined and task.assignee?.id type-check
correctly; adjust the declaration of assignee in the interface (symbol:
assignee, type: Assignee) accordingly.
In
`@projects/netgrif-components-core/src/lib/task/services/delegate-task.service.ts`:
- Around line 80-82: The current construction of the UserValue for
this._safeTask.assignee uses fullName.split(' ')[0] and [1], which is fragile;
change parsing for fullName in delegate-task.service.ts so it is null-safe and
handles single-word and multi-part names: trim the fullName, split on whitespace
(e.g. split(/\s+/)), set firstName = parts[0] || '' and lastName =
parts.slice(1).join(' ') || '', and pass those into the UserValue constructor
while preserving the existing id, realmId and username fields from
this._safeTask.assignee; ensure you handle absent assignee or empty fullName by
falling back to empty strings.
projects/netgrif-components-core/src/lib/panel/task-panel/abstract-task-panel.component.ts
Show resolved
Hide resolved
projects/netgrif-components-core/src/lib/resources/interface/task.ts
Outdated
Show resolved
Hide resolved
projects/netgrif-components-core/src/lib/task/services/delegate-task.service.ts
Show resolved
Hide resolved
- add export to public-api.ts
- make assignee optional in Task
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: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
projects/netgrif-components-core/src/lib/resources/interface/task.ts (1)
5-5:⚠️ Potential issue | 🟡 MinorRemove unused import.
The
UserResourceSmallimport is no longer referenced in this file after the refactoring fromuserIdtoassignee. Remove line 5.
- implement coderabbit suggestion
Retoocs
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.
tests are failing
- fix mock Task properties for tests (userId replaced with assignee)
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: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
projects/netgrif-components-core/src/lib/task/services/finish-task.service.spec.ts (1)
72-79:⚠️ Potential issue | 🟡 MinorChange
assignee: nulltoassignee: undefinedat line 119 to match the interface definition.
Task.assigneeis declared as optional (assignee?: Assignee) with JSDoc explicitly stating "otherwise undefined". WithstrictNullChecksenabled, usingnullcontradicts the type contract and can mask issues. Line 78 correctly usesundefined; line 119 should match.Fix
- assignee: null, + assignee: undefined,
- fix broken tests
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
🤖 Fix all issues with AI agents
In
`@projects/netgrif-components-core/src/lib/task/services/task-data.service.spec.ts`:
- Around line 154-159: Extract the duplicated assignee literal into a reusable
helper (e.g., createMockAssignee) and replace both occurrences that set
taskContentService.task.assignee with calls to that helper; implement
createMockAssignee(overrides?: Partial<Assignee>): Assignee returning the
default shape { id: '', realmId: '', username: '', fullName: '', ...overrides }
and import/define it alongside existing test helpers like
createMockTask/createMockField so tests use createMockAssignee() instead of
repeating the object.
projects/netgrif-components-core/src/lib/task/services/task-data.service.spec.ts
Show resolved
Hide resolved
# Conflicts: # projects/netgrif-components-core/src/lib/task/services/delegate-task.service.ts
- Add full name assignment for safeTask assignee
ad995c6
|


Description
include userRealmId in Task resource interface
Implements NAE-2354
Dependencies
Third party dependencies
Blocking Pull requests
How Has Been This Tested?
manually tested
Checklist:
Summary by CodeRabbit