Skip to content

Resolves Issue #1715, Add expanded user map to registry org response#1835

Open
afoote-mitre wants to merge 2 commits into
devfrom
af-1715
Open

Resolves Issue #1715, Add expanded user map to registry org response#1835
afoote-mitre wants to merge 2 commits into
devfrom
af-1715

Conversation

@afoote-mitre
Copy link
Copy Markdown
Collaborator

Closes Issue #1715

Summary

Adds optional expanded user metadata to the single registry organization response via expand=users, reducing the need for clients to fetch all orgs/users just to resolve UUIDs in org views.

Important Changes

src/controller/org.controller/index.js

  • Allows expand=users on GET /api/registry/org/{identifier}
  • Documents the new query parameter in Swagger annotations

src/controller/org.controller/org.middleware.js

  • Maps the expand query parameter into req.ctx.query

src/controller/registry-org.controller/registry-org.controller.js

  • Adds _userMap hydration when expand=users is requested
  • Builds the map from org users, admins, defensive contact_info.additional_contacts, and visible conversation author_ids

src/repositories/baseUserRepository.js

  • Adds batch lookup for users by UUID

src/repositories/baseOrgRepository.js

  • Adds batch lookup for orgs containing user UUIDs

schemas/registry-org/get-registry-org-response.json

  • Documents the _userMap response object

api-docs/openapi.json

  • Adds expand query parameter documentation for the registry org lookup endpoint

test/unit-tests/org/registryOrgGetSingleTest.js

  • Adds unit coverage for default response behavior and expand=users

test/integration-tests/registry-org/registryOrgCRUDTest.js

  • Adds integration coverage for expanded user metadata on a registry org response

Testing

Steps to manually test updated functionality:

  • 1) Call GET /api/registry/org/{shortname} and verify _userMap is not present
  • 2) Call GET /api/registry/org/{shortname}?expand=users and verify _userMap is present
  • 3) Verify _userMap is keyed by user UUID and includes username, name, and org.short_name
  • 4) Add or find a conversation on the org and verify visible conversation author UUIDs are included in _userMap
  • 5) Call GET /api/registry/org/{shortname}?expand=invalid and verify the request is rejected

Recommended automated tests:

  • npm run test:integration
  • npm run test:unit-tests

Notes

  • _userMap is returned as an object keyed by UUID
  • contact_info.additional_contacts is handled defensively, but it is not currently modeled as a first-class registry org schema field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant