feat: Add resource and role_slug filter params to list role assignments#1585
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis PR adds filter options to role-assignment listing APIs, implements serializers to convert those options to snake_case, integrates serializers into Authorization listing methods, and adds Jest tests asserting serialized query parameters. ChangesRole-assignment listing filter options
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/authorization/authorization.spec.ts (1)
1756-1769: ⚡ Quick winAdd a standalone
resourceExternalIdfilter test case.Line 1756 through Line 1769 cover combo filtering, but there’s no test for
resourceExternalIdalone even though the options contract allows it independently. Adding that case will lock in the intended behavior.Suggested test addition
+ it('filters by resource external id only', async () => { + fetchOnce(listRoleAssignmentsFixture); + + await workos.authorization.listRoleAssignments({ + organizationMembershipId: testOrgMembershipId, + resourceExternalId: 'doc-456', + }); + + expect(fetchSearchParams()).toMatchObject({ + resource_external_id: 'doc-456', + }); + });
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7f6b6763-8b6b-40c4-bb09-90781c45c7af
📒 Files selected for processing (8)
src/authorization/authorization.spec.tssrc/authorization/authorization.tssrc/authorization/interfaces/list-role-assignments-for-resource-by-external-id-options.interface.tssrc/authorization/interfaces/list-role-assignments-for-resource-options.interface.tssrc/authorization/interfaces/list-role-assignments-options.interface.tssrc/authorization/serializers/index.tssrc/authorization/serializers/list-role-assignments-for-resource-options.serializer.tssrc/authorization/serializers/list-role-assignments-options.serializer.ts
Greptile SummaryThis PR extends three role-assignment listing endpoints with new optional filter query parameters (
Confidence Score: 4/5Safe to merge; changes are additive and the serialization logic is well-aligned with existing patterns. The implementation is straightforward and follows established codebase conventions. The only gap is a missing test for resourceExternalId used without resourceTypeSlug, which the JSDoc explicitly permits but no test exercises. src/authorization/authorization.spec.ts — the resourceExternalId-only filter path is untested. Important Files Changed
|
Description
Adds optional query filters to the authorization role-assignment listing endpoints, matching the new backend support:
listRoleAssignments(membership-scoped) gainsresourceId,resourceExternalId, andresourceTypeSlugfilters.listRoleAssignmentsForResourceandlistResourceRoleAssignments(resource-scoped, by ID and by external ID respectively) gain aroleSlugfilter.Summary by CodeRabbit
New Features
Tests