[Customer Portal][BE] Fix updates/search payload field and remove unnecessary idToken passing - #163
Conversation
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughRemoved the exported Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
apps/customer-portal/backend/modules/updates/types.bal (1)
143-161:⚠️ Potential issue | 🟡 MinorStale doc comment: "Product base version" should be "Product version".
Line 147 still says
# Product base versionbut the field was renamed toproduct\-version. Update the comment to match.📝 Proposed fix
# Product name `@constraint`:String {minLength: 1} string product\-name; - # Product base version + # Product version `@constraint`:String {minLength: 1} string product\-version;apps/customer-portal/backend/modules/updates/updates.bal (1)
26-32:⚠️ Potential issue | 🟡 Minor
idTokenparameter is accepted but unused.
listUpdatesstill acceptsidToken(line 30), andprocessListUpdatesin utils.bal still forwards it (line 57), but the actual endpoint call on line 31 never uses it. Since this PR's goal is to removeidTokenpassing to the updates service, consider removing it fromlistUpdates,processListUpdates, and the call site inservice.balas well.📝 Suggested change for this function
# List updates based on the provided parameters. # -# + idToken - ID token for authentication # + payload - Payload for listing updates # + return - List of updates, or an error if the operation fails -public isolated function listUpdates(string idToken, ListUpdatePayload payload) returns UpdateResponse|error { +public isolated function listUpdates(ListUpdatePayload payload) returns UpdateResponse|error { return updatesClient->/updates/list\-updates.post(payload, readOnly = true); }apps/customer-portal/backend/service.bal (1)
1198-1198:⚠️ Potential issue | 🟡 Minor
idTokenis still passed toprocessListUpdateshere but is unused downstream.As noted in
updates.bal, theidTokenflows throughprocessListUpdates→listUpdatesbut is never sent to the updates service. If the intent is to fully remove token passing, clean up this call chain too.
d13528f
into
wso2-open-operations:customer-portal-milestone-1
Description
This PR corrects the payload field used in the
updates/searchAPI and removes unnecessaryidTokenpropagation to the updates service.Changes
Payload Field Correction
productBaseVersion→productVersionin theupdates/searchrequest payloadRemove idToken Passing
idTokenforwarding to the updates serviceReason
Payload Fix
The
updates/searchAPI was previously usingproductBaseVersion, which does not match the actual expected field name (productVersion). This caused contract inconsistency and potential integration issues.Token Removal
The updates service authenticates using the client credentials grant, and does not require a user token (
idToken). Passing theidTokenwas unnecessary and misleading from an authentication standpoint.Removing it:
Impact
Related Issues
Summary by CodeRabbit