refactor(lightspeed): add middleware for resolving user identity#3227
refactor(lightspeed): add middleware for resolving user identity#3227Jdubrick wants to merge 6 commits into
Conversation
Code Review by Qodo
1.
|
Changed Packages
|
Review Summary by QodoRefactor user identity resolution into reusable middleware
WalkthroughsDescription• Centralizes user identity resolution via middleware to eliminate code duplication • Extends Express Request type with credentials and userEntityRef fields • Implements identity middleware in both lightspeed and notebooks routers • Adds comprehensive tests for middleware, permission denial, and identity deduplication Diagramflowchart LR
A["Express Request"] -->|"createIdentityMiddleware"| B["Resolve Credentials & UserEntityRef"]
B -->|"Attach to req"| C["Request with Identity"]
C -->|"getIdentity"| D["Extract & Validate Identity"]
D -->|"Return typed object"| E["Route Handlers"]
E -->|"Use credentials & userEntityRef"| F["Authorization & Operations"]
File Changes1. workspaces/lightspeed/plugins/lightspeed-backend/src/service/express.d.ts
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3227 +/- ##
==========================================
+ Coverage 53.82% 53.83% +0.01%
==========================================
Files 2362 2363 +1
Lines 84815 84824 +9
Branches 23508 23509 +1
==========================================
+ Hits 45650 45667 +17
+ Misses 37714 37706 -8
Partials 1451 1451
*This pull request uses carry forward flags. Click here to find out more. Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Signed-off-by: Jordan Dubrick <[email protected]>
Signed-off-by: Jordan Dubrick <[email protected]>
Signed-off-by: Jordan Dubrick <[email protected]>
…ebooks Signed-off-by: Jordan Dubrick <[email protected]>
Signed-off-by: Jordan Dubrick <[email protected]>
231d37a to
e5744e4
Compare
Signed-off-by: Jordan Dubrick <[email protected]>
|



Hey, I just made a Pull Request!
Moves the resolution of the user identity to a middleware step, this reduces a lot of the duplicated resolving code and makes it easier to extend for tasks in 2.1.0. This adds the user identity to the individual request by extending the Express Request type, so it is easy to reference.
✔️ Checklist