-
Notifications
You must be signed in to change notification settings - Fork 11
feat: add configuration management APIs and extend audit toggle to organizations #1408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
This PR will trigger a minor release when merged. |
| throw new Error('Context required'); | ||
| } | ||
| const { dataAccess } = ctx; | ||
| const { dataAccess, log } = ctx; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seem log added but not used ?
| } | ||
|
|
||
| configuration.updateQueues(queues); | ||
| await configuration.save(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before saving suggested to set updatedBy
see reference in siteController
| return badRequest('Configuration data is required and cannot be empty'); | ||
| } | ||
|
|
||
| const hasHandlers = configData.handlers !== undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use hasText for this everywhere
| const site = await Site.findByBaseURL(baseURL); | ||
| if (site === null) { | ||
| return { status: 404, message: `Site with baseURL: ${baseURL} not found.` }; | ||
| const isSiteOperation = baseURL !== undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use hasText
Summary
This PR implements comprehensive API endpoints for managing SpaceCat configurations and extends the audit toggle functionality to support organization-level operations.
Changes Made
New API Endpoints
Enhanced Endpoints
checkConfigurationorganizationIdController Changes (
src/controllers/configuration.js)updateQueuesmethod with validationupdateJobmethod with job type validationupdateHandlermethod with handler property validationupdateConfigurationmethod for flexible partial updatesgetLatestmethodrestoreVersion()methodgetByVersion()method to parse URL parameters correctlyController Changes (
src/controllers/sites-audits-toggle.js)validateInputto accept eitherbaseURLororganizationIdexecuteto handle both site-level and organization-level operationsRoutes (
src/routes/index.js)PUT /configurations/latest/queuesPATCH /configurations/latest/jobs/:jobTypePATCH /configurations/latest/handlers/:handlerTypePUT /configurations/latest→PATCH /configurations/latestOpenAPI Documentation
configuration-api.yamlwith all new endpoints and schema changesconfigurations-sites-audits-api.yamlto document organization-level supportTests
Dependencies
This PR depends on the spacecat-shared PR that exports the
checkConfigurationfunction and adds the configuration model methods.Testing
Please ensure your pull request adheres to the following guidelines:
describe here the problem you're solving.
If the PR is changing the API specification:
yet. Ideally, return a 501 status code with a message explaining the feature is not implemented yet.
If the PR is changing the API implementation or an entity exposed through the API:
If the PR is introducing a new audit type:
Related Issues
https://jira.corp.adobe.com/browse/LLMO-908
Thanks for contributing!