Skip to content

Feat/profile projects stats - #11032

Closed
aljem-mark wants to merge 30 commits into
hcengineering:developfrom
aljem-mark:feat/profile-projects-stats
Closed

aljem-mark wants to merge 30 commits into
hcengineering:developfrom
aljem-mark:feat/profile-projects-stats

Conversation

@aljem-mark

Copy link
Copy Markdown

No description provided.

Developer FL added 30 commits September 4, 2026 21:06
- Create UserProjects.svelte - shows workspace projects list
- Create UserStats.svelte - shows workspace issue/project stats
- Add to GlobalProfileApp.svelte below bio/location section
- Add i18n strings for Projects, NoProjects, Stats, NoStats
- Update en.json translations
- Add ViewMyProfile i18n string to workbench plugin.ts
- Add English translation for ViewMyProfile
- Add menu action in AccountPopup.svelte (AccountRole.User block)
- Navigation follows Select Workspace pattern: loc.path[0]=\"user\", path[1]=personUuid
- Only shown when person.personUuid is available
The query { members: uuid } matches documents where the members array
contains the value (MongoDB array containment semantics), but
{ members: [uuid] } matches exact array equality, which never matches
since members is always a multi-entry array.

This was the root cause of "No projects found" despite the user
being an explicit member.
createdBy uses PersonId (social ID) and assignee uses Ref<Person>
(document ref) - neither is compatible with PersonUuid/AccountUuid
from the profile route. Projects query via members: AccountUuid
is correct since AccountUuid extends PersonUuid (same UUID value).

Stats now show workspace-level totals instead of per-user counts
that would always return zero due to type mismatch.
The profile route provides userId as PersonUuid, but tracker and space
fields use different identifier types:
- assignee: Ref<Person> - resolved via Person lookup by personUuid
- members: AccountUuid - resolved via Employee lookup by personUuid
- createdBy: PersonId - cannot bridge from PersonUuid (social ID),
  permanently removed from stats

Both components now resolve the correct identifiers at runtime before
querying, matching how the existing sidebar queries work.
If userTrackr.class.Project and tracker.class.Issue with empty filters
also return zero, the issue is in the build pipeline, not the query logic.
… is available

The View My Profile menu item was navigating to the top-level /user/<uuid>
route which has no workspace client, causing getClient() to fail.

Changes:
- AccountPopup.svelte: navigate to path[2]=user, path[3]=personUuid
  (stays within workspace context, workspace client stays active)
- GlobalProfileApp.svelte: detect workspace vs top-level route and read
  userId from the correct path index (path[3] for workspace, path[1] for top-level)
- Add projects list and stats cards to the existing Profile.svelte
  in settings (workspace-scoped, getClient()/getCurrentAccount() available)
- Use myEmployeeStore._id (Ref<Person>) for assignee query
- Use account.uuid (AccountUuid) for members query
- View My Profile menu item now navigates to settings -> profile
- Add tracker dependency to setting-resources package.json
…orkspaceData RPC)

- New RPC endpoint getPersonWorkspaceData in server/account/src/operations.ts
  - Resolves account from token, queries all user workspaces
  - For each workspace, opens pipeline, queries projects + assigned issues
  - Returns data grouped by workspace
- New ProfileWorkspaceData type in account-client/src/types.ts
- New getPersonWorkspaceData method in account-client/src/client.ts
- GlobalProfileApp.svelte now uses accountClient.getPersonWorkspaceData()
  - No workspace context required - profile page works at /user/<uuid>
  - Renders projects and stats grouped per workspace
- Removed UserProjects.svelte and UserStats.svelte (replaced by RPC data)
- View My Profile navigates to top-level /user/<uuid> route
- Added server-tool, task, tracker deps to server/account/package.json
- Import ProfileWorkspaceData from @hcengineering/account-client
  instead of ./types where it does not exist
- Add @hcengineering/account-client dependency to server/account/package.json
- Use as any casts for AccountUuid/PersonId type mismatches
- Use as any[] cast for project mapping to avoid WithLookup type issues
- Rush update completed successfully
…adapter

- PersonUuid != Ref<Person> (Mongo _id) so querying assignee with
  personUuid always returned zero. Now resolves Person document by
  personUuid first, then queries issues with person._id (Ref<Person>)
- Add storageAdapter.close() in finally block to match ws-operations.ts
  pattern and prevent resource leaks
- Add @hcengineering/contact dependency to server/account/package.json
…perations

The TxOperations constructor expects a PersonId as its second argument.
systemAccountUuid is AccountUuid (same runtime value, different branded
type), causing TS2345. The workspace-service already uses the same
pattern: core.account.ConfigUser. Also added core namespace import.
The getServerPipeline approach fails in Docker because the adapter
factory is not available in the account container. The RPC now
returns workspace membership data from the account DB only.

Projects and issues will be queried client-side per workspace
via getClient() when the user navigates into a workspace context.
…gregation

The server-side pipeline approach failed in Docker (adapter factory not
configured in account container). CTO approved new architecture:

- Remove getPersonWorkspaceData RPC from server/account/operations.ts
- Remove getPersonWorkspaceData from account-client (interface + impl)
- GlobalProfileApp.svelte now uses getUserWorkspaces() + selectWorkspace()
  + clientFactory(token, endpoint) per workspace to query projects/issues
- ProfileWorkspaceData type kept for client-side use
- Add @hcengineering/client dependency to global-profile-resources

No server changes needed, no Docker rebuilds. Works on /user/:uuid route.
Project rows on the profile page now navigate to the tracker project
view using workbench path: [workbenchId, workspaceUrl, trackerId, projectId].
Added hover cursor style. Added @hcengineering/workbench dependency.
…s category grouping

Added issuesOngoing and issuesCompleted to ProfileWorkspaceData type.
Each workspace now fetches task.class.Status to map status IDs to
categories (Active/ToDo = ongoing, Won = completed), then splits
issue count into three stats. Replaced Projects stat card.
@aljem-mark aljem-mark closed this Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant