mirror of
https://github.com/Dvorinka/Containr.git
synced 2026-10-28 07:41:27 +00:00
feat(environments): env CRUD, workspace switcher, CLI + MCP parity (#68)
Environment lanes existed as seeded rows (production/preview/development) with a per-service environment label, but there was no way to list, create, or delete them. Adds the management surface and the switcher: - GET /projects/:id/environments with live service counts (sqlc) - POST /projects/:id/environments — lowercase dns-label names, 1-50 chars, unique per project (409 on dupe) - DELETE /environments/:id — refuses while it holds services (409) - Workspace service list gains env filter chips with counts plus an inline "+ env" creator - CLI: containr environments list|create|delete (--yes on delete); MCP: containr_environments_list/create/delete (delete needs confirm) - OpenAPI: new Environments tag + ProjectEnvironment schema Live-verified: list counts, name validation, dupe 409, empty delete, non-empty 409, CLI list. Generated with [Devin](https://devin.ai) Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
dd7b735b38
commit
60145f7b21
13 files changed
+727
-6
No files matched your search
@@ -125,3 +125,21 @@ SELECT p.id, p.name, p.description, p.owner_id, p.is_approved, p.created_at, p.u
|
||||
FROM projects p
|
||||
WHERE p.is_approved = false
|
||||
ORDER BY p.created_at DESC;
|
||||
|
||||
-- name: ListProjectEnvironments :many
|
||||
SELECT e.id, e.name, e.project_id, e.created_at, e.updated_at,
|
||||
(SELECT COUNT(*) FROM services s WHERE s.environment_id = e.id) AS service_count
|
||||
FROM environments e
|
||||
WHERE e.project_id = $1
|
||||
ORDER BY e.created_at;
|
||||
|
||||
-- name: GetProjectEnvironmentByName :one
|
||||
SELECT id, name, project_id, created_at, updated_at
|
||||
FROM environments
|
||||
WHERE project_id = $1 AND name = $2;
|
||||
|
||||
-- name: DeleteProjectEnvironment :exec
|
||||
DELETE FROM environments WHERE id = $1 AND project_id = $2;
|
||||
|
||||
-- name: CountEnvironmentServices :one
|
||||
SELECT COUNT(*) FROM services WHERE environment_id = $1;
|
||||
Reference in new issue
Block a user