Closed d02ev closed 1 week ago
This pull request introduces a new permission for the admin role in the backend configuration, allowing management of server URLs and API keys. It also adds new database columns for these configurations, updates the team controller and service to handle these new fields, and establishes a new route for saving the configurations. Additionally, the frontend is updated with a new function to save these settings and adjust the API base URL for different environments.
File Path | Change Summary |
---|---|
backend/config/settings.js | Added permission setServerUrlAndApiKey: [userRole.ADMIN] . |
backend/migrations/20241112155035-add_server_url_api_key_teams.js | Added columns serverUrl and apiKey to teams table with migration methods. |
backend/src/controllers/team.controller.js | Added function addServerUrlAndApiKey to handle server URL and API key addition and updated exports. |
backend/src/models/Team.js | Added fields apiKey and serverUrl as optional strings in the Team model. |
backend/src/routes/team.routes.js | Added new route PUT /set-config for saving server URL and API key, using the new controller function. |
backend/src/service/team.service.js | Added method addServerUrlAndApiKey for updating the Team model with new fields and improved transaction handling. |
frontend/src/scenes/settings/CodeTab/CodeTab.jsx | Introduced onSave function to save server URL and API key, updated button handler and imports. |
frontend/src/services/teamServices.js | Added function setConfig to send a PUT request to save configuration settings. |
frontend/src/utils/constants.js | Updated API_BASE_URL to switch between local and staging URLs. |
setOrg
in team.permissions
, indicating a related enhancement of permissions.setServerUrlAndApiKey
permission.backend/config/settings.js
, directly related to changes in the same file in this PR.getTeamCount
in team.service.js
, relevant to overall team management functionality.Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
serverUrl
andapiKey
columns to theteams
table.serverUrl
andapiKey
.