Skip to content
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

refactor(core): update user context type #5529

Merged
merged 5 commits into from
Mar 21, 2024

Conversation

darcyYe
Copy link
Contributor

@darcyYe darcyYe commented Mar 19, 2024

Summary

update user context type:

  1. In previous implementation, userInfoGuard was broken when applying .merge() or .extend() zod object method. Fixed by explicitly declare the mask key type used in zod object .pick() method.
  2. use update user context organizations from record to array.
  3. optimize the DB query in user context library method to improve performance.

Testing

Tested locally.
image

Checklist

  • .changeset
  • unit tests
  • integration tests
  • necessary TSDoc comments

Copy link

github-actions bot commented Mar 19, 2024

COMPARE TO master

Total Size Diff 📈 +279 Bytes

Diff by File
Name Diff
packages/console/src/components/ItemPreview/UserPreview.tsx 📈 +8 Bytes
packages/console/src/components/UserAccountInformation/index.tsx 📈 +30 Bytes
packages/console/src/pages/Roles/components/AssignToRoleModal/index.tsx 📈 +30 Bytes
packages/console/src/pages/UserDetails/utils.ts 📈 +30 Bytes
packages/console/src/utils/user.ts 📈 +12 Bytes
packages/core/src/libraries/jwt-customizer.ts 📈 +187 Bytes
packages/core/src/libraries/scope.ts 📈 +869 Bytes
packages/core/src/routes/role.scope.ts 📈 +577 Bytes
packages/core/src/tenants/Libraries.ts 📈 +120 Bytes
packages/schemas/src/types/jwt-customizer.ts 📈 +178 Bytes
packages/schemas/src/types/user.ts 📈 +122 Bytes

@github-actions github-actions bot added size/m and removed size/s labels Mar 19, 2024
Copy link
Contributor

@simeng-li simeng-li left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall LGTM. Better align a final agreement on the user context return fields. What strategy we are following, and maybe need to be included in the docs.

packages/core/src/libraries/jwt-customizer.ts Show resolved Hide resolved
@darcyYe darcyYe merged commit f727ef8 into master Mar 21, 2024
19 checks passed
@darcyYe darcyYe deleted the yemq-log-8446-update-user-context-type branch March 21, 2024 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Make it better size/m
Development

Successfully merging this pull request may close these issues.

4 participants