Skip to content

[NAE-2354] Include assignee userRealmId in task response#315

Merged
tuplle merged 9 commits intorelease/7.0.0-rev10from
NAE-2354
Feb 6, 2026
Merged

[NAE-2354] Include assignee userRealmId in task response#315
tuplle merged 9 commits intorelease/7.0.0-rev10from
NAE-2354

Conversation

@timbez
Copy link
Contributor

@timbez timbez commented Jan 15, 2026

Description

include userRealmId in Task resource interface

Implements NAE-2354

Dependencies

Third party dependencies

Blocking Pull requests

How Has Been This Tested?

manually tested

Name Tested on
OS Windows 11
Runtime Node 20.19.4
Dependency Manager NPM 10.8.2
Framework version 17.3.10
Run parameters
Other configuration

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes have been checked, personally or remotely, with @...
  • I have commented my code, particularly in hard-to-understand areas
  • I have resolved all conflicts with the target branch of the PR
  • I have updated and synced my code with the target branch
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes:
    • Lint test
    • Unit tests
    • Integration tests
  • I have checked my contribution with code analysis tools:
  • I have made corresponding changes to the documentation:
    • Developer documentation
    • User Guides
    • Migration Guides

Summary by CodeRabbit

  • New Features
    • Tasks now expose a structured assignee object; UI shows assignee full name instead of raw user IDs.
  • Refactor
    • Permission checks, blocking logic, assign/cancel/delegate/finish flows, and related mappings consistently use the assignee object and its id.
  • Tests
    • Updated tests and mocks to use the assignee shape in place of userId.
  • Public API
    • Assignee type added to public resources exports.

- include userRealmId in Task resource interface
@timbez timbez requested review from Kovy95 and machacjozef January 15, 2026 14:00
@timbez timbez self-assigned this Jan 15, 2026
@timbez timbez added the improvement New feature or request label Jan 15, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 15, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

Replaced Task.interface's userId: string with assignee?: Assignee and introduced an Assignee interface; updated code, tests, and public exports to use assignee (or assignee.id / assignee.fullName) instead of userId across permission checks, assignment/finish/cancel policies, task flows, views, panels, and mocks.

Changes

Cohort / File(s) Summary
Task model & public export
projects/netgrif-components-core/src/lib/resources/interface/task.ts, projects/netgrif-components-core/src/lib/resources/interface/assignee.ts, projects/netgrif-components-core/src/lib/resources/public-api.ts
Removed userId: string from Task; added assignee?: Assignee and exported new Assignee interface (id, realmId, username, fullName).
Authorization & permission checks
projects/netgrif-components-core/src/lib/authorization/permission/permission.service.ts, projects/netgrif-components-core/src/lib/authorization/permission/permission.service.spec.ts
Replaced checks on task.userId with task.assignee / task.assignee.id in permission logic; tests updated to use assignee.
Task policies & assignment logic
projects/netgrif-components-core/src/lib/task/services/assign-policy.service.ts, projects/netgrif-components-core/src/lib/task/services/finish-policy.service.ts, projects/netgrif-components-core/src/lib/task/services/assign-task.service.ts
Switched presence and identity checks from userId to assignee/assignee.id; added early return on closed-assignment mismatch and adjusted assign-flow predicate to check assignee.
Task content & delegate/cancel flows
projects/netgrif-components-core/src/lib/task/services/task-content.service.ts, projects/netgrif-components-core/src/lib/task/services/delegate-task.service.ts, projects/netgrif-components-core/src/lib/task/services/cancel-task.service.spec.ts
Now propagate and map assignee from event outcomes and build delegate side-menu values from the assignee object; tests adapted to assignee-shaped payloads.
Task data, view & panel layers
projects/netgrif-components-core/src/lib/task/services/task-data.service.ts, projects/netgrif-components-core/src/lib/panel/task-panel/abstract-task-panel.component.ts, projects/netgrif-components-core/src/lib/panel/task-panel/abstract-task-panel.component.spec.ts, projects/netgrif-components-core/src/lib/view/task-view/service/task-view.service.ts, projects/netgrif-components-core/src/lib/view/tree-case-view/tree-task-content/tree-task-content.service.ts
Replaced presence/identity/display checks to rely on assignee, assignee.id, or assignee.fullName instead of userId across UI display, blocking logic, and data-update flows; tests updated.
Tests & utilities (mocks)
projects/netgrif-components-core/src/lib/task/services/task-data.service.spec.ts, projects/netgrif-components-core/src/lib/task/services/assign-task.service.spec.ts, projects/netgrif-components-core/src/lib/task/services/assign-policy.service.spec.ts, projects/netgrif-components-core/src/lib/task/services/finish-task.service.spec.ts, projects/netgrif-components-core/src/lib/task/services/cancel-task.service.spec.ts, projects/netgrif-components-core/src/lib/utility/tests/utility/create-mock-task.ts
Updated test fixtures, assertions, and mock task creator to use nullable assignee instead of userId; no behavior changes beyond data-shape adjustments.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective: refactoring the Task interface to use an assignee object (which includes realmId) instead of a simple userId field, affecting multiple services and tests.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 3355fb8 and e151c5c.

📒 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 userRealmId property is correctly placed after userId, 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.

tuplle
tuplle previously approved these changes Jan 15, 2026
@machacjozef machacjozef changed the base branch from release/7.0.0-rev9 to release/7.0.0-rev10 January 19, 2026 15:45
@machacjozef machacjozef dismissed tuplle’s stale review January 19, 2026 15:45

The base branch was changed.

Retoocs
Retoocs previously approved these changes Jan 28, 2026
Kovy95
Kovy95 previously approved these changes Jan 29, 2026
- refactor Task to contain a new interface instead of just userId
@timbez timbez dismissed stale reviews from Kovy95 and Retoocs via eb2c928 February 3, 2026 14:36
@coderabbitai coderabbitai bot added the Medium label Feb 3, 2026
Copy link

@coderabbitai coderabbitai bot left a 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.

Retoocs
Retoocs previously approved these changes Feb 3, 2026
Copy link

@coderabbitai coderabbitai bot left a 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 | 🟡 Minor

Remove unused import.

The UserResourceSmall import is no longer referenced in this file after the refactoring from userId to assignee. Remove line 5.

@timbez timbez requested review from Kovy95, Retoocs and tuplle February 3, 2026 15:22
tuplle
tuplle previously approved these changes Feb 3, 2026
Copy link
Contributor

@Retoocs Retoocs left a 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)
Copy link

@coderabbitai coderabbitai bot left a 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 | 🟡 Minor

Change assignee: null to assignee: undefined at line 119 to match the interface definition.

Task.assignee is declared as optional (assignee?: Assignee) with JSDoc explicitly stating "otherwise undefined". With strictNullChecks enabled, using null contradicts the type contract and can mask issues. Line 78 correctly uses undefined; line 119 should match.

Fix
-                    assignee: null,
+                    assignee: undefined,

Copy link

@coderabbitai coderabbitai bot left a 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.

Retoocs
Retoocs previously approved these changes Feb 5, 2026
renczesstefan
renczesstefan previously approved these changes Feb 5, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 6, 2026
# Conflicts:
#	projects/netgrif-components-core/src/lib/task/services/delegate-task.service.ts
- Add full name assignment for safeTask assignee
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 6, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
33.3% Coverage on New Code (required ≥ 50%)

See analysis details on SonarQube Cloud

@tuplle tuplle merged commit 8fa889f into release/7.0.0-rev10 Feb 6, 2026
8 of 11 checks passed
@tuplle tuplle deleted the NAE-2354 branch February 6, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement New feature or request Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants