Skip to content

Refactor Legacy Registry Update Endpoints to Use Body Only #1613

@david-rocca

Description

@david-rocca

Ticket: Refactor Legacy Registry Update Endpoints to Use Body Only

Description,

The endpoints in src/controller/org.controller that contain /registry in their path (specifically Updates/PUTs) currently rely on Query Parameters for input validation and data extraction.
This needs to be standardized to use the Request Body, consistent with the newer registry-org.controller implementation.

Affected Endpoints,

src/controller/org.controller/index.js

  1. PUT /registry/org/:shortname (Line ~496)
    • Currently validates parameters like id_quota, name, new_short_name etc. via query().
  2. PUT /registry/org/:shortname/user/:username (Line ~673)
    • Currently validates parameters like active, new_username, name.*, active_roles.* via query().
  3. PUT /registry/org/:shortname/user/:username/reset_secret (Line ~781)
    • (Verify if this consumes any params or just path; usually resets don't need body, but double check if strictness is applied).

Acceptance Criteria / TODOs,

1. Update Route Definitions (src/controller/org.controller/index.js)

  • For PUT /registry/org/:shortname:
    • Change query(...) validators to body(...) validators.
    • Update Swagger comments to show in: 'body' (or requestBody schema) instead of query params.
  • For PUT /registry/org/:shortname/user/:username:
    • Change query(...) validators to body(...) validators.
    • Update Swagger comments to show requestBody schema.

2. Update Controller Logic (src/controller/org.controller/org.controller.js)

  • updateOrg (Line ~297):
    • Use updateFull repository function for the body parameters
    • Use the current update repo function for the query parameters
  • updateUser (Line ~467):
    - [ ] Use updateFull repository function for the body parameters
    • Use the current update repo function for the query parameters

3. Verification,

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

Notes,

  • Be careful with overlapping parameter names.
  • Ensure array handling (e.g., active_roles) works correctly when parsed from JSON body vs Query string (Query string often requires toArray(), Body does not).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Needs Triage

Status

In Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions