Skip to content

feat: add temporary API to replace enabled/disabled lists#1789

Open
tathagat2241 wants to merge 1 commit intomainfrom
temporary-replace-enabled-disabled-api
Open

feat: add temporary API to replace enabled/disabled lists#1789
tathagat2241 wants to merge 1 commit intomainfrom
temporary-replace-enabled-disabled-api

Conversation

@tathagat2241
Copy link
Contributor

@tathagat2241 tathagat2241 commented Feb 9, 2026

Changes

  • Add PUT /configurations/latest/handlers/:handlerType/replace-enabled-disabled endpoint
  • Add replaceHandlerEnabledDisabled controller method
  • Update tests to include new method and route
  • Update package-lock.json with new dependency

API Details

Endpoint: PUT /configurations/latest/handlers/:handlerType/replace-enabled-disabled

**Request Body:**n
{
"enabled": {
"sites": ["site-id-1", "site-id-2"],
"orgs": ["org-id-1"]
},
"disabled": {
"sites": ["site-id-3"],
"orgs": ["org-id-2"]
}
}

Please ensure your pull request adheres to the following guidelines:

  • make sure to link the related issues in this description. Or if there's no issue created, make sure you
    describe here the problem you're solving.
  • when merging / squashing, make sure the fixed issue references are visible in the commits, for easy compilation of release notes

Spacecat-shared PR: adobe/spacecat-shared#1328

If the PR is changing the API specification:

  • make sure you add a "Not implemented yet" note the endpoint description, if the implementation is not ready
    yet. Ideally, return a 501 status code with a message explaining the feature is not implemented yet.
  • make sure you add at least one example of the request and response.

If the PR is changing the API implementation or an entity exposed through the API:

  • make sure you update the API specification and the examples to reflect the changes.

If the PR is introducing a new audit type:

  • make sure you update the API specification with the type, schema of the audit result and an example

Related Issues

https://jira.corp.adobe.com/browse/SITES-40312

Thanks for contributing!

@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

* @param {UniversalContext} context - Context of the request.
* @return {Promise<Response>} Updated configuration response.
*/
/* c8 ignore start - temporary API, no unit tests needed */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even if its temporary better to have unit tests to check the contract and avoid unexpected destructions.

if (hasDisabledOrgs && !Array.isArray(data.disabled.orgs)) {
return badRequest('disabled.orgs must be an array');
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be we can simplify the checks like

if (!Array.isArray(data.enabled?.sites) || !Array.isArray(data.disabled?.sites) || !Array.isArray(data.enabled?.orgs) || !Array.isArray(data.disabled?.org)) {
     return badRequest('enabled/disabled sites/orgs must be an array');
}

rpapani
rpapani approved these changes Feb 25, 2026
@rpapani rpapani self-requested a review February 25, 2026 17:03
@rpapani
Copy link
Contributor

rpapani commented Feb 25, 2026

just realized the tests are missing, so reverted the approval, you're good to merge with tests.

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.

2 participants