Skip to content

feat(api): add POST /move endpoints to relocate resources between environments#8968

Open
NWichter wants to merge 5 commits intocoollabsio:nextfrom
NWichter:feat/api-move-resources-between-projects
Open

feat(api): add POST /move endpoints to relocate resources between environments#8968
NWichter wants to merge 5 commits intocoollabsio:nextfrom
NWichter:feat/api-move-resources-between-projects

Conversation

@NWichter
Copy link

@NWichter NWichter commented Mar 13, 2026

Changes

  • Add POST /api/v1/applications/{uuid}/move endpoint
  • Add POST /api/v1/databases/{uuid}/move endpoint
  • Add POST /api/v1/services/{uuid}/move endpoint
  • Add shared moveResourceToEnvironment() helper to avoid code duplication across the three controllers
  • Add ownedByCurrentTeamAPI scope to Environment model for team-scoped lookups

Accepts environment_uuid in the request body and moves the resource to the target environment within the same team. This is a purely organizational change — running containers are not affected. After moving, the resource will pick up shared environment variables from the new environment on the next deployment.

Issues

Category

  • Bug fix
  • Improvement
  • New feature
  • Adding new one click service
  • Fixing or updating existing one click service

Preview

No UI changes — API-only enhancement.

AI Assistance

  • AI was NOT used to create this PR
  • AI was used (please describe below)

If AI was used:

  • Tools used: Claude Code
  • How extensively: Used for implementation and tests. Reviewed and verified all changes.

Testing

  • 11 Pest feature tests in tests/Feature/MoveResourceApiTest.php
  • Covers: successful move (application, database, service), 404 not found, 422 validation errors, 400 already-in-environment, cross-team rejection, environment variable preservation after move
  • All tests pass locally

Contributor Agreement

Important

  • I have read and understood the contributor guidelines. If I have failed to follow any guideline, I understand that this PR may be closed without review.
  • I have searched existing issues and pull requests (including closed ones) to ensure this isn't a duplicate.
  • I have tested all the changes thoroughly with a local development instance of Coolify and I am confident that they will work as expected when a maintainer tests them.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant