Conversation
Signed-off-by: sujitaw <sujit.sutar@ayanworks.com>
Signed-off-by: sujitaw <sujit.sutar@ayanworks.com>
📝 WalkthroughWalkthroughRemoved the dashboard summary endpoint from EcosystemController and reintroduced it on PlatformController with a corresponding PlatformService method; also added a ForbiddenException guard in user verification to block ADMIN_CLIENT_ALIAS and a new error message entry for that case. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@apps/api-gateway/src/platform/platform.controller.ts`:
- Around line 340-341: The route method decorated with
`@Roles`(OrgRoles.PLATFORM_ADMIN) currently uses EcosystemRolesGuard; replace that
guard with OrgRolesGuard so this endpoint uses the same org-role check as other
platform-admin routes. Update the method decorators to
`@UseGuards`(AuthGuard('jwt'), OrgRolesGuard) (replacing EcosystemRolesGuard) to
ensure consistent authorization behavior for the PLATFORM_ADMIN-protected
endpoint.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e129f798-e969-489c-be7e-aea236cc320d
📒 Files selected for processing (3)
apps/api-gateway/src/ecosystem/ecosystem.controller.tsapps/api-gateway/src/platform/platform.controller.tsapps/api-gateway/src/platform/platform.service.ts
💤 Files with no reviewable changes (1)
- apps/api-gateway/src/ecosystem/ecosystem.controller.ts
Signed-off-by: sujitaw <sujit.sutar@ayanworks.com>
Signed-off-by: sujitaw <sujit.sutar@ayanworks.com>
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/user/src/user.service.ts (1)
141-145: Move the ADMIN alias guard before fetching credentials.The validation against
ADMIN_CLIENT_ALIASoccurs after callinggetCredentialsByAlias(clientAlias)on line 141. If the alias is forbidden, the credentials lookup is wasted work. Move the guard before line 141 to fail fast.♻️ Proposed refactor to fail fast
+ if (process.env.ADMIN_CLIENT_ALIAS === clientAlias) { + throw new ForbiddenException(ResponseMessages.user.error.adminAlias); + } + const clientDetails = await getCredentialsByAlias(clientAlias); - if (process.env.ADMIN_CLIENT_ALIAS === clientAlias) { - throw new ForbiddenException(ResponseMessages.user.error.adminAlias); - } try {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/user/src/user.service.ts` around lines 141 - 145, The code fetches credentials via getCredentialsByAlias(clientAlias) before checking the ADMIN_CLIENT_ALIAS guard; move the guard that compares process.env.ADMIN_CLIENT_ALIAS to clientAlias (the check that throws new ForbiddenException(ResponseMessages.user.error.adminAlias)) to run before calling getCredentialsByAlias so the function fails fast and avoids the unnecessary credentials lookup.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/user/src/user.service.ts`:
- Around line 141-145: The code fetches credentials via
getCredentialsByAlias(clientAlias) before checking the ADMIN_CLIENT_ALIAS guard;
move the guard that compares process.env.ADMIN_CLIENT_ALIAS to clientAlias (the
check that throws new
ForbiddenException(ResponseMessages.user.error.adminAlias)) to run before
calling getCredentialsByAlias so the function fails fast and avoids the
unnecessary credentials lookup.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 92df1b0a-fb78-48c6-beba-8eab71cc736e
📒 Files selected for processing (2)
apps/user/src/user.service.tslibs/common/src/response-messages/index.ts



What
Summary by CodeRabbit
Refactor
Bug Fixes